Loading packages/SystemUI/compose/features/src/com/android/systemui/statusbar/phone/SystemUIDialogFactoryExt.kt +8 −7 Original line number Diff line number Diff line Loading @@ -98,19 +98,20 @@ fun SystemUIDialogFactory.create( theme: Int = SystemUIDialog.DEFAULT_THEME, dismissOnDeviceLock: Boolean = SystemUIDialog.DEFAULT_DISMISS_ON_DEVICE_LOCK, @GravityInt dialogGravity: Int? = null, content: @Composable (SystemUIDialog) -> Unit, ): ComponentSystemUIDialog { return create( context = context, theme = theme, dismissOnDeviceLock = dismissOnDeviceLock, delegate = dialogDelegate: DialogDelegate<SystemUIDialog> = object : DialogDelegate<SystemUIDialog> { override fun onCreate(dialog: SystemUIDialog, savedInstanceState: Bundle?) { super.onCreate(dialog, savedInstanceState) dialogGravity?.let { dialog.window?.setGravity(it) } } }, content: @Composable (SystemUIDialog) -> Unit, ): ComponentSystemUIDialog { return create( context = context, theme = theme, dismissOnDeviceLock = dismissOnDeviceLock, delegate = dialogDelegate, content = content, ) } Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/ui/ShortcutHelperDialogStarterTest.kt +8 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.keyboard.shortcut.data.source.FakeKeyboardShortcutGroupsSource import com.android.systemui.keyboard.shortcut.data.source.TestShortcuts import com.android.systemui.keyboard.shortcut.shortcutCustomizationDialogStarterFactory import com.android.systemui.keyboard.shortcut.shortcutHelperAppCategoriesShortcutsSource import com.android.systemui.keyboard.shortcut.shortcutHelperCurrentAppShortcutsSource import com.android.systemui.keyboard.shortcut.shortcutHelperInputShortcutsSource Loading Loading @@ -71,7 +72,13 @@ class ShortcutHelperDialogStarterTest : SysuiTestCase() { private val starter: ShortcutHelperDialogStarter = with(kosmos) { ShortcutHelperDialogStarter(coroutineScope, viewModel, dialogFactory, activityStarter) ShortcutHelperDialogStarter( coroutineScope, viewModel, shortcutCustomizationDialogStarterFactory, dialogFactory, activityStarter, ) } @Before Loading packages/SystemUI/res/values/strings.xml +33 −0 Original line number Diff line number Diff line Loading @@ -3743,6 +3743,11 @@ is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_customize_mode_title">Customize keyboard shortcuts</string> <!-- Sub title at the top of the keyboard shortcut helper customization dialog. Explains to the user what action they need to take in the customization dialog to assign a new custom shortcut. The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_customize_mode_sub_title">Press key to assign shortcut</string> <!-- Placeholder text shown in the search box of the keyboard shortcut helper, when the user hasn't typed in anything in the search box yet. The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> Loading @@ -3754,6 +3759,16 @@ use. The helper shows shortcuts in categories, which can be collapsed or expanded. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_content_description_collapse_icon">Collapse icon</string> <!-- Content description of the Meta key (also called Action Key) icon that prompts users to press some key combination starting with meta key to assign new key combination to shortcut in shortcut helper customization dialog. The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_content_description_meta_key">Action or Meta key icon</string> <!-- Content description of the plus icon after the meta key icon prompts users to press some key combination starting with meta key to assign new key combination to shortcut in shortcut helper customization dialog. The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_content_description_plus_icon">Plus icon</string> <!-- Description text of the button that allows user to customize shortcuts in keyboard shortcut helper The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> Loading Loading @@ -3784,6 +3799,24 @@ open keyboard settings while in shortcut helper. The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_keyboard_settings_buttons_label">Keyboard Settings</string> <!-- Label on the set shortcut button in keyboard shortcut helper customize dialog, that allows user to confirm and assign key combination to selected shortcut. The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_customize_dialog_set_shortcut_button_label">Set shortcut</string> <!-- Label on the cancel button in keyboard shortcut helper customize dialog, that allows user to cancel and exit shortcut customization dialog, returning to the main shortcut helper page. The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_customize_dialog_cancel_button_label">Cancel</string> <!-- Placeholder text, prompting user to Press key combination assign to shortcut. This is shown in shortcut helper's "Add Custom Shortcut" Dialog text field when user hasn't pressed any key yet. The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_add_shortcut_dialog_placeholder">Press key</string> <!-- Error message displayed when the user select a key combination that is already in use while assigning a new custom key combination to a shortcut in shortcut helper. The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_customize_dialog_error_message">Key combination already in use. Try another key.</string> <!-- Keyboard touchpad tutorial scheduler--> Loading packages/SystemUI/src/com/android/systemui/keyboard/shortcut/domain/interactor/ShortcutCustomizationInteractor.kt 0 → 100644 +28 −0 Original line number Diff line number Diff line /* * 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. */ package com.android.systemui.keyboard.shortcut.domain.interactor import android.view.KeyEvent.META_META_ON import com.android.systemui.keyboard.shortcut.data.repository.ShortcutHelperKeys import com.android.systemui.keyboard.shortcut.shared.model.ShortcutKey import javax.inject.Inject class ShortcutCustomizationInteractor @Inject constructor() { fun getDefaultCustomShortcutModifierKey(): ShortcutKey.Icon.ResIdIcon { return ShortcutKey.Icon.ResIdIcon(ShortcutHelperKeys.keyIcons[META_META_ON]!!) } } packages/SystemUI/src/com/android/systemui/keyboard/shortcut/shared/model/ShortcutInfo.kt 0 → 100644 +23 −0 Original line number Diff line number Diff line /* * 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. */ package com.android.systemui.keyboard.shortcut.shared.model data class ShortcutInfo( val label: String, val categoryType: ShortcutCategoryType, val subCategoryLabel: String, ) Loading
packages/SystemUI/compose/features/src/com/android/systemui/statusbar/phone/SystemUIDialogFactoryExt.kt +8 −7 Original line number Diff line number Diff line Loading @@ -98,19 +98,20 @@ fun SystemUIDialogFactory.create( theme: Int = SystemUIDialog.DEFAULT_THEME, dismissOnDeviceLock: Boolean = SystemUIDialog.DEFAULT_DISMISS_ON_DEVICE_LOCK, @GravityInt dialogGravity: Int? = null, content: @Composable (SystemUIDialog) -> Unit, ): ComponentSystemUIDialog { return create( context = context, theme = theme, dismissOnDeviceLock = dismissOnDeviceLock, delegate = dialogDelegate: DialogDelegate<SystemUIDialog> = object : DialogDelegate<SystemUIDialog> { override fun onCreate(dialog: SystemUIDialog, savedInstanceState: Bundle?) { super.onCreate(dialog, savedInstanceState) dialogGravity?.let { dialog.window?.setGravity(it) } } }, content: @Composable (SystemUIDialog) -> Unit, ): ComponentSystemUIDialog { return create( context = context, theme = theme, dismissOnDeviceLock = dismissOnDeviceLock, delegate = dialogDelegate, content = content, ) } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyboard/shortcut/ui/ShortcutHelperDialogStarterTest.kt +8 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.keyboard.shortcut.data.source.FakeKeyboardShortcutGroupsSource import com.android.systemui.keyboard.shortcut.data.source.TestShortcuts import com.android.systemui.keyboard.shortcut.shortcutCustomizationDialogStarterFactory import com.android.systemui.keyboard.shortcut.shortcutHelperAppCategoriesShortcutsSource import com.android.systemui.keyboard.shortcut.shortcutHelperCurrentAppShortcutsSource import com.android.systemui.keyboard.shortcut.shortcutHelperInputShortcutsSource Loading Loading @@ -71,7 +72,13 @@ class ShortcutHelperDialogStarterTest : SysuiTestCase() { private val starter: ShortcutHelperDialogStarter = with(kosmos) { ShortcutHelperDialogStarter(coroutineScope, viewModel, dialogFactory, activityStarter) ShortcutHelperDialogStarter( coroutineScope, viewModel, shortcutCustomizationDialogStarterFactory, dialogFactory, activityStarter, ) } @Before Loading
packages/SystemUI/res/values/strings.xml +33 −0 Original line number Diff line number Diff line Loading @@ -3743,6 +3743,11 @@ is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_customize_mode_title">Customize keyboard shortcuts</string> <!-- Sub title at the top of the keyboard shortcut helper customization dialog. Explains to the user what action they need to take in the customization dialog to assign a new custom shortcut. The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_customize_mode_sub_title">Press key to assign shortcut</string> <!-- Placeholder text shown in the search box of the keyboard shortcut helper, when the user hasn't typed in anything in the search box yet. The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> Loading @@ -3754,6 +3759,16 @@ use. The helper shows shortcuts in categories, which can be collapsed or expanded. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_content_description_collapse_icon">Collapse icon</string> <!-- Content description of the Meta key (also called Action Key) icon that prompts users to press some key combination starting with meta key to assign new key combination to shortcut in shortcut helper customization dialog. The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_content_description_meta_key">Action or Meta key icon</string> <!-- Content description of the plus icon after the meta key icon prompts users to press some key combination starting with meta key to assign new key combination to shortcut in shortcut helper customization dialog. The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_content_description_plus_icon">Plus icon</string> <!-- Description text of the button that allows user to customize shortcuts in keyboard shortcut helper The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> Loading Loading @@ -3784,6 +3799,24 @@ open keyboard settings while in shortcut helper. The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_keyboard_settings_buttons_label">Keyboard Settings</string> <!-- Label on the set shortcut button in keyboard shortcut helper customize dialog, that allows user to confirm and assign key combination to selected shortcut. The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_customize_dialog_set_shortcut_button_label">Set shortcut</string> <!-- Label on the cancel button in keyboard shortcut helper customize dialog, that allows user to cancel and exit shortcut customization dialog, returning to the main shortcut helper page. The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_customize_dialog_cancel_button_label">Cancel</string> <!-- Placeholder text, prompting user to Press key combination assign to shortcut. This is shown in shortcut helper's "Add Custom Shortcut" Dialog text field when user hasn't pressed any key yet. The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_add_shortcut_dialog_placeholder">Press key</string> <!-- Error message displayed when the user select a key combination that is already in use while assigning a new custom key combination to a shortcut in shortcut helper. The helper is a component that shows the user which keyboard shortcuts they can use. [CHAR LIMIT=NONE] --> <string name="shortcut_helper_customize_dialog_error_message">Key combination already in use. Try another key.</string> <!-- Keyboard touchpad tutorial scheduler--> Loading
packages/SystemUI/src/com/android/systemui/keyboard/shortcut/domain/interactor/ShortcutCustomizationInteractor.kt 0 → 100644 +28 −0 Original line number Diff line number Diff line /* * 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. */ package com.android.systemui.keyboard.shortcut.domain.interactor import android.view.KeyEvent.META_META_ON import com.android.systemui.keyboard.shortcut.data.repository.ShortcutHelperKeys import com.android.systemui.keyboard.shortcut.shared.model.ShortcutKey import javax.inject.Inject class ShortcutCustomizationInteractor @Inject constructor() { fun getDefaultCustomShortcutModifierKey(): ShortcutKey.Icon.ResIdIcon { return ShortcutKey.Icon.ResIdIcon(ShortcutHelperKeys.keyIcons[META_META_ON]!!) } }
packages/SystemUI/src/com/android/systemui/keyboard/shortcut/shared/model/ShortcutInfo.kt 0 → 100644 +23 −0 Original line number Diff line number Diff line /* * 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. */ package com.android.systemui.keyboard.shortcut.shared.model data class ShortcutInfo( val label: String, val categoryType: ShortcutCategoryType, val subCategoryLabel: String, )