Merge "[Wi-Fi] Add content description for the Openroaming help button." into rvc-dev am: 19e60c0596
Change-Id: I2870d29b3521436d2ec5b23793e706c8ffdc55fd
This commit is contained in:
@@ -1281,4 +1281,7 @@
|
||||
|
||||
<!-- Name of the 3.5mm audio device. [CHAR LIMIT=40] -->
|
||||
<string name="media_transfer_wired_device_name">Wired audio device</string>
|
||||
|
||||
<!-- Help button label [CHAR LIMIT=40] -->
|
||||
<string name="help_label">Help & feedback</string>
|
||||
</resources>
|
||||
|
||||
@@ -107,6 +107,7 @@ public class WifiEntryPreference extends Preference implements WifiEntry.WifiEnt
|
||||
final ImageView frictionImageView = (ImageView) view.findViewById(
|
||||
R.id.friction_icon);
|
||||
if (mWifiEntry.canManageSubscription() && !mWifiEntry.isSaved()
|
||||
&& !mWifiEntry.isSubscription()
|
||||
&& mWifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_DISCONNECTED) {
|
||||
final Drawable drawablehelp = getDrawable(R.drawable.ic_help);
|
||||
drawablehelp.setTintList(
|
||||
@@ -114,6 +115,9 @@ public class WifiEntryPreference extends Preference implements WifiEntry.WifiEnt
|
||||
((ImageView) imageButton).setImageDrawable(drawablehelp);
|
||||
imageButton.setVisibility(View.VISIBLE);
|
||||
imageButton.setOnClickListener(this);
|
||||
imageButton.setContentDescription(
|
||||
getContext().getText(R.string.help_label));
|
||||
|
||||
if (frictionImageView != null) {
|
||||
frictionImageView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@@ -167,4 +167,35 @@ public class WifiEntryPreferenceTest {
|
||||
|
||||
assertThat(view.findViewById(R.id.icon_button).getVisibility()).isEqualTo(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void helpButton_whenCanManageSubscription_shouldSetCorrectContentDescription() {
|
||||
when(mMockWifiEntry.canManageSubscription()).thenReturn(true);
|
||||
final WifiEntryPreference pref =
|
||||
new WifiEntryPreference(mContext, mMockWifiEntry, mMockIconInjector);
|
||||
final LayoutInflater inflater = LayoutInflater.from(mContext);
|
||||
final View view = inflater.inflate(pref.getLayoutResource(), new LinearLayout(mContext),
|
||||
false);
|
||||
final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(view);
|
||||
|
||||
pref.onBindViewHolder(holder);
|
||||
|
||||
assertThat(view.findViewById(R.id.icon_button).getContentDescription()).isEqualTo(
|
||||
mContext.getString(R.string.help_label));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void subscriptionEntry_shouldSetImageButtonGone() {
|
||||
when(mMockWifiEntry.isSubscription()).thenReturn(true);
|
||||
final WifiEntryPreference pref =
|
||||
new WifiEntryPreference(mContext, mMockWifiEntry, mMockIconInjector);
|
||||
final LayoutInflater inflater = LayoutInflater.from(mContext);
|
||||
final View view = inflater.inflate(pref.getLayoutResource(), new LinearLayout(mContext),
|
||||
false);
|
||||
final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(view);
|
||||
|
||||
pref.onBindViewHolder(holder);
|
||||
|
||||
assertThat(view.findViewById(R.id.icon_button).getVisibility()).isEqualTo(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user