Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bbdfb53c authored by Goven Liu's avatar Goven Liu Committed by Android (Google) Code Review
Browse files

Merge "[Wi-Fi] Use getUriHelpString() result to judge if show the Openroaming...

Merge "[Wi-Fi] Use getUriHelpString() result to judge if show the Openroaming help button." into rvc-dev
parents 8fc6e456 446ba160
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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(
+6 −5
Original line number Diff line number Diff line
@@ -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() {
@@ -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);