diff options
author | Vadim Tryshev <vadimt@google.com> | 2018-06-12 13:44:43 -0700 |
---|---|---|
committer | Vadim Tryshev <vadimt@google.com> | 2018-06-12 14:54:23 -0700 |
commit | 74c261c89ff1aa060c9b18f75fca48fac9409bfa (patch) | |
tree | 648d96b72b6985126cc8ca83d4f46db65d1a37b3 | |
parent | b0e4126ad0e83abfb3bd9012958f7748af38e5d4 (diff) | |
download | Launcher3-74c261c89ff1aa060c9b18f75fca48fac9409bfa.tar.gz |
Prerequisites for TAPL
Adding things that will be used by TAPL.
1. Adding Ctrl+W to open widgets
2. Marking a UI element with shortcuts_and_widgets
id. Example of usage: we want to be sure we are in all apps.
A somewhat paranoid way to check this is to check that
apps_view is on, and workspace and overview_panel are off.
However, workspace is always in the hierarchy. We use
shortcuts_and_widgets instead.
Bug: 110103162
Test: Manual
Change-Id: I2a851e16c477f7ee895b459530bc5a1ff19e32f8
-rw-r--r-- | res/values/config.xml | 1 | ||||
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 8 | ||||
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 1 | ||||
-rw-r--r-- | src/com/android/launcher3/views/OptionsPopupView.java | 5 |
4 files changed, 14 insertions, 1 deletions
diff --git a/res/values/config.xml b/res/values/config.xml index d5bb131eff..f2d6c21816 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -149,4 +149,5 @@ <integer name="config_recentsMaxThumbnailCacheSize">6</integer> <integer name="config_recentsMaxIconCacheSize">12</integer> + <item name="workspace_page_container" type="id" /> </resources> diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index aaeeb634f3..3a8679e21b 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2328,6 +2328,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, if (isInState(NORMAL)) { shortcutInfos.add(new KeyboardShortcutInfo(getString(R.string.all_apps_button_label), KeyEvent.KEYCODE_A, KeyEvent.META_CTRL_ON)); + shortcutInfos.add(new KeyboardShortcutInfo(getString(R.string.widget_button_text), + KeyEvent.KEYCODE_W, KeyEvent.META_CTRL_ON)); } final View currentFocus = getCurrentFocus(); if (currentFocus != null) { @@ -2376,6 +2378,12 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, return true; } break; + case KeyEvent.KEYCODE_W: + if (isInState(NORMAL)) { + OptionsPopupView.openWidgets(this); + return true; + } + break; } } return super.onKeyShortcut(keyCode, event); diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 66fb3c6b3e..3188e6ecb9 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -547,6 +547,7 @@ public class Workspace extends PagedView<WorkspacePageIndicator> // created CellLayout. CellLayout newScreen = (CellLayout) LayoutInflater.from(getContext()).inflate( R.layout.workspace_screen, this, false /* attachToRoot */); + newScreen.getShortcutsAndWidgets().setId(R.id.workspace_page_container); int paddingLeftRight = mLauncher.getDeviceProfile().cellLayoutPaddingLeftRightPx; int paddingBottom = mLauncher.getDeviceProfile().cellLayoutBottomPaddingPx; newScreen.setPadding(paddingLeftRight, 0, paddingLeftRight, paddingBottom); diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java index c17857f77a..db4c492263 100644 --- a/src/com/android/launcher3/views/OptionsPopupView.java +++ b/src/com/android/launcher3/views/OptionsPopupView.java @@ -153,7 +153,10 @@ public class OptionsPopupView extends ArrowPopup } public static boolean onWidgetsClicked(View view) { - Launcher launcher = Launcher.getLauncher(view.getContext()); + return openWidgets(Launcher.getLauncher(view.getContext())); + } + + public static boolean openWidgets(Launcher launcher) { if (launcher.getPackageManager().isSafeMode()) { Toast.makeText(launcher, R.string.safemode_widget_error, Toast.LENGTH_SHORT).show(); return false; |