Loading packages/SettingsLib/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -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> packages/SettingsLib/src/com/android/settingslib/wifi/WifiEntryPreference.java +4 −0 Original line number Diff line number Diff line Loading @@ -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( Loading @@ -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); } Loading packages/SettingsLib/tests/robotests/src/com/android/settingslib/wifi/WifiEntryPreferenceTest.java +31 −0 Original line number Diff line number Diff line Loading @@ -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); } } Loading
packages/SettingsLib/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -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>
packages/SettingsLib/src/com/android/settingslib/wifi/WifiEntryPreference.java +4 −0 Original line number Diff line number Diff line Loading @@ -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( Loading @@ -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); } Loading
packages/SettingsLib/tests/robotests/src/com/android/settingslib/wifi/WifiEntryPreferenceTest.java +31 −0 Original line number Diff line number Diff line Loading @@ -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); } }