summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/res/drawable/ksh_key_item_background.xml2
-rw-r--r--packages/SystemUI/res/layout/keyboard_shortcut_app_item.xml5
-rw-r--r--packages/SystemUI/res/layout/keyboard_shortcuts_category_title.xml2
-rw-r--r--packages/SystemUI/res/layout/keyboard_shortcuts_key_icon_view.xml9
-rw-r--r--packages/SystemUI/res/layout/keyboard_shortcuts_key_new_icon_view.xml24
-rw-r--r--packages/SystemUI/res/layout/keyboard_shortcuts_key_plus_view.xml28
-rw-r--r--packages/SystemUI/res/layout/keyboard_shortcuts_key_separator_view.xml (renamed from packages/SystemUI/res/layout/keyboard_shortcuts_key_new_view.xml)21
-rw-r--r--packages/SystemUI/res/layout/keyboard_shortcuts_key_vertical_bar_view.xml28
-rw-r--r--packages/SystemUI/res/layout/keyboard_shortcuts_key_view.xml26
-rw-r--r--packages/SystemUI/res/layout/keyboard_shortcuts_search_view.xml15
-rw-r--r--packages/SystemUI/res/layout/keyboard_shortcuts_view.xml2
-rw-r--r--packages/SystemUI/res/values/colors.xml5
-rw-r--r--packages/SystemUI/res/values/dimens.xml5
-rw-r--r--packages/SystemUI/res/values/strings.xml14
-rw-r--r--packages/SystemUI/res/values/styles.xml4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java68
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java17
17 files changed, 90 insertions, 185 deletions
diff --git a/packages/SystemUI/res/drawable/ksh_key_item_background.xml b/packages/SystemUI/res/drawable/ksh_key_item_background.xml
index 75ff30d25aa7..1db48fad2e3f 100644
--- a/packages/SystemUI/res/drawable/ksh_key_item_background.xml
+++ b/packages/SystemUI/res/drawable/ksh_key_item_background.xml
@@ -17,5 +17,5 @@
<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" />
+ <corners android:radius="8dp" />
</shape>
diff --git a/packages/SystemUI/res/layout/keyboard_shortcut_app_item.xml b/packages/SystemUI/res/layout/keyboard_shortcut_app_item.xml
index fcf9638440c7..a0051008ddd6 100644
--- a/packages/SystemUI/res/layout/keyboard_shortcut_app_item.xml
+++ b/packages/SystemUI/res/layout/keyboard_shortcut_app_item.xml
@@ -22,8 +22,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp"
- android:paddingStart="24dp"
- android:paddingEnd="24dp"
android:paddingBottom="8dp">
<ImageView
android:id="@+id/keyboard_shortcuts_icon"
@@ -57,5 +55,6 @@
android:layout_alignParentEnd="true"
android:textSize="14sp"
android:scrollHorizontally="false"
- android:layout_centerVertical="true"/>
+ android:layout_centerVertical="true"
+ android:padding="0dp" />
</com.android.systemui.statusbar.KeyboardShortcutAppItemLayout>
diff --git a/packages/SystemUI/res/layout/keyboard_shortcuts_category_title.xml b/packages/SystemUI/res/layout/keyboard_shortcuts_category_title.xml
index 0759990f1677..4f100f6b94d1 100644
--- a/packages/SystemUI/res/layout/keyboard_shortcuts_category_title.xml
+++ b/packages/SystemUI/res/layout/keyboard_shortcuts_category_title.xml
@@ -21,7 +21,5 @@
android:textSize="14sp"
android:fontFamily="sans-serif-medium"
android:importantForAccessibility="yes"
- android:paddingStart="24dp"
android:paddingTop="20dp"
- android:paddingEnd="24dp"
android:paddingBottom="10dp"/>
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 a3901d084930..f96edbf0056e 100644
--- a/packages/SystemUI/res/layout/keyboard_shortcuts_key_icon_view.xml
+++ b/packages/SystemUI/res/layout/keyboard_shortcuts_key_icon_view.xml
@@ -18,7 +18,12 @@
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:padding="@dimen/ksh_item_padding"
+ android:minWidth="48dp"
+ android:minHeight="32dp"
+ android:paddingLeft="@dimen/ksh_key_view_padding_horizontal"
+ android:paddingRight="@dimen/ksh_key_view_padding_horizontal"
+ android:paddingTop="@dimen/ksh_key_view_padding_vertical"
+ android:paddingBottom="@dimen/ksh_key_view_padding_vertical"
android:layout_marginStart="@dimen/ksh_item_margin_start"
- android:scaleType="fitXY"
+ android:scaleType="matrix"
android:background="@drawable/ksh_key_item_background" />
diff --git a/packages/SystemUI/res/layout/keyboard_shortcuts_key_new_icon_view.xml b/packages/SystemUI/res/layout/keyboard_shortcuts_key_new_icon_view.xml
deleted file mode 100644
index a037cb284b5a..000000000000
--- a/packages/SystemUI/res/layout/keyboard_shortcuts_key_new_icon_view.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2022 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.
--->
-<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:padding="@dimen/ksh_item_padding"
- android:layout_marginLeft="0dp"
- android:layout_marginRight="0dp"
- android:scaleType="fitXY"
- android:tint="?android:attr/textColorPrimary"
- style="@style/ShortcutItemBackground" /> \ No newline at end of file
diff --git a/packages/SystemUI/res/layout/keyboard_shortcuts_key_plus_view.xml b/packages/SystemUI/res/layout/keyboard_shortcuts_key_plus_view.xml
deleted file mode 100644
index 727f2c15d5e5..000000000000
--- a/packages/SystemUI/res/layout/keyboard_shortcuts_key_plus_view.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2022 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.
--->
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:padding="@dimen/ksh_item_padding"
- android:layout_marginLeft="0dp"
- android:layout_marginRight="0dp"
- android:text="+"
- style="@style/ShortcutItemBackground"
- android:textColor="?android:attr/textColorPrimary"
- android:singleLine="true"
- android:gravity="center"
- android:textSize="@dimen/ksh_item_text_size"
- android:textAllCaps="true"/> \ No newline at end of file
diff --git a/packages/SystemUI/res/layout/keyboard_shortcuts_key_new_view.xml b/packages/SystemUI/res/layout/keyboard_shortcuts_key_separator_view.xml
index 12b4e150ee2d..8772a732e829 100644
--- a/packages/SystemUI/res/layout/keyboard_shortcuts_key_new_view.xml
+++ b/packages/SystemUI/res/layout/keyboard_shortcuts_key_separator_view.xml
@@ -14,12 +14,15 @@
limitations under the License.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:padding="@dimen/ksh_item_padding"
- android:layout_marginStart="@dimen/ksh_item_margin_start"
- style="@style/ShortcutItemBackground"
- android:textColor="?android:attr/textColorPrimary"
- android:singleLine="false"
- android:gravity="center"
- android:textSize="@dimen/ksh_item_text_size"/> \ No newline at end of file
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:minHeight="32dp"
+ android:padding="@dimen/ksh_item_padding"
+ android:layout_marginLeft="0dp"
+ android:layout_marginRight="0dp"
+ android:text="@string/keyboard_shortcut_join"
+ android:textColor="?androidprv:attr/materialColorOnSurfaceVariant"
+ android:singleLine="true"
+ android:gravity="center"
+ android:textSize="@dimen/ksh_item_text_size" />
diff --git a/packages/SystemUI/res/layout/keyboard_shortcuts_key_vertical_bar_view.xml b/packages/SystemUI/res/layout/keyboard_shortcuts_key_vertical_bar_view.xml
deleted file mode 100644
index 00ef94784740..000000000000
--- a/packages/SystemUI/res/layout/keyboard_shortcuts_key_vertical_bar_view.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2022 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.
--->
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:padding="@dimen/ksh_item_padding"
- android:layout_marginLeft="0dp"
- android:layout_marginRight="0dp"
- android:text="|"
- style="@style/ShortcutItemBackground"
- android:textColor="?android:attr/textColorPrimary"
- android:singleLine="true"
- android:gravity="center"
- android:textSize="@dimen/ksh_item_text_size"
- android:textAllCaps="true"/> \ No newline at end of file
diff --git a/packages/SystemUI/res/layout/keyboard_shortcuts_key_view.xml b/packages/SystemUI/res/layout/keyboard_shortcuts_key_view.xml
index b06f7fc3c69d..42bbf25d6c26 100644
--- a/packages/SystemUI/res/layout/keyboard_shortcuts_key_view.xml
+++ b/packages/SystemUI/res/layout/keyboard_shortcuts_key_view.xml
@@ -14,14 +14,18 @@
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:padding="@dimen/ksh_item_padding"
- android:layout_marginStart="@dimen/ksh_item_margin_start"
- 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"
- android:textAllCaps="true"/>
+<TextView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:minWidth="32dp"
+ android:minHeight="32dp"
+ android:paddingLeft="@dimen/ksh_key_view_padding_horizontal"
+ android:paddingRight="@dimen/ksh_key_view_padding_horizontal"
+ android:paddingTop="@dimen/ksh_key_view_padding_vertical"
+ android:paddingBottom="@dimen/ksh_key_view_padding_vertical"
+ android:layout_marginStart="@dimen/ksh_item_margin_start"
+ android:background="@drawable/ksh_key_item_background"
+ android:textColor="?androidprv:attr/materialColorOnSurfaceVariant"
+ android:singleLine="true"
+ android:gravity="center"
+ android:textSize="@dimen/ksh_item_text_size" />
diff --git a/packages/SystemUI/res/layout/keyboard_shortcuts_search_view.xml b/packages/SystemUI/res/layout/keyboard_shortcuts_search_view.xml
index dbcd2636134f..61f69c04c174 100644
--- a/packages/SystemUI/res/layout/keyboard_shortcuts_search_view.xml
+++ b/packages/SystemUI/res/layout/keyboard_shortcuts_search_view.xml
@@ -70,17 +70,14 @@
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_marginStart="49dp"
+ android:layout_marginEnd="0dp"
android:scrollbars="none">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
- <View
- android:layout_width="0dp"
- android:layout_height="0dp"
- android:layout_marginStart="37dp"/>
-
<Button
android:id="@+id/shortcut_system"
android:layout_width="wrap_content"
@@ -116,6 +113,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
+ android:layout_marginStart="49dp"
+ android:layout_marginEnd="49dp"
android:layout_gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorPrimary"
@@ -126,8 +125,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
- android:layout_marginStart="25dp"
- android:layout_marginEnd="25dp">
+ android:layout_marginStart="49dp"
+ android:layout_marginEnd="49dp"
+ android:overScrollMode="never"
+ android:layout_marginBottom="16dp">
<LinearLayout
android:id="@+id/keyboard_shortcuts_container"
android:layout_width="match_parent"
diff --git a/packages/SystemUI/res/layout/keyboard_shortcuts_view.xml b/packages/SystemUI/res/layout/keyboard_shortcuts_view.xml
index 7aba1cf6e0dc..9e54ab1dc361 100644
--- a/packages/SystemUI/res/layout/keyboard_shortcuts_view.xml
+++ b/packages/SystemUI/res/layout/keyboard_shortcuts_view.xml
@@ -22,6 +22,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_marginStart="24dp"
+ android:layout_marginEnd="24dp"
android:orientation="vertical">
<ScrollView
android:id="@+id/keyboard_shortcuts_scroll_view"
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index 0620355c2f98..e124aa0eda37 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -119,9 +119,8 @@
<!-- Keyboard shortcuts colors -->
<color name="ksh_application_group_color">#fff44336</color>
- <color name="ksh_key_item_color">@color/material_grey_600</color>
- <color name="ksh_key_item_background">@color/material_grey_100</color>
- <color name="ksh_key_item_new_background">@color/transparent</color>
+ <color name="ksh_key_item_color">?androidprv:attr/materialColorOnSurfaceVariant</color>
+ <color name="ksh_key_item_background">?androidprv:attr/materialColorSurfaceContainerHighest</color>
<color name="instant_apps_color">#ff4d5a64</color>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 30392d2c9d85..03960d522653 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -940,8 +940,11 @@
<!-- Keyboard shortcuts helper -->
<dimen name="ksh_layout_width">@dimen/match_parent</dimen>
<dimen name="ksh_item_text_size">14sp</dimen>
- <dimen name="ksh_item_padding">4dp</dimen>
+ <dimen name="ksh_item_padding">0dp</dimen>
<dimen name="ksh_item_margin_start">4dp</dimen>
+ <dimen name="ksh_icon_scaled_size">18dp</dimen>
+ <dimen name="ksh_key_view_padding_vertical">4dp</dimen>
+ <dimen name="ksh_key_view_padding_horizontal">12dp</dimen>
<!-- The size of corner radius of the arrow in the onboarding toast. -->
<dimen name="recents_onboarding_toast_arrow_corner_radius">2dp</dimen>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index b20fa89273ed..7488e2331764 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -1773,13 +1773,13 @@
<!-- Name used to refer to the "Back" key on the keyboard. -->
<string name="keyboard_key_back">Back</string>
<!-- Name used to refer to the "Up" arrow key on the keyboard. -->
- <string name="keyboard_key_dpad_up">Up</string>
+ <string name="keyboard_key_dpad_up">Up arrow</string>
<!-- Name used to refer to the "Down" arrow key on the keyboard. -->
- <string name="keyboard_key_dpad_down">Down</string>
+ <string name="keyboard_key_dpad_down">Down arrow</string>
<!-- Name used to refer to the "Left" arrow key on the keyboard. -->
- <string name="keyboard_key_dpad_left">Left</string>
+ <string name="keyboard_key_dpad_left">Left arrow</string>
<!-- Name used to refer to the "Right" arrow key on the keyboard. -->
- <string name="keyboard_key_dpad_right">Right</string>
+ <string name="keyboard_key_dpad_right">Right arrow</string>
<!-- Name used to refer to the "Center" arrow key on the keyboard. -->
<string name="keyboard_key_dpad_center">Center</string>
<!-- Name used to refer to the "Tab" key on the keyboard. -->
@@ -1834,6 +1834,8 @@
<string name="keyboard_shortcut_group_system_shortcuts_helper">Keyboard Shortcuts</string>
<!-- User visible title for the keyboard shortcut that switches to the next hardware keyboard layout. -->
<string name="keyboard_shortcut_group_system_switch_input">Switch keyboard layout</string>
+ <!-- User visible string that joins different shortcuts in a list, e.g. shortcut1 "or" shortcut2 "or" ... -->
+ <string name="keyboard_shortcut_join">or</string>
<!-- Content description for the clear text button in shortcut search list. [CHAR LIMIT=NONE] -->
<string name="keyboard_shortcut_clear_text">Clear text</string>
@@ -1908,11 +1910,11 @@
<!-- User visible title for the keyboard shortcut that takes the user to the assistant app. [CHAR LIMIT=70] -->
<string name="keyboard_shortcut_group_applications_assist">Assistant</string>
<!-- User visible title for the keyboard shortcut that takes the user to the browser app. [CHAR LIMIT=70] -->
- <string name="keyboard_shortcut_group_applications_browser">Browser (Chrome as default)</string>
+ <string name="keyboard_shortcut_group_applications_browser">Browser</string>
<!-- User visible title for the keyboard shortcut that takes the user to the contacts app. [CHAR LIMIT=70] -->
<string name="keyboard_shortcut_group_applications_contacts">Contacts</string>
<!-- User visible title for the keyboard shortcut that takes the user to the email app. [CHAR LIMIT=70] -->
- <string name="keyboard_shortcut_group_applications_email">Email (Gmail as default)</string>
+ <string name="keyboard_shortcut_group_applications_email">Email</string>
<!-- User visible title for the keyboard shortcut that takes the user to the SMS messaging app. [CHAR LIMIT=70] -->
<string name="keyboard_shortcut_group_applications_sms">SMS</string>
<!-- User visible title for the keyboard shortcut that takes the user to the music app. [CHAR LIMIT=70] -->
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 3db56c5a681c..c48dd9d2f68b 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -1518,10 +1518,6 @@
<item name="android:background">?android:attr/dividerHorizontal</item>
</style>
- <style name="ShortcutItemBackground">
- <item name="android:background">@color/ksh_key_item_new_background</item>
- </style>
-
<style name="LongPressLockScreenAnimation">
<item name="android:windowEnterAnimation">@anim/long_press_lock_screen_popup_enter</item>
<item name="android:windowExitAnimation">@anim/long_press_lock_screen_popup_exit</item>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java
index 4a5089770b05..92790770ccf6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java
@@ -29,8 +29,7 @@ import android.content.pm.IPackageManager;
import android.content.pm.PackageInfo;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
+import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.hardware.input.InputManagerGlobal;
@@ -119,7 +118,6 @@ public final class KeyboardShortcutListSearch {
private final SparseArray<String> mSpecialCharacterNames = new SparseArray<>();
private final SparseArray<String> mModifierNames = new SparseArray<>();
- private final SparseArray<Drawable> mSpecialCharacterDrawables = new SparseArray<>();
private final SparseArray<Drawable> mModifierDrawables = new SparseArray<>();
// Ordered list of modifiers that are supported. All values in this array must exist in
// mModifierNames.
@@ -146,7 +144,7 @@ public final class KeyboardShortcutListSearch {
} else {
this.mWindowManager = mContext.getSystemService(WindowManager.class);
}
- loadResources(context);
+ loadResources(this.mContext);
createHardcodedShortcuts();
}
@@ -350,19 +348,6 @@ public final class KeyboardShortcutListSearch {
mModifierNames.put(KeyEvent.META_SYM_ON, "Sym");
mModifierNames.put(KeyEvent.META_FUNCTION_ON, "Fn");
- mSpecialCharacterDrawables.put(
- KeyEvent.KEYCODE_DEL, context.getDrawable(R.drawable.ic_ksh_key_backspace));
- mSpecialCharacterDrawables.put(
- KeyEvent.KEYCODE_ENTER, context.getDrawable(R.drawable.ic_ksh_key_enter));
- mSpecialCharacterDrawables.put(
- KeyEvent.KEYCODE_DPAD_UP, context.getDrawable(R.drawable.ic_ksh_key_up));
- mSpecialCharacterDrawables.put(
- KeyEvent.KEYCODE_DPAD_RIGHT, context.getDrawable(R.drawable.ic_ksh_key_right));
- mSpecialCharacterDrawables.put(
- KeyEvent.KEYCODE_DPAD_DOWN, context.getDrawable(R.drawable.ic_ksh_key_down));
- mSpecialCharacterDrawables.put(
- KeyEvent.KEYCODE_DPAD_LEFT, context.getDrawable(R.drawable.ic_ksh_key_left));
-
mModifierDrawables.put(
KeyEvent.META_META_ON, context.getDrawable(R.drawable.ic_ksh_key_meta));
}
@@ -1034,16 +1019,32 @@ public final class KeyboardShortcutListSearch {
StringDrawableContainer shortcutRepresentation = shortcutKeys.get(k);
if (shortcutRepresentation.mDrawable != null) {
ImageView shortcutKeyIconView = (ImageView) inflater.inflate(
- R.layout.keyboard_shortcuts_key_new_icon_view,
+ R.layout.keyboard_shortcuts_key_icon_view,
shortcutItemsContainer,
false);
- Bitmap bitmap = Bitmap.createBitmap(shortcutKeyIconItemHeightWidth,
- shortcutKeyIconItemHeightWidth, Bitmap.Config.ARGB_8888);
- Canvas canvas = new Canvas(bitmap);
- shortcutRepresentation.mDrawable.setBounds(0, 0, canvas.getWidth(),
- canvas.getHeight());
- shortcutRepresentation.mDrawable.draw(canvas);
- shortcutKeyIconView.setImageBitmap(bitmap);
+ shortcutKeyIconView.setImageDrawable(
+ shortcutRepresentation.mDrawable);
+ // Once the view has been measured, scale and position the icon in
+ // the center.
+ shortcutKeyIconView.post(() -> {
+ Drawable d = shortcutKeyIconView.getDrawable();
+
+ float newSize = mContext.getResources().getDimensionPixelSize(
+ R.dimen.ksh_icon_scaled_size);
+ int viewWidth = shortcutKeyIconView.getWidth();
+ int viewHeight = shortcutKeyIconView.getHeight();
+ float scaleFactor = newSize / d.getIntrinsicWidth();
+ // Assumes that top/bottom and left/right padding are equal.
+ int paddingHorizontal = shortcutKeyIconView.getPaddingLeft();
+ int paddingVertical = shortcutKeyIconView.getPaddingTop();
+
+ Matrix m = new Matrix();
+ m.postScale(scaleFactor, scaleFactor);
+ m.postTranslate(
+ (viewWidth - newSize) / 2 - paddingHorizontal,
+ (viewHeight - newSize) / 2 - paddingVertical);
+ shortcutKeyIconView.setImageMatrix(m);
+ });
shortcutKeyIconView.setImportantForAccessibility(
IMPORTANT_FOR_ACCESSIBILITY_YES);
shortcutKeyIconView.setAccessibilityDelegate(
@@ -1052,7 +1053,7 @@ public final class KeyboardShortcutListSearch {
shortcutItemsContainer.addView(shortcutKeyIconView);
} else if (shortcutRepresentation.mString != null) {
TextView shortcutKeyTextView = (TextView) inflater.inflate(
- R.layout.keyboard_shortcuts_key_new_view,
+ R.layout.keyboard_shortcuts_key_view,
shortcutItemsContainer,
false);
shortcutKeyTextView.setMinimumWidth(shortcutKeyTextItemMinWidth);
@@ -1062,18 +1063,10 @@ public final class KeyboardShortcutListSearch {
shortcutRepresentation.mString));
shortcutItemsContainer.addView(shortcutKeyTextView);
}
-
- if (k < shortcutKeysSize - 1) {
- TextView shortcutKeyTextView = (TextView) inflater.inflate(
- R.layout.keyboard_shortcuts_key_plus_view,
- shortcutItemsContainer,
- false);
- shortcutItemsContainer.addView(shortcutKeyTextView);
- }
}
} else {
TextView shortcutKeyTextView = (TextView) inflater.inflate(
- R.layout.keyboard_shortcuts_key_new_view,
+ R.layout.keyboard_shortcuts_key_view,
shortcutItemsContainer,
false);
shortcutKeyTextView.setMinimumWidth(shortcutKeyTextItemMinWidth);
@@ -1085,7 +1078,7 @@ public final class KeyboardShortcutListSearch {
if (p < keyGroupItemsSize - 1) {
TextView shortcutKeyTextView = (TextView) inflater.inflate(
- R.layout.keyboard_shortcuts_key_vertical_bar_view,
+ R.layout.keyboard_shortcuts_key_separator_view,
shortcutItemsContainer,
false);
shortcutItemsContainer.addView(shortcutKeyTextView);
@@ -1124,9 +1117,6 @@ public final class KeyboardShortcutListSearch {
Drawable shortcutKeyDrawable = null;
if (info.getBaseCharacter() > Character.MIN_VALUE) {
shortcutKeyString = String.valueOf(info.getBaseCharacter());
- } else if (mSpecialCharacterDrawables.get(info.getKeycode()) != null) {
- shortcutKeyDrawable = mSpecialCharacterDrawables.get(info.getKeycode());
- shortcutKeyString = mSpecialCharacterNames.get(info.getKeycode());
} else if (mSpecialCharacterNames.get(info.getKeycode()) != null) {
shortcutKeyString = mSpecialCharacterNames.get(info.getKeycode());
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java
index 61eaff9c2f8e..acb00d5016f6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java
@@ -85,7 +85,6 @@ public final class KeyboardShortcuts {
private final SparseArray<String> mSpecialCharacterNames = new SparseArray<>();
private final SparseArray<String> mModifierNames = new SparseArray<>();
- private final SparseArray<Drawable> mSpecialCharacterDrawables = new SparseArray<>();
private final SparseArray<Drawable> mModifierDrawables = new SparseArray<>();
// Ordered list of modifiers that are supported. All values in this array must exist in
// mModifierNames.
@@ -340,19 +339,6 @@ public final class KeyboardShortcuts {
mModifierNames.put(KeyEvent.META_SYM_ON, "Sym");
mModifierNames.put(KeyEvent.META_FUNCTION_ON, "Fn");
- mSpecialCharacterDrawables.put(
- KeyEvent.KEYCODE_DEL, context.getDrawable(R.drawable.ic_ksh_key_backspace));
- mSpecialCharacterDrawables.put(
- KeyEvent.KEYCODE_ENTER, context.getDrawable(R.drawable.ic_ksh_key_enter));
- mSpecialCharacterDrawables.put(
- KeyEvent.KEYCODE_DPAD_UP, context.getDrawable(R.drawable.ic_ksh_key_up));
- mSpecialCharacterDrawables.put(
- KeyEvent.KEYCODE_DPAD_RIGHT, context.getDrawable(R.drawable.ic_ksh_key_right));
- mSpecialCharacterDrawables.put(
- KeyEvent.KEYCODE_DPAD_DOWN, context.getDrawable(R.drawable.ic_ksh_key_down));
- mSpecialCharacterDrawables.put(
- KeyEvent.KEYCODE_DPAD_LEFT, context.getDrawable(R.drawable.ic_ksh_key_left));
-
mModifierDrawables.put(
KeyEvent.META_META_ON, context.getDrawable(R.drawable.ic_ksh_key_meta));
}
@@ -747,9 +733,6 @@ public final class KeyboardShortcuts {
Drawable shortcutKeyDrawable = null;
if (info.getBaseCharacter() > Character.MIN_VALUE) {
shortcutKeyString = String.valueOf(info.getBaseCharacter());
- } else if (mSpecialCharacterDrawables.get(info.getKeycode()) != null) {
- shortcutKeyDrawable = mSpecialCharacterDrawables.get(info.getKeycode());
- shortcutKeyString = mSpecialCharacterNames.get(info.getKeycode());
} else if (mSpecialCharacterNames.get(info.getKeycode()) != null) {
shortcutKeyString = mSpecialCharacterNames.get(info.getKeycode());
} else {