diff options
| -rw-r--r-- | packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java b/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java index bbf0315aa475..4387b6f061c3 100644 --- a/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java +++ b/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java @@ -16,6 +16,8 @@ package com.android.settingslib.widget; +import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_YES; + import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; @@ -122,6 +124,8 @@ public class IllustrationPreference extends Preference { public void onBindViewHolder(PreferenceViewHolder holder) { super.onBindViewHolder(holder); + final FrameLayout illustrationFrame = (FrameLayout) holder.findViewById( + R.id.illustration_frame); final ImageView backgroundView = (ImageView) holder.findViewById(R.id.background_view); final FrameLayout middleGroundLayout = @@ -130,15 +134,15 @@ public class IllustrationPreference extends Preference { (LottieAnimationView) holder.findViewById(R.id.lottie_view); if (illustrationView != null && !TextUtils.isEmpty(mContentDescription)) { illustrationView.setContentDescription(mContentDescription); - illustrationView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); + illustrationView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); + final View illustrationContainer = (View) illustrationFrame.getParent(); + illustrationContainer.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); } // To solve the problem of non-compliant illustrations, we set the frame height // to 300dp and set the length of the short side of the screen to // the width of the frame. final int screenWidth = getContext().getResources().getDisplayMetrics().widthPixels; final int screenHeight = getContext().getResources().getDisplayMetrics().heightPixels; - final FrameLayout illustrationFrame = (FrameLayout) holder.findViewById( - R.id.illustration_frame); final LayoutParams lp = (LayoutParams) illustrationFrame.getLayoutParams(); lp.width = screenWidth < screenHeight ? screenWidth : screenHeight; illustrationFrame.setLayoutParams(lp); |