From 9188b6b993dbea0e22cd32bf22794f0ea5a57757 Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Tue, 26 Oct 2021 14:56:06 -0700 Subject: [PATCH] Update the hotseat edu layout for foldable devices. Test: ran the hotseat edu on folded and unfolded foldable device in portrait and landscape mode and in three-button and gesture nav mode. ran hotseat edu on regular phone Fixes: 203734732 Change-Id: Iea2140c8241cdea60cb5db37fbfb7f7701d63bd6 --- quickstep/res/layout/predicted_hotseat_edu.xml | 1 + .../launcher3/hybridhotseat/HotseatEduDialog.java | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/quickstep/res/layout/predicted_hotseat_edu.xml b/quickstep/res/layout/predicted_hotseat_edu.xml index 1dab48267b..e4e3956c6e 100644 --- a/quickstep/res/layout/predicted_hotseat_edu.xml +++ b/quickstep/res/layout/predicted_hotseat_edu.xml @@ -73,6 +73,7 @@ launcher:containerType="hotseat" /> implements I mHotseatWrapper = findViewById(R.id.hotseat_wrapper); mSampleHotseat = findViewById(R.id.sample_prediction); + Context context = getContext(); DeviceProfile grid = mActivityContext.getDeviceProfile(); - Rect padding = grid.getHotseatLayoutPadding(getContext()); + Rect padding = grid.getHotseatLayoutPadding(context); mSampleHotseat.getLayoutParams().height = grid.cellHeightPx; mSampleHotseat.setGridSize(grid.numShownHotseatIcons, 1); @@ -102,6 +106,15 @@ public class HotseatEduDialog extends AbstractSlideInView implements I mDismissBtn = findViewById(R.id.no_thanks); mDismissBtn.setOnClickListener(this::onDismiss); + LinearLayout buttonContainer = findViewById(R.id.button_container); + int adjustedMarginEnd = ApiWrapper.getHotseatEndOffset(context) + - buttonContainer.getPaddingEnd(); + if (InvariantDeviceProfile.INSTANCE.get(context) + .getDeviceProfile(context).isTaskbarPresent && adjustedMarginEnd > 0) { + ((LinearLayout.LayoutParams) buttonContainer.getLayoutParams()).setMarginEnd( + adjustedMarginEnd); + } + // update ui to reflect which migration method is going to be used if (FeatureFlags.HOTSEAT_MIGRATE_TO_FOLDER.get()) { ((TextView) findViewById(R.id.hotseat_edu_content)).setText(