Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5210caeb authored by Robert Horvath's avatar Robert Horvath Committed by Android (Google) Code Review
Browse files

Merge "Add support for keyboard shortcuts panel on TV"

parents f2caa372 bcb0d406
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2023 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.
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true" android:drawable="@*android:drawable/list_choice_background_material" />
    <item android:drawable="@android:color/transparent" />
</selector>
 No newline at end of file
+3 −2
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
<com.android.systemui.statusbar.KeyboardShortcutAppItemLayout
        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"
@@ -55,6 +57,5 @@
            android:layout_alignParentEnd="true"
            android:textSize="14sp"
            android:scrollHorizontally="false"
            android:layout_centerVertical="true"
            android:focusable="true"/>
            android:layout_centerVertical="true"/>
</com.android.systemui.statusbar.KeyboardShortcutAppItemLayout>
+2 −1
Original line number Diff line number Diff line
@@ -16,10 +16,11 @@
  ~ limitations under the License
  -->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="wrap_content"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:textSize="14sp"
          android:fontFamily="sans-serif-medium"
          android:importantForAccessibility="yes"
          android:paddingStart="24dp"
          android:paddingTop="20dp"
          android:paddingEnd="24dp"
+16 −4
Original line number Diff line number Diff line
@@ -440,10 +440,15 @@ public final class KeyboardShortcuts {
                mContext.getString(R.string.keyboard_shortcut_group_system_back),
                KeyEvent.KEYCODE_DEL,
                KeyEvent.META_META_ON));

        // Some devices (like TV) don't have recents
        if (mContext.getResources().getBoolean(com.android.internal.R.bool.config_hasRecents)) {
            systemGroup.addItem(new KeyboardShortcutInfo(
                    mContext.getString(R.string.keyboard_shortcut_group_system_recents),
                    KeyEvent.KEYCODE_TAB,
                    KeyEvent.META_ALT_ON));
        }

        systemGroup.addItem(new KeyboardShortcutInfo(
                mContext.getString(
                        R.string.keyboard_shortcut_group_system_notifications),
@@ -683,8 +688,10 @@ public final class KeyboardShortcuts {
                ViewGroup shortcutItemsContainer = (ViewGroup) shortcutView
                        .findViewById(R.id.keyboard_shortcuts_item_container);
                final int shortcutKeysSize = shortcutKeys.size();
                final List<String> humanReadableShortcuts = new ArrayList<>();
                for (int k = 0; k < shortcutKeysSize; k++) {
                    StringDrawableContainer shortcutRepresentation = shortcutKeys.get(k);
                    humanReadableShortcuts.add(shortcutRepresentation.mString);
                    if (shortcutRepresentation.mDrawable != null) {
                        ImageView shortcutKeyIconView = (ImageView) inflater.inflate(
                                R.layout.keyboard_shortcuts_key_icon_view, shortcutItemsContainer,
@@ -714,6 +721,11 @@ public final class KeyboardShortcuts {
                        shortcutItemsContainer.addView(shortcutKeyTextView);
                    }
                }
                CharSequence contentDescription = info.getLabel();
                if (!humanReadableShortcuts.isEmpty()) {
                    contentDescription += ": " + String.join(", ", humanReadableShortcuts);
                }
                shortcutView.setContentDescription(contentDescription);
                shortcutContainer.addView(shortcutView);
            }
            keyboardShortcutsLayout.addView(shortcutContainer);
+8 −2
Original line number Diff line number Diff line
@@ -27,11 +27,12 @@ import com.android.systemui.CoreStartable;
import com.android.systemui.assist.AssistManager;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.statusbar.CommandQueue;

import javax.inject.Inject;
import com.android.systemui.statusbar.KeyboardShortcuts;

import dagger.Lazy;

import javax.inject.Inject;

/**
 * Status bar implementation for "large screen" products that mostly present no on-screen nav.
 * Serves as a collection of UI components, rather than showing its own UI.
@@ -78,4 +79,9 @@ public class TvStatusBar implements CoreStartable, CommandQueue.Callbacks {
                new Intent(ACTION_SHOW_PIP_MENU).setPackage(mContext.getPackageName()),
                SYSTEMUI_PERMISSION);
    }

    @Override
    public void toggleKeyboardShortcutsMenu(int deviceId) {
        KeyboardShortcuts.show(mContext, deviceId);
    }
}
Loading