Loading packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java +9 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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. */ Loading packages/SettingsLib/tests/robotests/src/com/android/settingslib/widget/IllustrationPreferenceTest.java +8 −0 Original line number Diff line number Diff line Loading @@ -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); } } Loading
packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java +9 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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. */ Loading
packages/SettingsLib/tests/robotests/src/com/android/settingslib/widget/IllustrationPreferenceTest.java +8 −0 Original line number Diff line number Diff line Loading @@ -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); } }