From 9052b5c2fea8f3aed78da9f2112498dd786b0926 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Mon, 21 Mar 2022 19:23:14 +0000 Subject: [PATCH] Adjust the sizes of user education for large screens / landscape When the stack is expanded on large screen devices, the bubbles are inset from the edge of the screen. Due to this the rounded corner on the user education view for the manage button is kinda squished with the text. To make this look better, increase the width of this user education view when on large screens. Use this value for landscape on phone as well because we were doing match parent in that scenario and it looks bad. Additionally, on all form factors, increase the padding at the end of the view. This makes it look a little better especially for languages where the words can be long. Bug: 223635730 Test: visual - force user education to show for bubbles, take a look at how the stack & manage user education views look on tablet and phone (in landscape and portrait). Change-Id: I7bcdfff7341b8c6acad0f6f5fdcbc7fd24aa4627 --- .../Shell/res/layout/bubble_stack_user_education.xml | 4 ++-- .../res/layout/bubbles_manage_button_education.xml | 4 ++-- libs/WindowManager/Shell/res/values/dimen.xml | 11 +++++++++-- .../android/wm/shell/bubbles/ManageEducationView.kt | 5 ++--- .../android/wm/shell/bubbles/StackEducationView.kt | 11 ++++++----- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/libs/WindowManager/Shell/res/layout/bubble_stack_user_education.xml b/libs/WindowManager/Shell/res/layout/bubble_stack_user_education.xml index 87deb8b5a1fd5..5c8c84cbb85b7 100644 --- a/libs/WindowManager/Shell/res/layout/bubble_stack_user_education.xml +++ b/libs/WindowManager/Shell/res/layout/bubble_stack_user_education.xml @@ -21,8 +21,8 @@ android:layout_width="wrap_content" android:paddingTop="48dp" android:paddingBottom="48dp" - android:paddingEnd="16dp" - android:layout_marginEnd="24dp" + android:paddingEnd="@dimen/bubble_user_education_padding_end" + android:layout_marginEnd="@dimen/bubble_user_education_margin_end" android:orientation="vertical" android:background="@drawable/bubble_stack_user_education_bg" > diff --git a/libs/WindowManager/Shell/res/layout/bubbles_manage_button_education.xml b/libs/WindowManager/Shell/res/layout/bubbles_manage_button_education.xml index fafe40e924f5c..b28f58f8356da 100644 --- a/libs/WindowManager/Shell/res/layout/bubbles_manage_button_education.xml +++ b/libs/WindowManager/Shell/res/layout/bubbles_manage_button_education.xml @@ -23,8 +23,8 @@ android:clickable="true" android:paddingTop="28dp" android:paddingBottom="16dp" - android:paddingEnd="48dp" - android:layout_marginEnd="24dp" + android:paddingEnd="@dimen/bubble_user_education_padding_end" + android:layout_marginEnd="@dimen/bubble_user_education_margin_end" android:orientation="vertical" android:background="@drawable/bubble_stack_user_education_bg" > diff --git a/libs/WindowManager/Shell/res/values/dimen.xml b/libs/WindowManager/Shell/res/values/dimen.xml index ad38975f1f3a6..59d03c7387235 100644 --- a/libs/WindowManager/Shell/res/values/dimen.xml +++ b/libs/WindowManager/Shell/res/values/dimen.xml @@ -205,8 +205,15 @@ 40dp 20dp 4dp - - 400dp + + 480dp + + 24dp + + 58dp + + 16dp 16dp diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ManageEducationView.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ManageEducationView.kt index eb4737ac6c632..c09d1e0d189c4 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ManageEducationView.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ManageEducationView.kt @@ -101,9 +101,8 @@ class ManageEducationView constructor(context: Context, positioner: BubblePositi bubbleExpandedView = expandedView expandedView.taskView?.setObscuredTouchRect(Rect(positioner.screenRect)) - layoutParams.width = if (positioner.isLargeScreen) - context.resources.getDimensionPixelSize( - R.dimen.bubbles_user_education_width_large_screen) + layoutParams.width = if (positioner.isLargeScreen || positioner.isLandscape) + context.resources.getDimensionPixelSize(R.dimen.bubbles_user_education_width) else ViewGroup.LayoutParams.MATCH_PARENT alpha = 0f diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/StackEducationView.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/StackEducationView.kt index 3846de73842d5..824b5f82d6430 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/StackEducationView.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/StackEducationView.kt @@ -129,21 +129,22 @@ class StackEducationView constructor( if (visibility == VISIBLE) return false controller.updateWindowFlagsForBackpress(true /* interceptBack */) - layoutParams.width = if (positioner.isLargeScreen) - context.resources.getDimensionPixelSize( - R.dimen.bubbles_user_education_width_large_screen) + layoutParams.width = if (positioner.isLargeScreen || positioner.isLandscape) + context.resources.getDimensionPixelSize(R.dimen.bubbles_user_education_width) else ViewGroup.LayoutParams.MATCH_PARENT + val stackPadding = context.resources.getDimensionPixelSize( + R.dimen.bubble_user_education_stack_padding) setAlpha(0f) setVisibility(View.VISIBLE) post { requestFocus() with(view) { if (resources.configuration.layoutDirection == View.LAYOUT_DIRECTION_LTR) { - setPadding(positioner.bubbleSize + paddingRight, paddingTop, paddingRight, + setPadding(positioner.bubbleSize + stackPadding, paddingTop, paddingRight, paddingBottom) } else { - setPadding(paddingLeft, paddingTop, positioner.bubbleSize + paddingLeft, + setPadding(paddingLeft, paddingTop, positioner.bubbleSize + stackPadding, paddingBottom) } translationY = stackPosition.y + positioner.bubbleSize / 2 - getHeight() / 2