From ef5ee36e905bce9817fee77bfd3679dbb9cf9a55 Mon Sep 17 00:00:00 2001 From: "sfufa@google.com" Date: Sun, 19 Sep 2021 13:09:47 -0700 Subject: [PATCH] [Hotseat] Fix hotseat migration in landscape mode Bug: 189860214 Test: performed migration in landspace and verified items are moved properly. change is persisted when device is rotated or launcher is restarted. Change-Id: Ice088e5524a1405dbfa20c21b4edc597f23da07e --- .../launcher3/hybridhotseat/HotseatEduController.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduController.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduController.java index a6844e48b7..ffbe53211c 100644 --- a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduController.java +++ b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduController.java @@ -15,8 +15,7 @@ */ package com.android.launcher3.hybridhotseat; -import static com.android.launcher3.logging.StatsLogManager.LauncherEvent - .LAUNCHER_HOTSEAT_EDU_ONLY_TIP; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOTSEAT_EDU_ONLY_TIP; import android.content.Intent; import android.view.View; @@ -188,8 +187,12 @@ public class HotseatEduController { .getInt(LauncherSettings.Settings.EXTRA_VALUE); mNewScreens = IntArray.wrap(pageId); } - for (int i = 0; i < mLauncher.getDeviceProfile().numShownHotseatIcons; i++) { - View child = mHotseat.getChildAt(i, 0); + boolean isPortrait = !mLauncher.getDeviceProfile().isVerticalBarLayout(); + int hotseatItemsNum = mLauncher.getDeviceProfile().numShownHotseatIcons; + for (int i = 0; i < hotseatItemsNum; i++) { + int x = isPortrait ? i : 0; + int y = isPortrait ? 0 : hotseatItemsNum - i - 1; + View child = mHotseat.getChildAt(x, y); if (child == null || child.getTag() == null) continue; ItemInfo tag = (ItemInfo) child.getTag(); if (tag.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION) continue;