From 0142937e8181d2665d625b3b65ee432b1625a31f Mon Sep 17 00:00:00 2001 From: Aaron Heuckroth Date: Thu, 11 Apr 2019 11:15:12 -0400 Subject: [PATCH] Expand emergency button to match size of container when only item in separated list. Test: Automated tests pass. Enable force grid layout (feature flags) and bug report shortcut to get a 4-item grid, then open the power menu. Emergency button should take up two rows, and space above the icon and below the text should be tappable. Fixes: 130347549 Change-Id: If44d2fb7d90b33b9b90b3ed970c7751b4bffd0d5 --- .../res/layout/global_actions_grid_item.xml | 72 ++++++++++--------- .../GlobalActionsGridLayout.java | 11 +++ 2 files changed, 50 insertions(+), 33 deletions(-) diff --git a/packages/SystemUI/res/layout/global_actions_grid_item.xml b/packages/SystemUI/res/layout/global_actions_grid_item.xml index e92ec0f75fc13..3cefce071a1ea 100644 --- a/packages/SystemUI/res/layout/global_actions_grid_item.xml +++ b/packages/SystemUI/res/layout/global_actions_grid_item.xml @@ -20,44 +20,50 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="@dimen/global_actions_grid_item_width" android:layout_height="@dimen/global_actions_grid_item_height" - android:gravity="top|center_horizontal" - android:orientation="vertical" + android:gravity="center" android:layout_marginTop="@dimen/global_actions_grid_item_vertical_margin" android:layout_marginBottom="@dimen/global_actions_grid_item_vertical_margin" android:layout_marginLeft="@dimen/global_actions_grid_item_side_margin" android:layout_marginRight="@dimen/global_actions_grid_item_side_margin" > - + + - + - + + diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsGridLayout.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsGridLayout.java index f8825690056e8..e7878c69873ca 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsGridLayout.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsGridLayout.java @@ -119,6 +119,17 @@ public class GlobalActionsGridLayout extends MultiListLayout { } } updateSnapPosition(); + updateSeparatedButtonSize(); + } + + private void updateSeparatedButtonSize() { + ViewGroup separated = getSeparatedView(); + if (separated.getChildCount() == 1) { + View onlyChild = separated.getChildAt(0); + ViewGroup.LayoutParams childParams = onlyChild.getLayoutParams(); + childParams.width = ViewGroup.LayoutParams.MATCH_PARENT; + childParams.height = ViewGroup.LayoutParams.MATCH_PARENT; + } } @Override