Merge "Update keyboard shortcut helper design spec." into main
diff --git a/packages/SystemUI/res/anim/slide_in_up.xml b/packages/SystemUI/res/anim/slide_in_up.xml
new file mode 100644
index 0000000..6089a28
--- /dev/null
+++ b/packages/SystemUI/res/anim/slide_in_up.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2024 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.
+-->
+
+<translate
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:fromYDelta="100%p"
+ android:toYDelta="0"
+ android:duration="@android:integer/config_shortAnimTime" />
diff --git a/packages/SystemUI/res/anim/slide_out_down.xml b/packages/SystemUI/res/anim/slide_out_down.xml
new file mode 100644
index 0000000..5a7b591
--- /dev/null
+++ b/packages/SystemUI/res/anim/slide_out_down.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2024 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.
+-->
+
+<translate
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:fromYDelta="0"
+ android:toYDelta="100%p"
+ android:duration="@android:integer/config_shortAnimTime" />
diff --git a/packages/SystemUI/res/drawable/ic_shortcutlist_search.xml b/packages/SystemUI/res/drawable/ic_shortcutlist_search.xml
index 1b12e74..0406f0e 100644
--- a/packages/SystemUI/res/drawable/ic_shortcutlist_search.xml
+++ b/packages/SystemUI/res/drawable/ic_shortcutlist_search.xml
@@ -14,12 +14,15 @@
limitations under the License
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="48"
android:viewportHeight="48"
- android:tint="?android:attr/textColorSecondary">
+ android:tint="?androidprv:attr/materialColorOnSurfaceVariant">
<path
android:fillColor="@android:color/white"
+ android:strokeColor="@android:color/white"
+ android:strokeWidth="2"
android:pathData="M39.8,41.95 L26.65,28.8Q25.15,30.1 23.15,30.825Q21.15,31.55 18.9,31.55Q13.5,31.55 9.75,27.8Q6,24.05 6,18.75Q6,13.45 9.75,9.7Q13.5,5.95 18.85,5.95Q24.15,5.95 27.875,9.7Q31.6,13.45 31.6,18.75Q31.6,20.9 30.9,22.9Q30.2,24.9 28.8,26.65L42,39.75ZM18.85,28.55Q22.9,28.55 25.75,25.675Q28.6,22.8 28.6,18.75Q28.6,14.7 25.75,11.825Q22.9,8.95 18.85,8.95Q14.75,8.95 11.875,11.825Q9,14.7 9,18.75Q9,22.8 11.875,25.675Q14.75,28.55 18.85,28.55Z"/>
-</vector>
\ No newline at end of file
+</vector>
diff --git a/packages/SystemUI/res/drawable/shortcut_button_colored.xml b/packages/SystemUI/res/drawable/shortcut_button_colored.xml
index bf90853..2e2d9b9 100644
--- a/packages/SystemUI/res/drawable/shortcut_button_colored.xml
+++ b/packages/SystemUI/res/drawable/shortcut_button_colored.xml
@@ -21,7 +21,7 @@
android:color="?android:attr/colorControlHighlight">
<item>
<shape android:shape="rectangle">
- <corners android:radius="16dp"/>
+ <corners android:radius="@dimen/ksh_button_corner_radius"/>
<solid android:color="?androidprv:attr/materialColorSurfaceBright"/>
</shape>
</item>
diff --git a/packages/SystemUI/res/drawable/shortcut_button_focus_colored.xml b/packages/SystemUI/res/drawable/shortcut_button_focus_colored.xml
index f692ed97..5b88bb9 100644
--- a/packages/SystemUI/res/drawable/shortcut_button_focus_colored.xml
+++ b/packages/SystemUI/res/drawable/shortcut_button_focus_colored.xml
@@ -21,7 +21,7 @@
android:color="?android:attr/colorControlHighlight">
<item>
<shape android:shape="rectangle">
- <corners android:radius="16dp"/>
+ <corners android:radius="@dimen/ksh_button_corner_radius"/>
<solid android:color="?androidprv:attr/materialColorPrimary"/>
</shape>
</item>
diff --git a/packages/SystemUI/res/drawable/shortcut_dialog_bg.xml b/packages/SystemUI/res/drawable/shortcut_dialog_bg.xml
index 6ce3eae..aa0b268 100644
--- a/packages/SystemUI/res/drawable/shortcut_dialog_bg.xml
+++ b/packages/SystemUI/res/drawable/shortcut_dialog_bg.xml
@@ -17,8 +17,8 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="?android:attr/colorBackground"/>
- <corners android:topLeftRadius="16dp"
- android:topRightRadius="16dp"
+ <corners android:topLeftRadius="@dimen/ksh_dialog_top_corner_radius"
+ android:topRightRadius="@dimen/ksh_dialog_top_corner_radius"
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"/>
-</shape>
\ No newline at end of file
+</shape>
diff --git a/packages/SystemUI/res/drawable/shortcut_search_background.xml b/packages/SystemUI/res/drawable/shortcut_search_background.xml
index 66fc191..d6847f0 100644
--- a/packages/SystemUI/res/drawable/shortcut_search_background.xml
+++ b/packages/SystemUI/res/drawable/shortcut_search_background.xml
@@ -19,8 +19,8 @@
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
<item>
<shape android:shape="rectangle">
- <solid android:color="?androidprv:attr/colorSurface" />
- <corners android:radius="24dp" />
+ <solid android:color="?androidprv:attr/materialColorSurfaceBright" />
+ <corners android:radius="@dimen/ksh_search_box_corner_radius" />
</shape>
</item>
-</layer-list>
\ No newline at end of file
+</layer-list>
diff --git a/packages/SystemUI/res/drawable/shortcut_search_cancel_button.xml b/packages/SystemUI/res/drawable/shortcut_search_cancel_button.xml
index 6c4d4fb..2675906 100644
--- a/packages/SystemUI/res/drawable/shortcut_search_cancel_button.xml
+++ b/packages/SystemUI/res/drawable/shortcut_search_cancel_button.xml
@@ -20,7 +20,7 @@
<shape android:shape="oval">
<size android:width="24dp"
android:height="24dp" />
- <solid android:color="?androidprv:attr/colorSurface"/>
+ <solid android:color="?androidprv:attr/materialColorSurfaceBright"/>
</shape>
</item>
</ripple>
diff --git a/packages/SystemUI/res/layout/keyboard_shortcut_app_item.xml b/packages/SystemUI/res/layout/keyboard_shortcut_app_item.xml
index a005100..5ab2327 100644
--- a/packages/SystemUI/res/layout/keyboard_shortcut_app_item.xml
+++ b/packages/SystemUI/res/layout/keyboard_shortcut_app_item.xml
@@ -15,13 +15,14 @@
~ limitations under the License
-->
<com.android.systemui.statusbar.KeyboardShortcutAppItemLayout
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:background="@drawable/list_item_background"
android:focusable="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:minHeight="48dp"
+ android:minHeight="@dimen/ksh_app_item_minimum_height"
android:paddingBottom="8dp">
<ImageView
android:id="@+id/keyboard_shortcuts_icon"
@@ -39,7 +40,8 @@
android:layout_height="wrap_content"
android:paddingEnd="12dp"
android:paddingBottom="4dp"
- android:textColor="?android:attr/textColorPrimary"
+ android:textColor="?androidprv:attr/materialColorOnSurface"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="16sp"
android:maxLines="5"
android:singleLine="false"
diff --git a/packages/SystemUI/res/layout/keyboard_shortcuts_category_short_separator.xml b/packages/SystemUI/res/layout/keyboard_shortcuts_category_short_separator.xml
index 530e46e..76e5b12 100644
--- a/packages/SystemUI/res/layout/keyboard_shortcuts_category_short_separator.xml
+++ b/packages/SystemUI/res/layout/keyboard_shortcuts_category_short_separator.xml
@@ -15,6 +15,6 @@
limitations under the License
-->
<View xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_marginTop="8dp"
- android:layout_marginBottom="0dp"
+ android:layout_marginTop="@dimen/ksh_category_separator_margin"
+ android:layout_marginBottom="@dimen/ksh_category_separator_margin"
style="@style/ShortcutHorizontalDivider" />
diff --git a/packages/SystemUI/res/layout/keyboard_shortcuts_category_title.xml b/packages/SystemUI/res/layout/keyboard_shortcuts_category_title.xml
index 4f100f6..6e7fde6 100644
--- a/packages/SystemUI/res/layout/keyboard_shortcuts_category_title.xml
+++ b/packages/SystemUI/res/layout/keyboard_shortcuts_category_title.xml
@@ -16,10 +16,12 @@
~ limitations under the License
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="14sp"
- android:fontFamily="sans-serif-medium"
+ android:textColor="?androidprv:attr/materialColorPrimary"
android:importantForAccessibility="yes"
android:paddingTop="20dp"
android:paddingBottom="10dp"/>
diff --git a/packages/SystemUI/res/layout/keyboard_shortcuts_search_view.xml b/packages/SystemUI/res/layout/keyboard_shortcuts_search_view.xml
index f6042e4..2cfd644 100644
--- a/packages/SystemUI/res/layout/keyboard_shortcuts_search_view.xml
+++ b/packages/SystemUI/res/layout/keyboard_shortcuts_search_view.xml
@@ -16,15 +16,21 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:background="@drawable/shortcut_dialog_bg"
android:layout_width="@dimen/ksh_layout_width"
android:layout_height="wrap_content"
android:orientation="vertical">
+
+ <com.google.android.material.bottomsheet.BottomSheetDragHandleView
+ android:id="@+id/drag_handle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"/>
+
<TextView
android:id="@+id/shortcut_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="40dp"
android:layout_gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="?android:attr/textColorPrimary"
@@ -39,44 +45,47 @@
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginBottom="24dp"
- android:layout_marginStart="49dp"
- android:layout_marginEnd="49dp"
+ android:layout_marginStart="@dimen/ksh_container_horizontal_margin"
+ android:layout_marginEnd="@dimen/ksh_container_horizontal_margin"
android:padding="16dp"
android:background="@drawable/shortcut_search_background"
android:drawableStart="@drawable/ic_shortcutlist_search"
android:drawablePadding="15dp"
android:singleLine="true"
- android:textColor="?android:attr/textColorPrimary"
+ android:textColor="?androidprv:attr/materialColorOnSurfaceVariant"
android:inputType="text"
android:textDirection="locale"
android:textAlignment="viewStart"
android:hint="@string/keyboard_shortcut_search_list_hint"
- android:textColorHint="?android:attr/textColorTertiary" />
+ android:textAppearance="@android:style/TextAppearance.Material"
+ android:textSize="16sp"
+ android:textColorHint="?androidprv:attr/materialColorOutline" />
<ImageButton
android:id="@+id/keyboard_shortcuts_search_cancel"
android:layout_gravity="center_vertical|end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginEnd="49dp"
+ android:layout_marginEnd="@dimen/ksh_container_horizontal_margin"
android:padding="16dp"
android:contentDescription="@string/keyboard_shortcut_clear_text"
android:src="@drawable/ic_shortcutlist_search_button_cancel"
android:background="@drawable/shortcut_search_cancel_button"
style="@android:style/Widget.Material.Button.Borderless.Small"
- android:pointerIcon="arrow" />
+ android:pointerIcon="arrow"
+ android:visibility="gone" />
</FrameLayout>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginStart="49dp"
+ android:layout_marginStart="@dimen/ksh_container_horizontal_margin"
android:layout_marginEnd="0dp"
android:scrollbars="none">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:gravity="center_vertical"
+ android:layout_gravity="center_vertical"
android:orientation="horizontal">
<Button
android:id="@+id/shortcut_system"
@@ -113,29 +122,29 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
- android:layout_marginStart="49dp"
- android:layout_marginEnd="49dp"
+ android:layout_marginStart="@dimen/ksh_container_horizontal_margin"
+ android:layout_marginEnd="@dimen/ksh_container_horizontal_margin"
android:layout_gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorPrimary"
android:text="@string/keyboard_shortcut_search_list_no_result"/>
- <ScrollView
+ <androidx.core.widget.NestedScrollView
android:id="@+id/keyboard_shortcuts_scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
- android:layout_marginStart="49dp"
- android:layout_marginEnd="49dp"
+ android:layout_marginStart="@dimen/ksh_container_horizontal_margin"
+ android:layout_marginEnd="@dimen/ksh_container_horizontal_margin"
android:overScrollMode="never"
- android:layout_marginBottom="16dp"
+ android:clipToPadding="false"
android:scrollbars="none">
<LinearLayout
android:id="@+id/keyboard_shortcuts_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"/>
- </ScrollView>
+ </androidx.core.widget.NestedScrollView>
<!-- Required for stretching to full available height when the items in the scroll view
occupy less space then the full height -->
<View
diff --git a/packages/SystemUI/res/values-land/dimens.xml b/packages/SystemUI/res/values-land/dimens.xml
index 55606aa..56ebc06 100644
--- a/packages/SystemUI/res/values-land/dimens.xml
+++ b/packages/SystemUI/res/values-land/dimens.xml
@@ -94,4 +94,7 @@
<dimen name="keyguard_indication_margin_bottom">8dp</dimen>
<dimen name="lock_icon_margin_bottom">24dp</dimen>
+
+ <!-- Keyboard shortcuts helper -->
+ <dimen name="ksh_container_horizontal_margin">48dp</dimen>
</resources>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index f2288a4..b95ee56 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -978,6 +978,7 @@
<dimen name="assist_disclosure_shadow_thickness">1.5dp</dimen>
<!-- Keyboard shortcuts helper -->
+ <dimen name="ksh_container_horizontal_margin">32dp</dimen>
<dimen name="ksh_layout_width">@dimen/match_parent</dimen>
<dimen name="ksh_item_text_size">14sp</dimen>
<dimen name="ksh_item_padding">0dp</dimen>
@@ -985,6 +986,11 @@
<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>
+ <dimen name="ksh_button_corner_radius">12dp</dimen>
+ <dimen name="ksh_dialog_top_corner_radius">28dp</dimen>
+ <dimen name="ksh_search_box_corner_radius">100dp</dimen>
+ <dimen name="ksh_app_item_minimum_height">64dp</dimen>
+ <dimen name="ksh_category_separator_margin">16dp</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/styles.xml b/packages/SystemUI/res/values/styles.xml
index e825f32..9da4f79 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -366,6 +366,21 @@
<item name="android:layout_height">wrap_content</item>
</style>
+ <style name="KeyboardShortcutHelper" parent="@android:style/Theme.DeviceDefault.Settings">
+ <!-- Needed to be able to use BottomSheetDragHandleView -->
+ <item name="android:windowActionBar">false</item>
+ <item name="bottomSheetDragHandleStyle">@style/KeyboardShortcutHelper.BottomSheet.DragHandle</item>
+ </style>
+
+ <style name="KeyboardShortcutHelper.BottomSheet.DragHandle" parent="Widget.Material3.BottomSheet.DragHandle">
+ <item name="tint">?androidprv:attr/materialColorOutlineVariant</item>
+ </style>
+
+ <style name="KeyboardShortcutHelper.BottomSheetDialogAnimation">
+ <item name="android:windowEnterAnimation">@anim/slide_in_up</item>
+ <item name="android:windowExitAnimation">@anim/slide_out_down</item>
+ </style>
+
<style name="BrightnessDialogContainer" parent="@style/BaseBrightnessDialogContainer" />
<style name="Animation" />
@@ -1598,14 +1613,15 @@
<item name="android:layout_marginEnd">12dp</item>
<item name="android:paddingLeft">24dp</item>
<item name="android:paddingRight">24dp</item>
- <item name="android:minHeight">40dp</item>
+ <item name="android:minHeight">36dp</item>
+ <item name="android:minWidth">120dp</item>
<item name="android:stateListAnimator">@*android:anim/flat_button_state_list_anim_material</item>
<item name="android:pointerIcon">arrow</item>
</style>
<style name="ShortcutHorizontalDivider">
- <item name="android:layout_width">120dp</item>
- <item name="android:layout_height">1dp</item>
+ <item name="android:layout_width">132dp</item>
+ <item name="android:layout_height">2dp</item>
<item name="android:layout_gravity">center_horizontal</item>
<item name="android:background">?android:attr/dividerHorizontal</item>
</style>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java
index d6858ca..78e108d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java
@@ -40,6 +40,7 @@
import android.os.Looper;
import android.os.RemoteException;
import android.text.Editable;
+import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.util.Pair;
@@ -57,6 +58,7 @@
import android.view.View.AccessibilityDelegate;
import android.view.ViewGroup;
import android.view.Window;
+import android.view.WindowInsets;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.Button;
@@ -104,6 +106,7 @@
private WindowManager mWindowManager;
private EditText mSearchEditText;
+ private ImageButton mEditTextCancel;
private String mQueryString;
private int mCurrentCategoryIndex = 0;
private Map<Integer, Boolean> mKeySearchResultMap = new HashMap<>();
@@ -143,7 +146,7 @@
@VisibleForTesting
KeyboardShortcutListSearch(Context context, WindowManager windowManager) {
this.mContext = new ContextThemeWrapper(
- context, android.R.style.Theme_DeviceDefault_Settings);
+ context, R.style.KeyboardShortcutHelper);
this.mPackageManager = AppGlobals.getPackageManager();
if (windowManager != null) {
this.mWindowManager = windowManager;
@@ -853,13 +856,14 @@
List<List<KeyboardShortcutMultiMappingGroup>> keyboardShortcutMultiMappingGroupList) {
mQueryString = null;
LayoutInflater inflater = mContext.getSystemService(LayoutInflater.class);
- mKeyboardShortcutsBottomSheetDialog =
- new BottomSheetDialog(mContext);
+ mKeyboardShortcutsBottomSheetDialog = new BottomSheetDialog(mContext);
final View keyboardShortcutsView = inflater.inflate(
R.layout.keyboard_shortcuts_search_view, null);
LinearLayout shortcutsContainer = keyboardShortcutsView.findViewById(
R.id.keyboard_shortcuts_container);
mNoSearchResults = keyboardShortcutsView.findViewById(R.id.shortcut_search_no_result);
+ Window keyboardShortcutsWindow = mKeyboardShortcutsBottomSheetDialog.getWindow();
+ setWindowProperties(keyboardShortcutsWindow);
mKeyboardShortcutsBottomSheetDialog.setContentView(keyboardShortcutsView);
setButtonsDefaultStatus(keyboardShortcutsView);
populateCurrentAppButton();
@@ -874,25 +878,11 @@
}
BottomSheetBehavior<FrameLayout> behavior = BottomSheetBehavior.from(bottomSheet);
+ behavior.setDraggable(true);
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
behavior.setSkipCollapsed(true);
- behavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
- @Override
- public void onStateChanged(@NonNull View bottomSheet, int newState) {
- if (newState == BottomSheetBehavior.STATE_DRAGGING) {
- behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
- }
- }
- @Override
- public void onSlide(@NonNull View bottomSheet, float slideOffset) {
- // Do nothing.
- }
- });
- mKeyboardShortcutsBottomSheetDialog.setCanceledOnTouchOutside(true);
- Window keyboardShortcutsWindow = mKeyboardShortcutsBottomSheetDialog.getWindow();
- keyboardShortcutsWindow.setType(TYPE_SYSTEM_DIALOG);
synchronized (sLock) {
// show KeyboardShortcutsBottomSheetDialog only if it has not been dismissed already
if (sInstance != null) {
@@ -908,6 +898,8 @@
}
}
mSearchEditText = keyboardShortcutsView.findViewById(R.id.keyboard_shortcuts_search);
+ mEditTextCancel = keyboardShortcutsView.findViewById(
+ R.id.keyboard_shortcuts_search_cancel);
mSearchEditText.addTextChangedListener(
new TextWatcher() {
@Override
@@ -921,6 +913,8 @@
shortcutsContainer.setAccessibilityPaneTitle(mContext.getString(
R.string.keyboard_shortcut_a11y_show_search_results));
}
+ mEditTextCancel.setVisibility(
+ TextUtils.isEmpty(mQueryString) ? View.GONE : View.VISIBLE);
}
@Override
@@ -933,9 +927,28 @@
// Do nothing.
}
});
- ImageButton editTextCancel = keyboardShortcutsView.findViewById(
- R.id.keyboard_shortcuts_search_cancel);
- editTextCancel.setOnClickListener(v -> mSearchEditText.setText(null));
+
+ mEditTextCancel.setOnClickListener(v -> mSearchEditText.setText(null));
+ }
+
+ private static void setWindowProperties(Window keyboardShortcutsWindow) {
+ keyboardShortcutsWindow.setType(TYPE_SYSTEM_DIALOG);
+ WindowManager.LayoutParams params = new WindowManager.LayoutParams();
+ params.copyFrom(keyboardShortcutsWindow.getAttributes());
+ // Allows the bottom sheet dialog to render all the way to the bottom of the screen,
+ // behind the gesture navigation bar.
+ params.flags |= WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
+ params.setFitInsetsTypes(WindowInsets.Type.statusBars());
+ keyboardShortcutsWindow.setAttributes(params);
+ keyboardShortcutsWindow.getDecorView().setOnApplyWindowInsetsListener((v, insets) -> {
+ int bottom = insets.getInsets(WindowInsets.Type.navigationBars()).bottom;
+ View container = v.findViewById(R.id.keyboard_shortcuts_container);
+ container.setPadding(container.getPaddingLeft(), container.getPaddingTop(),
+ container.getPaddingRight(), bottom);
+ return WindowInsets.CONSUMED;
+ });
+ keyboardShortcutsWindow.setWindowAnimations(
+ R.style.KeyboardShortcutHelper_BottomSheetDialogAnimation);
}
private void populateKeyboardShortcutSearchList(LinearLayout keyboardShortcutsLayout) {
@@ -1256,10 +1269,10 @@
if (mContext.getResources().getConfiguration().orientation
== Configuration.ORIENTATION_PORTRAIT) {
lp.width = (int) (display.getWidth() * 0.8);
- lp.height = (int) (display.getHeight() * 0.7);
+ lp.height = (int) (display.getHeight() * 0.8);
} else {
lp.width = (int) (display.getWidth() * 0.7);
- lp.height = (int) (display.getHeight() * 0.8);
+ lp.height = (int) (display.getHeight() * 0.95);
}
window.setGravity(Gravity.BOTTOM);
window.setAttributes(lp);