From 7960b884817b03e6e59e7c4ab64266976b24ecf8 Mon Sep 17 00:00:00 2001 From: ryanlwlin Date: Tue, 11 May 2021 19:35:10 +0800 Subject: [PATCH] Fix incorrect layout in RTL Fix illustration and the textview alginment. The imageview doesn't change the direction of the drawable, so we change scale type based on layout direction. Bug: 187526643 Test: manually test with with locale ur and en Change-Id: Ie4544f0eb00309a6132e4b6d794ad2a76966133c --- res/layout/dialog_single_radio_choice_list_item.xml | 4 ++-- .../settings/accessibility/ItemInfoArrayAdapter.java | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/res/layout/dialog_single_radio_choice_list_item.xml b/res/layout/dialog_single_radio_choice_list_item.xml index 5842528935b..49ef352e753 100644 --- a/res/layout/dialog_single_radio_choice_list_item.xml +++ b/res/layout/dialog_single_radio_choice_list_item.xml @@ -50,7 +50,7 @@ android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceListItemSecondary" android:layout_marginTop="8dp" - android:layout_alignLeft="@id/title" + android:layout_alignStart="@id/title" android:layout_below="@id/title" /> \ No newline at end of file diff --git a/src/com/android/settings/accessibility/ItemInfoArrayAdapter.java b/src/com/android/settings/accessibility/ItemInfoArrayAdapter.java index edb16a2a4e4..a7c41771cea 100644 --- a/src/com/android/settings/accessibility/ItemInfoArrayAdapter.java +++ b/src/com/android/settings/accessibility/ItemInfoArrayAdapter.java @@ -61,6 +61,12 @@ public class ItemInfoArrayAdapter exten } final ImageView image = root.findViewById(R.id.image); image.setImageResource(item.mDrawableId); + if (getContext().getResources().getConfiguration().getLayoutDirection() + == View.LAYOUT_DIRECTION_LTR) { + image.setScaleType(ImageView.ScaleType.FIT_START); + } else { + image.setScaleType(ImageView.ScaleType.FIT_END); + } return root; }