From 9c04df4f1e3558d72e9336b8f021d86a0590a28e Mon Sep 17 00:00:00 2001 From: Alejandro Nijamkin Date: Thu, 27 Oct 2022 15:10:36 -0700 Subject: [PATCH] Full-screen user switcher is now scrollable. When the user increases the font and item size through accessibility settings, our picker gets its items cut off. This CL fixes it, following guidance from UX and making the picker scrollable while elevating the bottom add and cancel buttons to a button bar that extends along the bottom of the screen, following the figma spec. Fix: 254788900 Test: verified that the user switcher is scrollable when adding the maximum number of users to the device. Verified that selecting them still works. Checked on tablet with landscape and portrait mode as well with maximum font and UI size and with normal sizes as well. Change-Id: I2be56e624ac53a87e2c51f91bae1571d6559b3cf --- .../res/layout/user_switcher_fullscreen.xml | 118 +++++++++++------- .../user/ui/binder/UserSwitcherViewBinder.kt | 11 +- 2 files changed, 78 insertions(+), 51 deletions(-) diff --git a/packages/SystemUI/res/layout/user_switcher_fullscreen.xml b/packages/SystemUI/res/layout/user_switcher_fullscreen.xml index c2c79cb0f34bc..78884ffbe1a26 100644 --- a/packages/SystemUI/res/layout/user_switcher_fullscreen.xml +++ b/packages/SystemUI/res/layout/user_switcher_fullscreen.xml @@ -14,58 +14,84 @@ See the License for the specific language governing permissions and limitations under the License. --> - + android:orientation="vertical"> - + - + - - + + + + + + + + + + + + + + + + diff --git a/packages/SystemUI/src/com/android/systemui/user/ui/binder/UserSwitcherViewBinder.kt b/packages/SystemUI/src/com/android/systemui/user/ui/binder/UserSwitcherViewBinder.kt index 968af59e6c453..ad09ee3c10d99 100644 --- a/packages/SystemUI/src/com/android/systemui/user/ui/binder/UserSwitcherViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/user/ui/binder/UserSwitcherViewBinder.kt @@ -61,14 +61,15 @@ object UserSwitcherViewBinder { falsingCollector: FalsingCollector, onFinish: () -> Unit, ) { - val rootView: UserSwitcherRootView = view.requireViewById(R.id.user_switcher_root) - val flowWidget: FlowWidget = view.requireViewById(R.id.flow) + val gridContainerView: UserSwitcherRootView = + view.requireViewById(R.id.user_switcher_grid_container) + val flowWidget: FlowWidget = gridContainerView.requireViewById(R.id.flow) val addButton: View = view.requireViewById(R.id.add) val cancelButton: View = view.requireViewById(R.id.cancel) val popupMenuAdapter = MenuAdapter(layoutInflater) var popupMenu: UserSwitcherPopupMenu? = null - rootView.touchHandler = + gridContainerView.touchHandler = object : Gefingerpoken { override fun onTouchEvent(ev: MotionEvent?): Boolean { falsingCollector.onTouchEvent(ev) @@ -134,7 +135,7 @@ object UserSwitcherViewBinder { val viewPool = view.children.filter { it.tag == USER_VIEW_TAG }.toMutableList() viewPool.forEach { - view.removeView(it) + gridContainerView.removeView(it) flowWidget.removeView(it) } users.forEach { userViewModel -> @@ -152,7 +153,7 @@ object UserSwitcherViewBinder { inflatedView } userView.id = View.generateViewId() - view.addView(userView) + gridContainerView.addView(userView) flowWidget.addView(userView) UserViewBinder.bind( view = userView,