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

Commit 06010c84 authored by Daniel Norman's avatar Daniel Norman
Browse files

Adds a getter for IllustrationPreference content description.

Needed for building accessibility node collection info for a list that
contains these preferences.

Bug: 318607873
Test: atest IllustrationPreferenceTest
Flag: NONE the change in topic using this getter is flagged
Change-Id: I15745465f148493e148c7489bffd4d780a6e2a34
parent 67271f5b
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import android.view.ViewGroup.LayoutParams;
import android.widget.FrameLayout;
import android.widget.ImageView;

import androidx.annotation.Nullable;
import androidx.annotation.RawRes;
import androidx.annotation.StringRes;
import androidx.preference.Preference;
@@ -242,6 +243,14 @@ public class IllustrationPreference extends Preference {
        setContentDescription(getContext().getText(contentDescriptionResId));
    }

    /**
     * Gets the content description set by {@link #setContentDescription}.
     */
    @Nullable
    public CharSequence getContentDescription() {
        return mContentDescription;
    }

    /**
     * Gets the lottie illustration resource id.
     */
+8 −0
Original line number Diff line number Diff line
@@ -291,4 +291,12 @@ public class IllustrationPreferenceTest {

        assertThat(mPreference.isApplyDynamicColor()).isTrue();
    }

    @Test
    public void setContentDescription_getContentDescription_isEqual() {
        final String contentDesc = "content desc";
        mPreference.setContentDescription(contentDesc);

        assertThat(mPreference.getContentDescription().toString()).isEqualTo(contentDesc);
    }
}