From 6a9535e00c400b9bbe82520e193214b00600fe32 Mon Sep 17 00:00:00 2001 From: Nick Chameyev Date: Tue, 7 Mar 2023 17:55:58 +0000 Subject: [PATCH 01/11] [Unfold animation] Adjust animation parameters Turns down the amount of translation/scale of the animation to make it more subtle. Bug: 271563317 Test: manual Change-Id: I1cdd045cf4e045a9a238e71a6315d7d813e9f398 --- .../quickstep/util/LauncherUnfoldAnimationController.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/quickstep/util/LauncherUnfoldAnimationController.java b/quickstep/src/com/android/quickstep/util/LauncherUnfoldAnimationController.java index fdbb11943b..8fdafc6059 100644 --- a/quickstep/src/com/android/quickstep/util/LauncherUnfoldAnimationController.java +++ b/quickstep/src/com/android/quickstep/util/LauncherUnfoldAnimationController.java @@ -44,7 +44,7 @@ public class LauncherUnfoldAnimationController { // Percentage of the width of the quick search bar that will be reduced // from the both sides of the bar when progress is 0 - private static final float MAX_WIDTH_INSET_FRACTION = 0.15f; + private static final float MAX_WIDTH_INSET_FRACTION = 0.04f; private static final FloatProperty> WORKSPACE_SCALE_PROPERTY = WORKSPACE_SCALE_PROPERTY_FACTORY.get(SCALE_INDEX_UNFOLD_ANIMATION); private static final FloatProperty HOTSEAT_SCALE_PROPERTY = @@ -156,6 +156,8 @@ public class LauncherUnfoldAnimationController { private class LauncherScaleAnimationListener implements TransitionProgressListener { + private static final float SCALE_LAUNCHER_FROM = 0.92f; + @Override public void onTransitionStarted() { mLauncher.getWorkspace().setPivotToScaleWithSelf(mLauncher.getHotseat()); @@ -168,7 +170,7 @@ public class LauncherUnfoldAnimationController { @Override public void onTransitionProgress(float progress) { - setScale(MathUtils.constrainedMap(0.85f, 1, 0, 1, progress)); + setScale(MathUtils.constrainedMap(SCALE_LAUNCHER_FROM, 1, 0, 1, progress)); } private void setScale(float value) { From ce6faed5c82b49a6103ba84d0c0463d12e0953e1 Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Thu, 16 Mar 2023 18:52:21 -0700 Subject: [PATCH 02/11] Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: Ia0b592aa903bbdc19b456eb3d53054a7a379c146 --- quickstep/res/values-bn/strings.xml | 6 ++---- quickstep/res/values-bs/strings.xml | 6 ++---- quickstep/res/values-el/strings.xml | 6 ++---- quickstep/res/values-en-rAU/strings.xml | 6 ++---- quickstep/res/values-en-rGB/strings.xml | 6 ++---- quickstep/res/values-en-rIN/strings.xml | 6 ++---- quickstep/res/values-es-rUS/strings.xml | 6 ++---- quickstep/res/values-hr/strings.xml | 6 ++---- quickstep/res/values-it/strings.xml | 6 ++---- quickstep/res/values-ja/strings.xml | 6 ++---- quickstep/res/values-ka/strings.xml | 6 ++---- quickstep/res/values-mr/strings.xml | 6 ++---- quickstep/res/values-pl/strings.xml | 6 ++---- quickstep/res/values-pt-rPT/strings.xml | 6 ++---- quickstep/res/values-pt/strings.xml | 6 ++---- quickstep/res/values-ur/strings.xml | 6 ++---- quickstep/res/values-uz/strings.xml | 6 ++---- 17 files changed, 34 insertions(+), 68 deletions(-) diff --git a/quickstep/res/values-bn/strings.xml b/quickstep/res/values-bn/strings.xml index 5fe7b684d8..5d8314ca9f 100644 --- a/quickstep/res/values-bn/strings.xml +++ b/quickstep/res/values-bn/strings.xml @@ -114,10 +114,8 @@ "বিজ্ঞপ্তি" "দ্রুত সেটিংস" "টাস্কবার" - - - - + "\'টাস্কবার\' দেখানো হয়েছে" + "\'টাস্কবার\' লুকানো রয়েছে" "নেভিগেশন বার" "উপরে/বাঁদিকে সরান" "নিচে/ডানদিকে সরান" diff --git a/quickstep/res/values-bs/strings.xml b/quickstep/res/values-bs/strings.xml index a26d43a3e0..43d55ca32b 100644 --- a/quickstep/res/values-bs/strings.xml +++ b/quickstep/res/values-bs/strings.xml @@ -114,10 +114,8 @@ "Obavještenja" "Brze postavke" "Traka zadataka" - - - - + "Traka sa zadacima prikazana" + "Traka sa zadacima skrivena" "Navigaciona traka" "Premjesti gore lijevo" "Premjesti dolje desno" diff --git a/quickstep/res/values-el/strings.xml b/quickstep/res/values-el/strings.xml index f7cf6c78c7..4ed34ca758 100644 --- a/quickstep/res/values-el/strings.xml +++ b/quickstep/res/values-el/strings.xml @@ -114,10 +114,8 @@ "Ειδοποιήσεις" "Γρήγορες ρυθμ." "Γραμμή εργαλείων" - - - - + "Η γραμμή εργαλείων εμφανίζεται" + "Η γραμμή εργαλείων είναι κρυφή" "Γραμμή πλοήγησης" "Μετακίνηση επάνω/αριστερά" "Μετακίνηση κάτω/δεξιά" diff --git a/quickstep/res/values-en-rAU/strings.xml b/quickstep/res/values-en-rAU/strings.xml index 8b1341905f..58d643c5b7 100644 --- a/quickstep/res/values-en-rAU/strings.xml +++ b/quickstep/res/values-en-rAU/strings.xml @@ -114,10 +114,8 @@ "Notifications" "Quick Settings" "Taskbar" - - - - + "Taskbar shown" + "Taskbar hidden" "Navigation bar" "Move to top/left" "Move to bottom/right" diff --git a/quickstep/res/values-en-rGB/strings.xml b/quickstep/res/values-en-rGB/strings.xml index 8b1341905f..58d643c5b7 100644 --- a/quickstep/res/values-en-rGB/strings.xml +++ b/quickstep/res/values-en-rGB/strings.xml @@ -114,10 +114,8 @@ "Notifications" "Quick Settings" "Taskbar" - - - - + "Taskbar shown" + "Taskbar hidden" "Navigation bar" "Move to top/left" "Move to bottom/right" diff --git a/quickstep/res/values-en-rIN/strings.xml b/quickstep/res/values-en-rIN/strings.xml index 8b1341905f..58d643c5b7 100644 --- a/quickstep/res/values-en-rIN/strings.xml +++ b/quickstep/res/values-en-rIN/strings.xml @@ -114,10 +114,8 @@ "Notifications" "Quick Settings" "Taskbar" - - - - + "Taskbar shown" + "Taskbar hidden" "Navigation bar" "Move to top/left" "Move to bottom/right" diff --git a/quickstep/res/values-es-rUS/strings.xml b/quickstep/res/values-es-rUS/strings.xml index 0c73a4d427..220f6435f7 100644 --- a/quickstep/res/values-es-rUS/strings.xml +++ b/quickstep/res/values-es-rUS/strings.xml @@ -114,10 +114,8 @@ "Notificaciones" "Config. rápida" "Barra de tareas" - - - - + "Barra de tareas visible" + "Barra de tareas oculta" "Barra de navegación" "Mover a la parte superior o izquierda" "Mover a la parte inferior o derecha" diff --git a/quickstep/res/values-hr/strings.xml b/quickstep/res/values-hr/strings.xml index 2046d54d47..590d77a61e 100644 --- a/quickstep/res/values-hr/strings.xml +++ b/quickstep/res/values-hr/strings.xml @@ -114,10 +114,8 @@ "Obavijesti" "Brze postavke" "Traka sa zadacima" - - - - + "Traka sa zadacima prikazana" + "Traka sa zadacima skrivena" "Navigacijska traka" "Premjesti gore/lijevo" "Premjesti dolje/desno" diff --git a/quickstep/res/values-it/strings.xml b/quickstep/res/values-it/strings.xml index 0edbc00700..cc48390913 100644 --- a/quickstep/res/values-it/strings.xml +++ b/quickstep/res/values-it/strings.xml @@ -114,10 +114,8 @@ "Notifiche" "Impostazioni rapide" "Barra delle applicazioni" - - - - + "Barra delle app visualizzata" + "Barra delle app nascosta" "Barra di navigazione" "Sposta in alto/a sinistra" "Sposta in basso/a destra" diff --git a/quickstep/res/values-ja/strings.xml b/quickstep/res/values-ja/strings.xml index 8172e0765a..e7cba4cdb8 100644 --- a/quickstep/res/values-ja/strings.xml +++ b/quickstep/res/values-ja/strings.xml @@ -114,10 +114,8 @@ "通知" "クイック設定" "タスクバー" - - - - + "タスクバー表示" + "タスクバー非表示" "ナビゲーション バー" "上 / 左に移動" "下 / 右に移動" diff --git a/quickstep/res/values-ka/strings.xml b/quickstep/res/values-ka/strings.xml index 5a3cb0a4c1..b3a7185869 100644 --- a/quickstep/res/values-ka/strings.xml +++ b/quickstep/res/values-ka/strings.xml @@ -114,10 +114,8 @@ "შეტყობინებები" "სწრაფი პარამეტრები" "ამოცანათა ზოლი" - - - - + "ამოცანათა ზოლი ნაჩვენებია" + "ამოცანათა ზოლი დამალულია" "ნავიგაციის ზოლი" "ზემოთ/მარცხნივ გადატანა" "ქვემოთ/მარჯვნივ გადატანა" diff --git a/quickstep/res/values-mr/strings.xml b/quickstep/res/values-mr/strings.xml index c9140007d0..5feaccdfc7 100644 --- a/quickstep/res/values-mr/strings.xml +++ b/quickstep/res/values-mr/strings.xml @@ -114,10 +114,8 @@ "सूचना" "क्विक सेटिंग्ज" "टास्कबार" - - - - + "टास्कबार दाखवलेला आहे" + "टास्कबार लपवलेले आहे" "नेव्हिगेशन बार" "सर्वात वरती/डावीकडे हलवा" "तळाशी/उजवीकडे हलवा" diff --git a/quickstep/res/values-pl/strings.xml b/quickstep/res/values-pl/strings.xml index 6a453d80f1..5cddef59f7 100644 --- a/quickstep/res/values-pl/strings.xml +++ b/quickstep/res/values-pl/strings.xml @@ -114,10 +114,8 @@ "Powiadomienia" "Szybkie ustawienia" "Pasek aplikacji" - - - - + "Pasek aplikacji widoczny" + "Pasek aplikacji ukryty" "Pasek nawigacyjny" "Przesuń w górny lewy róg" "Przesuń w dolny prawy róg" diff --git a/quickstep/res/values-pt-rPT/strings.xml b/quickstep/res/values-pt-rPT/strings.xml index 970ae462da..156236265d 100644 --- a/quickstep/res/values-pt-rPT/strings.xml +++ b/quickstep/res/values-pt-rPT/strings.xml @@ -114,10 +114,8 @@ "Notificações" "Definiç. rápidas" "Barra de tarefas" - - - - + "Barra de tarefas apresentada" + "Barra de tarefas ocultada" "Barra de navegação" "Mover para a parte superior esquerda" "Mover para a part superior direita" diff --git a/quickstep/res/values-pt/strings.xml b/quickstep/res/values-pt/strings.xml index 16a0db97f9..0fd4c44400 100644 --- a/quickstep/res/values-pt/strings.xml +++ b/quickstep/res/values-pt/strings.xml @@ -114,10 +114,8 @@ "Notificações" "Config. rápidas" "Barra de tarefas" - - - - + "Barra de tarefas visível" + "Barra de tarefas oculta" "Barra de navegação" "Mover para cima/para a esquerda" "Mover para baixo/para a direita" diff --git a/quickstep/res/values-ur/strings.xml b/quickstep/res/values-ur/strings.xml index fdce1242e5..03c85809a2 100644 --- a/quickstep/res/values-ur/strings.xml +++ b/quickstep/res/values-ur/strings.xml @@ -114,10 +114,8 @@ "اطلاعات" "فوری ترتیبات" "ٹاسک بار" - - - - + "ٹاشک بار دکھایا گیا" + "ٹاسک بار چھپایا گیا" "نیویگیشن بار" "اوپر/بائیں طرف منتقل کریں" "نیچے/دائیں طرف منتقل کریں" diff --git a/quickstep/res/values-uz/strings.xml b/quickstep/res/values-uz/strings.xml index a035e4ce14..2569f69341 100644 --- a/quickstep/res/values-uz/strings.xml +++ b/quickstep/res/values-uz/strings.xml @@ -114,10 +114,8 @@ "Bildirishnomalar" "Tezkor sozlamalar" "Vazifalar paneli" - - - - + "Vazifalar paneli ochiq" + "Vazifalar paneli yopiq" "Navigatsiya paneli" "Yuqoriga yoki chapga oʻtkazish" "Pastga yoki oʻngga oʻtkazish" From 4a7569b1b0695758db0d8b83daba079e79027f5e Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Fri, 17 Mar 2023 08:16:56 -0700 Subject: [PATCH 03/11] New taskbar thresholds. Nav threshold / App window threshold / Home overview threshold / Catch up threshold Default: 40dp / 88dp / 156dp / 264dp sw720dp: 30dp / 100dp / 180dp / 300dp Bug: 267646355 Test: manual Change-Id: Ic4e99820ca44d3f1bfc12f570d003d4062e6a2cd --- quickstep/res/values-sw720dp/dimens.xml | 6 ++++++ quickstep/res/values/dimens.xml | 8 ++++---- res/values/dimens.xml | 8 -------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/quickstep/res/values-sw720dp/dimens.xml b/quickstep/res/values-sw720dp/dimens.xml index d27561ab1d..f093185d14 100644 --- a/quickstep/res/values-sw720dp/dimens.xml +++ b/quickstep/res/values-sw720dp/dimens.xml @@ -41,4 +41,10 @@ 76dp 52dp + + + 30dp + 100dp + 180dp + 300dp diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 126ab7c442..9e6ee8a438 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -301,10 +301,10 @@ 16dp - 30dp - 100dp - 180dp - 300dp + 40dp + 88dp + 156dp + 264dp 24dp diff --git a/res/values/dimens.xml b/res/values/dimens.xml index aa84d2ba92..cc7053f635 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -381,14 +381,6 @@ 0dp 0dp 0dp - - 0dp - 0dp - 0dp - 0dp - 0dp - 0dp - 0dp 16dp From 7eee74b3f80984a99a352544f21a25b84e6afdad Mon Sep 17 00:00:00 2001 From: Thales Lima Date: Thu, 16 Mar 2023 16:00:55 -0300 Subject: [PATCH 04/11] Scale folder if it doesn't fit the screen Scale folder attrs if a full folder doesn't fit the screen width. This will make icons and text smaller than the workspace. As a follow-up, another bug will be created to only scale full folders instead of all folders. Bug: 271554689 Test: manually create a full folder, change the display size to large+ Change-Id: I47dc4bd4fe0c9eae989095fc1d179b81d350ef77 --- src/com/android/launcher3/DeviceProfile.java | 49 ++++++++----- .../nonquickstep/DeviceProfileDumpTest.kt | 68 +++++++++---------- 2 files changed, 66 insertions(+), 51 deletions(-) diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index d992ee0085..aca03e37f3 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -28,6 +28,7 @@ import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.ICON_OVER import static com.android.launcher3.icons.GraphicsUtils.getShapePath; import static com.android.launcher3.testing.shared.ResourceUtils.INVALID_RESOURCE_HANDLE; import static com.android.launcher3.testing.shared.ResourceUtils.pxFromDp; +import static com.android.launcher3.testing.shared.ResourceUtils.roundPxValueFromFloat; import android.annotation.SuppressLint; import android.content.Context; @@ -377,7 +378,7 @@ public class DeviceProfile { folderLabelTextScale = res.getFloat(R.dimen.folder_label_text_scale); - if (inv.folderStyle != INVALID_RESOURCE_HANDLE) { + if (isScalableGrid && inv.folderStyle != INVALID_RESOURCE_HANDLE) { TypedArray folderStyle = context.obtainStyledAttributes(inv.folderStyle, R.styleable.FolderStyle); // These are re-set in #updateFolderCellSize if the grid is not scalable @@ -395,7 +396,7 @@ public class DeviceProfile { folderStyle.recycle(); } else { folderCellLayoutBorderSpacePx = 0; - folderFooterHeightPx = 0; + folderFooterHeightPx = res.getDimensionPixelSize(R.dimen.folder_footer_height_default); folderContentPaddingTop = res.getDimensionPixelSize(R.dimen.folder_top_padding_default); } @@ -548,6 +549,9 @@ public class DeviceProfile { cellLayoutPadding); updateWorkspacePadding(); + // Folder scaling requires correct workspace paddings + updateAvailableFolderCellDimensions(res); + mMinHotseatIconSpacePx = res.getDimensionPixelSize(R.dimen.min_hotseat_icon_space); mMinHotseatQsbWidthPx = res.getDimensionPixelSize(R.dimen.min_hotseat_qsb_width); mMaxHotseatIconSpacePx = areNavButtonsInline @@ -875,7 +879,6 @@ public class DeviceProfile { extraHeight = Math.max(0, maxHeight - getCellLayoutHeightSpecification()); } - updateAvailableFolderCellDimensions(res); return Math.round(extraHeight); } @@ -1064,22 +1067,22 @@ public class DeviceProfile { private void updateAvailableFolderCellDimensions(Resources res) { updateFolderCellSize(1f, res); - // Don't let the folder get too close to the edges of the screen. - int folderMargin = edgeMarginPx * 2; + // For usability we can't have the folder use the whole width of the screen Point totalWorkspacePadding = getTotalWorkspacePadding(); - // Check if the icons fit within the available height. + // Check if the folder fit within the available height. float contentUsedHeight = folderCellHeightPx * inv.numFolderRows - + ((inv.numFolderRows - 1) * folderCellLayoutBorderSpacePx); - int contentMaxHeight = availableHeightPx - totalWorkspacePadding.y - folderFooterHeightPx - - folderMargin - folderContentPaddingTop; + + ((inv.numFolderRows - 1) * folderCellLayoutBorderSpacePx) + + folderFooterHeightPx + + folderContentPaddingTop; + int contentMaxHeight = availableHeightPx - totalWorkspacePadding.y; float scaleY = contentMaxHeight / contentUsedHeight; - // Check if the icons fit within the available width. + // Check if the folder fit within the available width. float contentUsedWidth = folderCellWidthPx * inv.numFolderColumns - + ((inv.numFolderColumns - 1) * folderCellLayoutBorderSpacePx); - int contentMaxWidth = availableWidthPx - totalWorkspacePadding.x - folderMargin - - folderContentPaddingLeftRight * 2; + + ((inv.numFolderColumns - 1) * folderCellLayoutBorderSpacePx) + + folderContentPaddingLeftRight * 2; + int contentMaxWidth = availableWidthPx - totalWorkspacePadding.x; float scaleX = contentMaxWidth / contentUsedWidth; float scale = Math.min(scaleX, scaleY); @@ -1092,17 +1095,25 @@ public class DeviceProfile { float invIconSizeDp = inv.iconSize[mTypeIndex]; folderChildIconSizePx = Math.max(1, pxFromDp(invIconSizeDp, mMetrics, scale)); folderChildTextSizePx = pxFromSp(inv.iconTextSize[mTypeIndex], mMetrics, scale); - folderLabelTextSizePx = Math.max(pxFromSp(MIN_FOLDER_TEXT_SIZE_SP, mMetrics), + folderLabelTextSizePx = Math.max(pxFromSp(MIN_FOLDER_TEXT_SIZE_SP, mMetrics, scale), (int) (folderChildTextSizePx * folderLabelTextScale)); int textHeight = Utilities.calculateTextHeight(folderChildTextSizePx); if (isScalableGrid) { if (inv.folderStyle == INVALID_RESOURCE_HANDLE) { - folderCellWidthPx = pxFromDp(getCellSize().x, mMetrics, scale); - folderCellHeightPx = pxFromDp(getCellSize().y, mMetrics, scale); + folderCellWidthPx = roundPxValueFromFloat(getCellSize().x * scale); + folderCellHeightPx = roundPxValueFromFloat(getCellSize().y * scale); + } else { + folderCellWidthPx = roundPxValueFromFloat(folderCellWidthPx * scale); + folderCellHeightPx = roundPxValueFromFloat(folderCellHeightPx * scale); } + folderContentPaddingTop = roundPxValueFromFloat(folderContentPaddingTop * scale); + folderCellLayoutBorderSpacePx = roundPxValueFromFloat( + folderCellLayoutBorderSpacePx * scale); + folderFooterHeightPx = roundPxValueFromFloat(folderFooterHeightPx * scale); + folderContentPaddingLeftRight = folderCellLayoutBorderSpacePx; } else { int cellPaddingX = (int) (res.getDimensionPixelSize(R.dimen.folder_cell_x_padding) @@ -1112,10 +1123,14 @@ public class DeviceProfile { folderCellWidthPx = folderChildIconSizePx + 2 * cellPaddingX; folderCellHeightPx = folderChildIconSizePx + 2 * cellPaddingY + textHeight; + folderContentPaddingTop = roundPxValueFromFloat(folderContentPaddingTop * scale); folderContentPaddingLeftRight = res.getDimensionPixelSize(R.dimen.folder_content_padding_left_right); folderFooterHeightPx = - res.getDimensionPixelSize(R.dimen.folder_footer_height_default); + roundPxValueFromFloat( + res.getDimensionPixelSize(R.dimen.folder_footer_height_default) + * scale); + } folderChildDrawablePaddingPx = Math.max(0, diff --git a/tests/src/com/android/launcher3/nonquickstep/DeviceProfileDumpTest.kt b/tests/src/com/android/launcher3/nonquickstep/DeviceProfileDumpTest.kt index af31e93ef4..86d21f3ddc 100644 --- a/tests/src/com/android/launcher3/nonquickstep/DeviceProfileDumpTest.kt +++ b/tests/src/com/android/launcher3/nonquickstep/DeviceProfileDumpTest.kt @@ -342,15 +342,15 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() { "\ticonDrawablePaddingPx: 0.0px (0.0dp)\n" + "\tinv.numFolderRows: 4\n" + "\tinv.numFolderColumns: 4\n" + - "\tfolderCellWidthPx: 142.0px (54.095238dp)\n" + - "\tfolderCellHeightPx: 168.0px (64.0dp)\n" + - "\tfolderChildIconSizePx: 108.0px (41.142857dp)\n" + - "\tfolderChildTextSizePx: 28.0px (10.666667dp)\n" + - "\tfolderChildDrawablePaddingPx: 7.0px (2.6666667dp)\n" + + "\tfolderCellWidthPx: 173.0px (65.90476dp)\n" + + "\tfolderCellHeightPx: 205.0px (78.09524dp)\n" + + "\tfolderChildIconSizePx: 131.0px (49.904762dp)\n" + + "\tfolderChildTextSizePx: 34.0px (12.952381dp)\n" + + "\tfolderChildDrawablePaddingPx: 9.0px (3.4285715dp)\n" + "\tfolderCellLayoutBorderSpacePx: 0.0px (0.0dp)\n" + "\tfolderContentPaddingLeftRight: 21.0px (8.0dp)\n" + - "\tfolderTopPadding: 63.0px (24.0dp)\n" + - "\tfolderFooterHeight: 147.0px (56.0dp)\n" + + "\tfolderTopPadding: 56.0px (21.333334dp)\n" + + "\tfolderFooterHeight: 131.0px (49.904762dp)\n" + "\tbottomSheetTopPadding: 114.0px (43.42857dp)\n" + "\tbottomSheetOpenDuration: 267\n" + "\tbottomSheetCloseDuration: 267\n" + @@ -474,15 +474,15 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() { "\ticonDrawablePaddingPx: 0.0px (0.0dp)\n" + "\tinv.numFolderRows: 4\n" + "\tinv.numFolderColumns: 4\n" + - "\tfolderCellWidthPx: 128.0px (48.761906dp)\n" + - "\tfolderCellHeightPx: 152.0px (57.904762dp)\n" + - "\tfolderChildIconSizePx: 98.0px (37.333332dp)\n" + - "\tfolderChildTextSizePx: 25.0px (9.523809dp)\n" + - "\tfolderChildDrawablePaddingPx: 6.0px (2.2857144dp)\n" + + "\tfolderCellWidthPx: 163.0px (62.095238dp)\n" + + "\tfolderCellHeightPx: 192.0px (73.14286dp)\n" + + "\tfolderChildIconSizePx: 123.0px (46.857143dp)\n" + + "\tfolderChildTextSizePx: 32.0px (12.190476dp)\n" + + "\tfolderChildDrawablePaddingPx: 8.0px (3.047619dp)\n" + "\tfolderCellLayoutBorderSpacePx: 0.0px (0.0dp)\n" + "\tfolderContentPaddingLeftRight: 21.0px (8.0dp)\n" + - "\tfolderTopPadding: 63.0px (24.0dp)\n" + - "\tfolderFooterHeight: 147.0px (56.0dp)\n" + + "\tfolderTopPadding: 53.0px (20.190475dp)\n" + + "\tfolderFooterHeight: 123.0px (46.857143dp)\n" + "\tbottomSheetTopPadding: 114.0px (43.42857dp)\n" + "\tbottomSheetOpenDuration: 267\n" + "\tbottomSheetCloseDuration: 267\n" + @@ -607,15 +607,15 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() { "\ticonDrawablePaddingPx: 14.0px (7.0dp)\n" + "\tinv.numFolderRows: 3\n" + "\tinv.numFolderColumns: 3\n" + - "\tfolderCellWidthPx: 397.0px (198.5dp)\n" + - "\tfolderCellHeightPx: 371.0px (185.5dp)\n" + - "\tfolderChildIconSizePx: 99.0px (49.5dp)\n" + - "\tfolderChildTextSizePx: 23.0px (11.5dp)\n" + - "\tfolderChildDrawablePaddingPx: 80.0px (40.0dp)\n" + + "\tfolderCellWidthPx: 240.0px (120.0dp)\n" + + "\tfolderCellHeightPx: 208.0px (104.0dp)\n" + + "\tfolderChildIconSizePx: 120.0px (60.0dp)\n" + + "\tfolderChildTextSizePx: 28.0px (14.0dp)\n" + + "\tfolderChildDrawablePaddingPx: 16.0px (8.0dp)\n" + "\tfolderCellLayoutBorderSpacePx: 0.0px (0.0dp)\n" + "\tfolderContentPaddingLeftRight: 0.0px (0.0dp)\n" + "\tfolderTopPadding: 48.0px (24.0dp)\n" + - "\tfolderFooterHeight: 0.0px (0.0dp)\n" + + "\tfolderFooterHeight: 112.0px (56.0dp)\n" + "\tbottomSheetTopPadding: 104.0px (52.0dp)\n" + "\tbottomSheetOpenDuration: 500\n" + "\tbottomSheetCloseDuration: 500\n" + @@ -740,15 +740,15 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() { "\ticonDrawablePaddingPx: 14.0px (7.0dp)\n" + "\tinv.numFolderRows: 3\n" + "\tinv.numFolderColumns: 3\n" + - "\tfolderCellWidthPx: 397.0px (198.5dp)\n" + - "\tfolderCellHeightPx: 371.0px (185.5dp)\n" + - "\tfolderChildIconSizePx: 99.0px (49.5dp)\n" + - "\tfolderChildTextSizePx: 23.0px (11.5dp)\n" + - "\tfolderChildDrawablePaddingPx: 80.0px (40.0dp)\n" + + "\tfolderCellWidthPx: 240.0px (120.0dp)\n" + + "\tfolderCellHeightPx: 208.0px (104.0dp)\n" + + "\tfolderChildIconSizePx: 120.0px (60.0dp)\n" + + "\tfolderChildTextSizePx: 28.0px (14.0dp)\n" + + "\tfolderChildDrawablePaddingPx: 16.0px (8.0dp)\n" + "\tfolderCellLayoutBorderSpacePx: 0.0px (0.0dp)\n" + "\tfolderContentPaddingLeftRight: 0.0px (0.0dp)\n" + "\tfolderTopPadding: 48.0px (24.0dp)\n" + - "\tfolderFooterHeight: 0.0px (0.0dp)\n" + + "\tfolderFooterHeight: 112.0px (56.0dp)\n" + "\tbottomSheetTopPadding: 104.0px (52.0dp)\n" + "\tbottomSheetOpenDuration: 500\n" + "\tbottomSheetCloseDuration: 500\n" + @@ -873,15 +873,15 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() { "\ticonDrawablePaddingPx: 14.0px (7.0dp)\n" + "\tinv.numFolderRows: 3\n" + "\tinv.numFolderColumns: 3\n" + - "\tfolderCellWidthPx: 408.0px (204.0dp)\n" + - "\tfolderCellHeightPx: 648.0px (324.0dp)\n" + + "\tfolderCellWidthPx: 204.0px (102.0dp)\n" + + "\tfolderCellHeightPx: 240.0px (120.0dp)\n" + "\tfolderChildIconSizePx: 120.0px (60.0dp)\n" + "\tfolderChildTextSizePx: 28.0px (14.0dp)\n" + - "\tfolderChildDrawablePaddingPx: 163.0px (81.5dp)\n" + + "\tfolderChildDrawablePaddingPx: 27.0px (13.5dp)\n" + "\tfolderCellLayoutBorderSpacePx: 0.0px (0.0dp)\n" + "\tfolderContentPaddingLeftRight: 0.0px (0.0dp)\n" + "\tfolderTopPadding: 48.0px (24.0dp)\n" + - "\tfolderFooterHeight: 0.0px (0.0dp)\n" + + "\tfolderFooterHeight: 112.0px (56.0dp)\n" + "\tbottomSheetTopPadding: 704.0px (352.0dp)\n" + "\tbottomSheetOpenDuration: 500\n" + "\tbottomSheetCloseDuration: 500\n" + @@ -1006,15 +1006,15 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() { "\ticonDrawablePaddingPx: 14.0px (7.0dp)\n" + "\tinv.numFolderRows: 3\n" + "\tinv.numFolderColumns: 3\n" + - "\tfolderCellWidthPx: 408.0px (204.0dp)\n" + - "\tfolderCellHeightPx: 648.0px (324.0dp)\n" + + "\tfolderCellWidthPx: 204.0px (102.0dp)\n" + + "\tfolderCellHeightPx: 240.0px (120.0dp)\n" + "\tfolderChildIconSizePx: 120.0px (60.0dp)\n" + "\tfolderChildTextSizePx: 28.0px (14.0dp)\n" + - "\tfolderChildDrawablePaddingPx: 163.0px (81.5dp)\n" + + "\tfolderChildDrawablePaddingPx: 27.0px (13.5dp)\n" + "\tfolderCellLayoutBorderSpacePx: 0.0px (0.0dp)\n" + "\tfolderContentPaddingLeftRight: 0.0px (0.0dp)\n" + "\tfolderTopPadding: 48.0px (24.0dp)\n" + - "\tfolderFooterHeight: 0.0px (0.0dp)\n" + + "\tfolderFooterHeight: 112.0px (56.0dp)\n" + "\tbottomSheetTopPadding: 704.0px (352.0dp)\n" + "\tbottomSheetOpenDuration: 500\n" + "\tbottomSheetCloseDuration: 500\n" + From b7c0f3c38689e9a57ee55c860531ace96e988a89 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 15 Mar 2023 17:21:57 -0700 Subject: [PATCH 05/11] Fixing overscroll getting lost due to float point comparision When swipping back from overscroll, deltaX becomes close-to-0 causing the equality check (deltaX != 0) to fail. This causes the overscroll to jump. Platform views like HorizontalScrollView use int instead of float to avoid this. Bug: 273828110 Test: Verified on device that the overscroll finishes smoothly Flag: N/A Change-Id: I140750a2bdc39cebcbeb8ea83bb38efb0449dd5a --- src/com/android/launcher3/PagedView.java | 52 +++++++++++------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index 2b5bd8ff77..af64b3b0ee 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -113,8 +113,7 @@ public abstract class PagedView extends ViewGrou private float mDownMotionX; private float mDownMotionY; private float mDownMotionPrimary; - private float mLastMotion; - private float mLastMotionRemainder; + private int mLastMotion; private float mTotalMotion; // Used in special cases where the fling checks can be relaxed for an intentional gesture private boolean mAllowEasyFling; @@ -1072,8 +1071,8 @@ public abstract class PagedView extends ViewGrou // Remember location of down touch mDownMotionX = x; mDownMotionY = y; - mDownMotionPrimary = mLastMotion = mOrientationHandler.getPrimaryDirection(ev, 0); - mLastMotionRemainder = 0; + mDownMotionPrimary = mOrientationHandler.getPrimaryDirection(ev, 0); + mLastMotion = (int) mDownMotionPrimary; mTotalMotion = 0; mAllowEasyFling = false; mActivePointerId = ev.getPointerId(0); @@ -1155,8 +1154,7 @@ public abstract class PagedView extends ViewGrou // Scroll if the user moved far enough along the X axis mIsBeingDragged = true; mTotalMotion += Math.abs(mLastMotion - primaryDirection); - mLastMotion = primaryDirection; - mLastMotionRemainder = 0; + mLastMotion = (int) primaryDirection; pageBeginTransition(); // Stop listening for things like pinches. requestDisallowInterceptTouchEvent(true); @@ -1265,8 +1263,8 @@ public abstract class PagedView extends ViewGrou // Remember where the motion event started mDownMotionX = ev.getX(); mDownMotionY = ev.getY(); - mDownMotionPrimary = mLastMotion = mOrientationHandler.getPrimaryDirection(ev, 0); - mLastMotionRemainder = 0; + mDownMotionPrimary = mOrientationHandler.getPrimaryDirection(ev, 0); + mLastMotion = (int) mDownMotionPrimary; mTotalMotion = 0; mAllowEasyFling = false; mActivePointerId = ev.getPointerId(0); @@ -1287,28 +1285,29 @@ public abstract class PagedView extends ViewGrou final int pointerIndex = ev.findPointerIndex(mActivePointerId); if (pointerIndex == -1) return true; - float oldScroll = mOrientationHandler.getPrimaryScroll(this); - float dx = ev.getX(pointerIndex); - float dy = ev.getY(pointerIndex); + int oldScroll = mOrientationHandler.getPrimaryScroll(this); + int dx = (int) ev.getX(pointerIndex); + int dy = (int) ev.getY(pointerIndex); - float direction = mOrientationHandler.getPrimaryValue(dx, dy); - float delta = mLastMotion + mLastMotionRemainder - direction; + int direction = mOrientationHandler.getPrimaryValue(dx, dy); + int delta = mLastMotion - direction; int width = getWidth(); int height = getHeight(); - int size = mOrientationHandler.getPrimaryValue(width, height); - - final float displacement = mOrientationHandler.getSecondaryValue(dx, dy) - / mOrientationHandler.getSecondaryValue(width, height); + float size = mOrientationHandler.getPrimaryValue(width, height); + float displacement = (width == 0 || height == 0) ? 0 + : (float) mOrientationHandler.getSecondaryValue(dx, dy) + / mOrientationHandler.getSecondaryValue(width, height); mTotalMotion += Math.abs(delta); if (mAllowOverScroll) { - float consumed = 0; + int consumed = 0; if (delta < 0 && mEdgeGlowRight.getDistance() != 0f) { - consumed = size * mEdgeGlowRight.onPullDistance(delta / size, displacement); + consumed = Math.round(size * + mEdgeGlowRight.onPullDistance(delta / size, displacement)); } else if (delta > 0 && mEdgeGlowLeft.getDistance() != 0f) { - consumed = -size * mEdgeGlowLeft.onPullDistance( - -delta / size, 1 - displacement); + consumed = Math.round(-size * + mEdgeGlowLeft.onPullDistance(-delta / size, 1 - displacement)); } delta -= consumed; } @@ -1318,11 +1317,9 @@ public abstract class PagedView extends ViewGrou // keep the remainder because we are actually testing if we've moved from the last // scrolled position (which is discrete). mLastMotion = direction; - int movedDelta = (int) delta; - mLastMotionRemainder = delta - movedDelta; if (delta != 0) { - mOrientationHandler.setPrimary(this, VIEW_SCROLL_BY, movedDelta); + mOrientationHandler.setPrimary(this, VIEW_SCROLL_BY, delta); if (mAllowOverScroll) { final float pulledToX = oldScroll + delta; @@ -1377,7 +1374,7 @@ public abstract class PagedView extends ViewGrou * mOrientationHandler.getPrimaryScale(this)); boolean isSignificantMove = isSignificantMove(Math.abs(delta), pageOrientedSize); - mTotalMotion += Math.abs(mLastMotion + mLastMotionRemainder - primaryDirection); + mTotalMotion += Math.abs(mLastMotion - primaryDirection); boolean passedSlop = mAllowEasyFling || mTotalMotion > mPageSlop; boolean isFling = passedSlop && shouldFlingForVelocity(velocity); boolean isDeltaLeft = mIsRtl ? delta > 0 : delta < 0; @@ -1562,9 +1559,8 @@ public abstract class PagedView extends ViewGrou // active pointer and adjust accordingly. // TODO: Make this decision more intelligent. final int newPointerIndex = pointerIndex == 0 ? 1 : 0; - mLastMotion = mDownMotionPrimary = mOrientationHandler.getPrimaryDirection(ev, - newPointerIndex); - mLastMotionRemainder = 0; + mDownMotionPrimary = mOrientationHandler.getPrimaryDirection(ev, newPointerIndex); + mLastMotion = (int) mDownMotionPrimary; mActivePointerId = ev.getPointerId(newPointerIndex); if (mVelocityTracker != null) { mVelocityTracker.clear(); From fd79b4dfbdcc33507bc6f7e25e14d0c421c11dcb Mon Sep 17 00:00:00 2001 From: Saumya Prakash Date: Fri, 3 Mar 2023 23:03:51 +0000 Subject: [PATCH 06/11] Redesign the gesture tutorial for the Back gesture This change adds in a new animation and layout to change the existing back tutorial as part of the effort to redesign gesture navigation education for users. This temporarily uses placeholder animations for the overview gesture. Large screen animations are also added for Home and Back tutorial. Flag: ENABLE_NEW_GESTURE_NAV_TUTORIAL Bug: 241813570 Bug: 253521922 Bug: 253520701 Test: Manual Change-Id: Ied18b88a83a3b673a7cf40fd33b6013f24998e44 --- quickstep/AndroidManifest.xml | 1 + ...designed_gesture_tutorial_mock_hotseat.xml | 70 ++++++++++++++++ .../back_gesture_tutorial_background.xml | 18 +++++ .../redesigned_gesture_tutorial_fragment.xml | 38 +++++---- .../raw/back_gesture_tutorial_animation.json | 1 + ...ack_gesture_tutorial_tablet_animation.json | 1 + .../res/raw/checkmark_animation_end.json | 1 + .../raw/checkmark_animation_in_progress.json | 1 + ...ome_gesture_tutorial_tablet_animation.json | 1 + quickstep/res/values/colors.xml | 4 +- quickstep/res/values/dimens.xml | 2 + quickstep/res/values/strings.xml | 2 + quickstep/res/values/styles.xml | 5 ++ .../BackGestureTutorialController.java | 81 ++++++++++++++++--- .../interaction/EdgeBackGestureHandler.java | 11 ++- .../HomeGestureTutorialController.java | 4 +- .../interaction/TutorialController.java | 69 ++++++++++++++-- .../interaction/TutorialFragment.java | 1 - 18 files changed, 268 insertions(+), 43 deletions(-) create mode 100644 quickstep/res/layout-land/redesigned_gesture_tutorial_mock_hotseat.xml create mode 100644 quickstep/res/layout/back_gesture_tutorial_background.xml create mode 100644 quickstep/res/raw/back_gesture_tutorial_animation.json create mode 100644 quickstep/res/raw/back_gesture_tutorial_tablet_animation.json create mode 100644 quickstep/res/raw/checkmark_animation_end.json create mode 100644 quickstep/res/raw/checkmark_animation_in_progress.json create mode 100644 quickstep/res/raw/home_gesture_tutorial_tablet_animation.json diff --git a/quickstep/AndroidManifest.xml b/quickstep/AndroidManifest.xml index 3647e05f0a..8e1baba956 100644 --- a/quickstep/AndroidManifest.xml +++ b/quickstep/AndroidManifest.xml @@ -103,6 +103,7 @@ diff --git a/quickstep/res/layout-land/redesigned_gesture_tutorial_mock_hotseat.xml b/quickstep/res/layout-land/redesigned_gesture_tutorial_mock_hotseat.xml new file mode 100644 index 0000000000..6c08d14b6b --- /dev/null +++ b/quickstep/res/layout-land/redesigned_gesture_tutorial_mock_hotseat.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/quickstep/res/layout/back_gesture_tutorial_background.xml b/quickstep/res/layout/back_gesture_tutorial_background.xml new file mode 100644 index 0000000000..7fa2cf507a --- /dev/null +++ b/quickstep/res/layout/back_gesture_tutorial_background.xml @@ -0,0 +1,18 @@ + + + diff --git a/quickstep/res/layout/redesigned_gesture_tutorial_fragment.xml b/quickstep/res/layout/redesigned_gesture_tutorial_fragment.xml index 13482acbc8..43439c693e 100644 --- a/quickstep/res/layout/redesigned_gesture_tutorial_fragment.xml +++ b/quickstep/res/layout/redesigned_gesture_tutorial_fragment.xml @@ -118,6 +118,14 @@ android:scaleType="fitXY" android:visibility="gone" /> + + - - -