From d53e689d7391fa2bac95f7e5b192c365762058f9 Mon Sep 17 00:00:00 2001 From: Peter_Liang Date: Mon, 27 Sep 2021 16:30:52 +0800 Subject: [PATCH 1/2] Fix the bounds of the illustration view is larger than the background view in a foldable device. Actions: 1) Restrict the bounds of view. 2) Fix the background view of illustrationPreference was not centered in a foldable device. Bug: 201254287 Test: make RunSettingsLibRoboTests ROBOTEST_FILTER=com.android.settingslib.widget.IllustrationPreferenceTest Change-Id: Id714e0a578dc0440a24ede43a2a38e1258058248 --- .../res/layout/illustration_preference.xml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/SettingsLib/IllustrationPreference/res/layout/illustration_preference.xml b/packages/SettingsLib/IllustrationPreference/res/layout/illustration_preference.xml index 54145d60fb32b..c8cf56e2c0606 100644 --- a/packages/SettingsLib/IllustrationPreference/res/layout/illustration_preference.xml +++ b/packages/SettingsLib/IllustrationPreference/res/layout/illustration_preference.xml @@ -36,15 +36,18 @@ + android:layout_gravity="center" + android:maxWidth="@dimen/settingslib_illustration_width" + android:maxHeight="@dimen/settingslib_illustration_height" + android:adjustViewBounds="true"/> Date: Sat, 11 Sep 2021 14:39:19 +0800 Subject: [PATCH 2/2] Extends to support the restricted setMaxHeight() for illustrationPreference. Bug: 191721423 Test: make RunSettingsLibRoboTests ROBOTEST_FILTER=com.android.settingslib.widget.IllustrationPreferenceTest Change-Id: I5ed91b1d7f284881959176d748c10c4a5b234567 --- .../res/layout/illustration_preference.xml | 1 + .../widget/IllustrationPreference.java | 36 +++++++++++++++++++ .../widget/IllustrationPreferenceTest.java | 31 ++++++++++++++++ 3 files changed, 68 insertions(+) diff --git a/packages/SettingsLib/IllustrationPreference/res/layout/illustration_preference.xml b/packages/SettingsLib/IllustrationPreference/res/layout/illustration_preference.xml index c8cf56e2c0606..eecb4bff16aef 100644 --- a/packages/SettingsLib/IllustrationPreference/res/layout/illustration_preference.xml +++ b/packages/SettingsLib/IllustrationPreference/res/layout/illustration_preference.xml @@ -34,6 +34,7 @@ android:orientation="vertical">