diff --git a/packages/SystemUI/res/drawable/ksh_key_item_background.xml b/packages/SystemUI/res/drawable/ksh_key_item_background.xml new file mode 100644 index 0000000000000..75ff30d25aa7c --- /dev/null +++ b/packages/SystemUI/res/drawable/ksh_key_item_background.xml @@ -0,0 +1,21 @@ + + + + + + diff --git a/packages/SystemUI/res/layout/keyboard_shortcut_app_item.xml b/packages/SystemUI/res/layout/keyboard_shortcut_app_item.xml index 38650208f7d58..63b759b7b2764 100644 --- a/packages/SystemUI/res/layout/keyboard_shortcut_app_item.xml +++ b/packages/SystemUI/res/layout/keyboard_shortcut_app_item.xml @@ -15,10 +15,10 @@ ~ limitations under the License --> @@ -29,7 +29,8 @@ android:layout_marginEnd="32dp" android:layout_gravity="center_vertical" android:visibility="gone" - android:layout_alignParentStart="true"/> + android:layout_alignParentStart="true" + android:layout_centerVertical="true"/> + android:layout_alignParentStart="true" + android:layout_centerVertical="true"/> + android:scrollHorizontally="false" + android:layout_centerVertical="true"/> diff --git a/packages/SystemUI/res/layout/keyboard_shortcuts_key_icon_view.xml b/packages/SystemUI/res/layout/keyboard_shortcuts_key_icon_view.xml index 0cecb96fd0229..5db678958ce13 100644 --- a/packages/SystemUI/res/layout/keyboard_shortcuts_key_icon_view.xml +++ b/packages/SystemUI/res/layout/keyboard_shortcuts_key_icon_view.xml @@ -21,4 +21,4 @@ android:padding="@dimen/ksh_item_padding" android:layout_marginStart="@dimen/ksh_item_margin_start" android:scaleType="fitXY" - android:background="@color/ksh_key_item_background"/> + android:background="@drawable/ksh_key_item_background"/> diff --git a/packages/SystemUI/res/layout/keyboard_shortcuts_key_view.xml b/packages/SystemUI/res/layout/keyboard_shortcuts_key_view.xml index 1215029bdda0a..31a87730a445e 100644 --- a/packages/SystemUI/res/layout/keyboard_shortcuts_key_view.xml +++ b/packages/SystemUI/res/layout/keyboard_shortcuts_key_view.xml @@ -19,7 +19,8 @@ android:layout_height="wrap_content" android:padding="@dimen/ksh_item_padding" android:layout_marginStart="@dimen/ksh_item_margin_start" - android:background="@color/ksh_key_item_background" + android:background="@drawable/ksh_key_item_background" android:textColor="@color/ksh_key_item_color" android:singleLine="true" + android:gravity="center" android:textSize="@dimen/ksh_item_text_size"/> diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index d9fcf425a287a..18fc4196daa0c 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -166,11 +166,11 @@ #ff7fcac3 - #ff00bcd4 + @color/material_deep_teal_500 #fff44336 #d9000000 @color/material_grey_600 - #eeeeee + @color/material_grey_100 #455A64 diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java index 0c079e2d3de4b..86c1fca17a882 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java @@ -530,8 +530,15 @@ public final class KeyboardShortcuts { List keyboardShortcutGroups) { LayoutInflater inflater = LayoutInflater.from(mContext); final int keyboardShortcutGroupsSize = keyboardShortcutGroups.size(); + TextView shortcutsKeyView = (TextView) inflater.inflate( + R.layout.keyboard_shortcuts_key_view, null, false); + shortcutsKeyView.measure( + View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); + final int shortcutKeyTextItemMinWidth = shortcutsKeyView.getMeasuredHeight(); // Needed to be able to scale the image items to the same height as the text items. - final int shortcutTextItemHeight = getShortcutTextItemHeight(inflater); + final int shortcutKeyIconItemHeightWidth = shortcutsKeyView.getMeasuredHeight() + - shortcutsKeyView.getPaddingTop() + - shortcutsKeyView.getPaddingBottom(); for (int i = 0; i < keyboardShortcutGroupsSize; i++) { KeyboardShortcutGroup group = keyboardShortcutGroups.get(i); TextView categoryTitle = (TextView) inflater.inflate( @@ -582,8 +589,8 @@ public final class KeyboardShortcuts { ImageView shortcutKeyIconView = (ImageView) inflater.inflate( R.layout.keyboard_shortcuts_key_icon_view, shortcutItemsContainer, false); - Bitmap bitmap = Bitmap.createBitmap(shortcutTextItemHeight, - shortcutTextItemHeight, Bitmap.Config.ARGB_8888); + Bitmap bitmap = Bitmap.createBitmap(shortcutKeyIconItemHeightWidth, + shortcutKeyIconItemHeightWidth, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); shortcutRepresentation.drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); @@ -594,6 +601,7 @@ public final class KeyboardShortcuts { TextView shortcutKeyTextView = (TextView) inflater.inflate( R.layout.keyboard_shortcuts_key_view, shortcutItemsContainer, false); + shortcutKeyTextView.setMinimumWidth(shortcutKeyTextItemMinWidth); shortcutKeyTextView.setText(shortcutRepresentation.string); shortcutItemsContainer.addView(shortcutKeyTextView); } @@ -610,16 +618,6 @@ public final class KeyboardShortcuts { } } - private int getShortcutTextItemHeight(LayoutInflater inflater) { - TextView shortcutKeyTextView = (TextView) inflater.inflate( - R.layout.keyboard_shortcuts_key_view, null, false); - shortcutKeyTextView.measure( - View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); - return shortcutKeyTextView.getMeasuredHeight() - - shortcutKeyTextView.getPaddingTop() - - shortcutKeyTextView.getPaddingBottom(); - } - private List getHumanReadableShortcutKeys(KeyboardShortcutInfo info) { List shortcutKeys = getHumanReadableModifiers(info); if (shortcutKeys == null) {