Merge "[Wi-Fi] Use getUriHelpString() result to judge if show the Openroaming help button." into rvc-dev
This commit is contained in:
@@ -102,12 +102,11 @@ public class WifiEntryPreference extends Preference implements WifiEntry.WifiEnt
|
|||||||
// Turn off divider
|
// Turn off divider
|
||||||
view.findViewById(R.id.two_target_divider).setVisibility(View.INVISIBLE);
|
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 ImageButton imageButton = (ImageButton) view.findViewById(R.id.icon_button);
|
||||||
final ImageView frictionImageView = (ImageView) view.findViewById(
|
final ImageView frictionImageView = (ImageView) view.findViewById(
|
||||||
R.id.friction_icon);
|
R.id.friction_icon);
|
||||||
if (mWifiEntry.canManageSubscription() && !mWifiEntry.isSaved()
|
if (mWifiEntry.getHelpUriString() != null
|
||||||
&& !mWifiEntry.isSubscription()
|
|
||||||
&& mWifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_DISCONNECTED) {
|
&& mWifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_DISCONNECTED) {
|
||||||
final Drawable drawablehelp = getDrawable(R.drawable.ic_help);
|
final Drawable drawablehelp = getDrawable(R.drawable.ic_help);
|
||||||
drawablehelp.setTintList(
|
drawablehelp.setTintList(
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class WifiEntryPreferenceTest {
|
|||||||
|
|
||||||
private static final String MOCK_TITLE = "title";
|
private static final String MOCK_TITLE = "title";
|
||||||
private static final String MOCK_SUMMARY = "summary";
|
private static final String MOCK_SUMMARY = "summary";
|
||||||
|
private static final String FAKE_URI_STRING = "fakeuri";
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
@@ -155,22 +155,23 @@ public class WifiEntryPreferenceTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void canManageSubscription_shouldSetImageButtonVisible() {
|
public void notNull_whenGetHelpUriString_shouldSetImageButtonVisible() {
|
||||||
when(mMockWifiEntry.canManageSubscription()).thenReturn(true);
|
when(mMockWifiEntry.getHelpUriString()).thenReturn(FAKE_URI_STRING);
|
||||||
final WifiEntryPreference pref =
|
final WifiEntryPreference pref =
|
||||||
new WifiEntryPreference(mContext, mMockWifiEntry, mMockIconInjector);
|
new WifiEntryPreference(mContext, mMockWifiEntry, mMockIconInjector);
|
||||||
final LayoutInflater inflater = LayoutInflater.from(mContext);
|
final LayoutInflater inflater = LayoutInflater.from(mContext);
|
||||||
final View view = inflater.inflate(pref.getLayoutResource(), new LinearLayout(mContext),
|
final View view = inflater.inflate(pref.getLayoutResource(), new LinearLayout(mContext),
|
||||||
false);
|
false);
|
||||||
final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(view);
|
final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(view);
|
||||||
|
|
||||||
pref.onBindViewHolder(holder);
|
pref.onBindViewHolder(holder);
|
||||||
|
|
||||||
assertThat(view.findViewById(R.id.icon_button).getVisibility()).isEqualTo(View.VISIBLE);
|
assertThat(view.findViewById(R.id.icon_button).getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void helpButton_whenCanManageSubscription_shouldSetCorrectContentDescription() {
|
public void helpButton_whenGetHelpUriStringNotNull_shouldSetCorrectContentDescription() {
|
||||||
when(mMockWifiEntry.canManageSubscription()).thenReturn(true);
|
when(mMockWifiEntry.getHelpUriString()).thenReturn(FAKE_URI_STRING);
|
||||||
final WifiEntryPreference pref =
|
final WifiEntryPreference pref =
|
||||||
new WifiEntryPreference(mContext, mMockWifiEntry, mMockIconInjector);
|
new WifiEntryPreference(mContext, mMockWifiEntry, mMockIconInjector);
|
||||||
final LayoutInflater inflater = LayoutInflater.from(mContext);
|
final LayoutInflater inflater = LayoutInflater.from(mContext);
|
||||||
|
|||||||
Reference in New Issue
Block a user