Loading packages/SettingsLib/src/com/android/settingslib/wifi/WifiEntryPreference.java +2 −3 Original line number Diff line number Diff line Loading @@ -102,12 +102,11 @@ public class WifiEntryPreference extends Preference implements WifiEntry.WifiEnt // Turn off divider view.findViewById(R.id.two_target_divider).setVisibility(View.INVISIBLE); // Enable the icon button when this Entry is a canManageSubscription entry. // Enable the icon button when the help string in this WifiEntry is not null. final ImageButton imageButton = (ImageButton) view.findViewById(R.id.icon_button); final ImageView frictionImageView = (ImageView) view.findViewById( R.id.friction_icon); if (mWifiEntry.canManageSubscription() && !mWifiEntry.isSaved() && !mWifiEntry.isSubscription() if (mWifiEntry.getHelpUriString() != null && mWifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_DISCONNECTED) { final Drawable drawablehelp = getDrawable(R.drawable.ic_help); drawablehelp.setTintList( Loading packages/SettingsLib/tests/robotests/src/com/android/settingslib/wifi/WifiEntryPreferenceTest.java +6 −5 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ public class WifiEntryPreferenceTest { private static final String MOCK_TITLE = "title"; private static final String MOCK_SUMMARY = "summary"; private static final String FAKE_URI_STRING = "fakeuri"; @Before public void setUp() { Loading Loading @@ -155,22 +155,23 @@ public class WifiEntryPreferenceTest { } @Test public void canManageSubscription_shouldSetImageButtonVisible() { when(mMockWifiEntry.canManageSubscription()).thenReturn(true); public void notNull_whenGetHelpUriString_shouldSetImageButtonVisible() { when(mMockWifiEntry.getHelpUriString()).thenReturn(FAKE_URI_STRING); 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.VISIBLE); } @Test public void helpButton_whenCanManageSubscription_shouldSetCorrectContentDescription() { when(mMockWifiEntry.canManageSubscription()).thenReturn(true); public void helpButton_whenGetHelpUriStringNotNull_shouldSetCorrectContentDescription() { when(mMockWifiEntry.getHelpUriString()).thenReturn(FAKE_URI_STRING); final WifiEntryPreference pref = new WifiEntryPreference(mContext, mMockWifiEntry, mMockIconInjector); final LayoutInflater inflater = LayoutInflater.from(mContext); Loading Loading
packages/SettingsLib/src/com/android/settingslib/wifi/WifiEntryPreference.java +2 −3 Original line number Diff line number Diff line Loading @@ -102,12 +102,11 @@ public class WifiEntryPreference extends Preference implements WifiEntry.WifiEnt // Turn off divider view.findViewById(R.id.two_target_divider).setVisibility(View.INVISIBLE); // Enable the icon button when this Entry is a canManageSubscription entry. // Enable the icon button when the help string in this WifiEntry is not null. final ImageButton imageButton = (ImageButton) view.findViewById(R.id.icon_button); final ImageView frictionImageView = (ImageView) view.findViewById( R.id.friction_icon); if (mWifiEntry.canManageSubscription() && !mWifiEntry.isSaved() && !mWifiEntry.isSubscription() if (mWifiEntry.getHelpUriString() != null && mWifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_DISCONNECTED) { final Drawable drawablehelp = getDrawable(R.drawable.ic_help); drawablehelp.setTintList( Loading
packages/SettingsLib/tests/robotests/src/com/android/settingslib/wifi/WifiEntryPreferenceTest.java +6 −5 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ public class WifiEntryPreferenceTest { private static final String MOCK_TITLE = "title"; private static final String MOCK_SUMMARY = "summary"; private static final String FAKE_URI_STRING = "fakeuri"; @Before public void setUp() { Loading Loading @@ -155,22 +155,23 @@ public class WifiEntryPreferenceTest { } @Test public void canManageSubscription_shouldSetImageButtonVisible() { when(mMockWifiEntry.canManageSubscription()).thenReturn(true); public void notNull_whenGetHelpUriString_shouldSetImageButtonVisible() { when(mMockWifiEntry.getHelpUriString()).thenReturn(FAKE_URI_STRING); 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.VISIBLE); } @Test public void helpButton_whenCanManageSubscription_shouldSetCorrectContentDescription() { when(mMockWifiEntry.canManageSubscription()).thenReturn(true); public void helpButton_whenGetHelpUriStringNotNull_shouldSetCorrectContentDescription() { when(mMockWifiEntry.getHelpUriString()).thenReturn(FAKE_URI_STRING); final WifiEntryPreference pref = new WifiEntryPreference(mContext, mMockWifiEntry, mMockIconInjector); final LayoutInflater inflater = LayoutInflater.from(mContext); Loading