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:
Andrei Stingaceanu
2016-04-11 13:30:47 +00:00
committed by android-build-merger
6 changed files with 44 additions and 21 deletions

View 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>

View File

@@ -15,10 +15,10 @@
~ limitations under the License
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/keyboard_shortcuts_keyword_wrapper"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:paddingStart="24dp"
android:paddingEnd="24dp"
android:paddingBottom="8dp">
@@ -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"/>
<TextView
android:id="@+id/keyboard_shortcuts_keyword"
android:layout_toEndOf="@+id/keyboard_shortcuts_icon"
@@ -41,7 +42,8 @@
android:maxLines="5"
android:singleLine="false"
android:scrollHorizontally="false"
android:layout_alignParentStart="true"/>
android:layout_alignParentStart="true"
android:layout_centerVertical="true"/>
<com.android.systemui.statusbar.KeyboardShortcutKeysLayout
android:id="@+id/keyboard_shortcuts_item_container"
android:layout_toEndOf="@+id/keyboard_shortcuts_keyword"
@@ -50,5 +52,6 @@
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:textSize="14sp"
android:scrollHorizontally="false"/>
android:scrollHorizontally="false"
android:layout_centerVertical="true"/>
</RelativeLayout>

View File

@@ -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"/>

View File

@@ -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"/>

View File

@@ -166,11 +166,11 @@
<color name="switch_accent_color">#ff7fcac3</color>
<!-- 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_keyword_color">#d9000000</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 -->
<color name="qs_edit_overflow_bg">#455A64</color>

View File

@@ -530,8 +530,15 @@ public final class KeyboardShortcuts {
List<KeyboardShortcutGroup> 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<StringOrDrawable> getHumanReadableShortcutKeys(KeyboardShortcutInfo info) {
List<StringOrDrawable> shortcutKeys = getHumanReadableModifiers(info);
if (shortcutKeys == null) {