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

Commit fc7b0a28 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "[Wi-Fi] Add content description for the Openroaming help button." into...

Merge "[Wi-Fi] Add content description for the Openroaming help button." into rvc-dev am: 19e60c05

Change-Id: I2870d29b3521436d2ec5b23793e706c8ffdc55fd
parents 926b2431 19e60c05
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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 &amp; feedback</string>
</resources>
+4 −0
Original line number Diff line number Diff line
@@ -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);
            }
+31 −0
Original line number Diff line number Diff line
@@ -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);
    }
}