Merge "Keyboard shortcuts: UI polish 1" into nyc-dev
am: 1399890 * commit '1399890890ceb40d42b7dab063c14be3bcbaf6e4': Keyboard shortcuts: UI polish 1 Change-Id: I326c4a4a5bb28ff7dd02a1c4683a6364fa5cddab
This commit is contained in:
21
packages/SystemUI/res/drawable/ksh_key_item_background.xml
Normal file
21
packages/SystemUI/res/drawable/ksh_key_item_background.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (C) 2016 The Android Open Source Project
|
||||||
|
~
|
||||||
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
~ you may not use this file except in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing, software
|
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
~ See the License for the specific language governing permissions and
|
||||||
|
~ limitations under the License
|
||||||
|
-->
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="@color/ksh_key_item_background" />
|
||||||
|
<corners android:radius="2dp" />
|
||||||
|
</shape>
|
||||||
@@ -15,10 +15,10 @@
|
|||||||
~ limitations under the License
|
~ limitations under the License
|
||||||
-->
|
-->
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/keyboard_shortcuts_keyword_wrapper"
|
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp"
|
||||||
android:paddingStart="24dp"
|
android:paddingStart="24dp"
|
||||||
android:paddingEnd="24dp"
|
android:paddingEnd="24dp"
|
||||||
android:paddingBottom="8dp">
|
android:paddingBottom="8dp">
|
||||||
@@ -29,7 +29,8 @@
|
|||||||
android:layout_marginEnd="32dp"
|
android:layout_marginEnd="32dp"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_alignParentStart="true"/>
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_centerVertical="true"/>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/keyboard_shortcuts_keyword"
|
android:id="@+id/keyboard_shortcuts_keyword"
|
||||||
android:layout_toEndOf="@+id/keyboard_shortcuts_icon"
|
android:layout_toEndOf="@+id/keyboard_shortcuts_icon"
|
||||||
@@ -41,7 +42,8 @@
|
|||||||
android:maxLines="5"
|
android:maxLines="5"
|
||||||
android:singleLine="false"
|
android:singleLine="false"
|
||||||
android:scrollHorizontally="false"
|
android:scrollHorizontally="false"
|
||||||
android:layout_alignParentStart="true"/>
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_centerVertical="true"/>
|
||||||
<com.android.systemui.statusbar.KeyboardShortcutKeysLayout
|
<com.android.systemui.statusbar.KeyboardShortcutKeysLayout
|
||||||
android:id="@+id/keyboard_shortcuts_item_container"
|
android:id="@+id/keyboard_shortcuts_item_container"
|
||||||
android:layout_toEndOf="@+id/keyboard_shortcuts_keyword"
|
android:layout_toEndOf="@+id/keyboard_shortcuts_keyword"
|
||||||
@@ -50,5 +52,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:scrollHorizontally="false"/>
|
android:scrollHorizontally="false"
|
||||||
|
android:layout_centerVertical="true"/>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|||||||
@@ -21,4 +21,4 @@
|
|||||||
android:padding="@dimen/ksh_item_padding"
|
android:padding="@dimen/ksh_item_padding"
|
||||||
android:layout_marginStart="@dimen/ksh_item_margin_start"
|
android:layout_marginStart="@dimen/ksh_item_margin_start"
|
||||||
android:scaleType="fitXY"
|
android:scaleType="fitXY"
|
||||||
android:background="@color/ksh_key_item_background"/>
|
android:background="@drawable/ksh_key_item_background"/>
|
||||||
|
|||||||
@@ -19,7 +19,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="@dimen/ksh_item_padding"
|
android:padding="@dimen/ksh_item_padding"
|
||||||
android:layout_marginStart="@dimen/ksh_item_margin_start"
|
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:textColor="@color/ksh_key_item_color"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
android:gravity="center"
|
||||||
android:textSize="@dimen/ksh_item_text_size"/>
|
android:textSize="@dimen/ksh_item_text_size"/>
|
||||||
|
|||||||
@@ -166,11 +166,11 @@
|
|||||||
<color name="switch_accent_color">#ff7fcac3</color>
|
<color name="switch_accent_color">#ff7fcac3</color>
|
||||||
|
|
||||||
<!-- Keyboard shortcuts colors -->
|
<!-- Keyboard shortcuts colors -->
|
||||||
<color name="ksh_system_group_color">#ff00bcd4</color>
|
<color name="ksh_system_group_color">@color/material_deep_teal_500</color>
|
||||||
<color name="ksh_application_group_color">#fff44336</color>
|
<color name="ksh_application_group_color">#fff44336</color>
|
||||||
<color name="ksh_keyword_color">#d9000000</color>
|
<color name="ksh_keyword_color">#d9000000</color>
|
||||||
<color name="ksh_key_item_color">@color/material_grey_600</color>
|
<color name="ksh_key_item_color">@color/material_grey_600</color>
|
||||||
<color name="ksh_key_item_background">#eeeeee</color>
|
<color name="ksh_key_item_background">@color/material_grey_100</color>
|
||||||
|
|
||||||
<!-- Background color of edit overflow -->
|
<!-- Background color of edit overflow -->
|
||||||
<color name="qs_edit_overflow_bg">#455A64</color>
|
<color name="qs_edit_overflow_bg">#455A64</color>
|
||||||
|
|||||||
@@ -530,8 +530,15 @@ public final class KeyboardShortcuts {
|
|||||||
List<KeyboardShortcutGroup> keyboardShortcutGroups) {
|
List<KeyboardShortcutGroup> keyboardShortcutGroups) {
|
||||||
LayoutInflater inflater = LayoutInflater.from(mContext);
|
LayoutInflater inflater = LayoutInflater.from(mContext);
|
||||||
final int keyboardShortcutGroupsSize = keyboardShortcutGroups.size();
|
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.
|
// 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++) {
|
for (int i = 0; i < keyboardShortcutGroupsSize; i++) {
|
||||||
KeyboardShortcutGroup group = keyboardShortcutGroups.get(i);
|
KeyboardShortcutGroup group = keyboardShortcutGroups.get(i);
|
||||||
TextView categoryTitle = (TextView) inflater.inflate(
|
TextView categoryTitle = (TextView) inflater.inflate(
|
||||||
@@ -582,8 +589,8 @@ public final class KeyboardShortcuts {
|
|||||||
ImageView shortcutKeyIconView = (ImageView) inflater.inflate(
|
ImageView shortcutKeyIconView = (ImageView) inflater.inflate(
|
||||||
R.layout.keyboard_shortcuts_key_icon_view, shortcutItemsContainer,
|
R.layout.keyboard_shortcuts_key_icon_view, shortcutItemsContainer,
|
||||||
false);
|
false);
|
||||||
Bitmap bitmap = Bitmap.createBitmap(shortcutTextItemHeight,
|
Bitmap bitmap = Bitmap.createBitmap(shortcutKeyIconItemHeightWidth,
|
||||||
shortcutTextItemHeight, Bitmap.Config.ARGB_8888);
|
shortcutKeyIconItemHeightWidth, Bitmap.Config.ARGB_8888);
|
||||||
Canvas canvas = new Canvas(bitmap);
|
Canvas canvas = new Canvas(bitmap);
|
||||||
shortcutRepresentation.drawable.setBounds(0, 0, canvas.getWidth(),
|
shortcutRepresentation.drawable.setBounds(0, 0, canvas.getWidth(),
|
||||||
canvas.getHeight());
|
canvas.getHeight());
|
||||||
@@ -594,6 +601,7 @@ public final class KeyboardShortcuts {
|
|||||||
TextView shortcutKeyTextView = (TextView) inflater.inflate(
|
TextView shortcutKeyTextView = (TextView) inflater.inflate(
|
||||||
R.layout.keyboard_shortcuts_key_view, shortcutItemsContainer,
|
R.layout.keyboard_shortcuts_key_view, shortcutItemsContainer,
|
||||||
false);
|
false);
|
||||||
|
shortcutKeyTextView.setMinimumWidth(shortcutKeyTextItemMinWidth);
|
||||||
shortcutKeyTextView.setText(shortcutRepresentation.string);
|
shortcutKeyTextView.setText(shortcutRepresentation.string);
|
||||||
shortcutItemsContainer.addView(shortcutKeyTextView);
|
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<StringOrDrawable> getHumanReadableShortcutKeys(KeyboardShortcutInfo info) {
|
private List<StringOrDrawable> getHumanReadableShortcutKeys(KeyboardShortcutInfo info) {
|
||||||
List<StringOrDrawable> shortcutKeys = getHumanReadableModifiers(info);
|
List<StringOrDrawable> shortcutKeys = getHumanReadableModifiers(info);
|
||||||
if (shortcutKeys == null) {
|
if (shortcutKeys == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user