diff options
-rw-r--r-- | protos/launcher_log.proto | 122 | ||||
-rw-r--r-- | res/drawable/widget_internal_focus_bg.xml | 28 | ||||
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 13 | ||||
-rw-r--r-- | src/com/android/launcher3/LauncherAppWidgetHostView.java | 13 |
4 files changed, 167 insertions, 9 deletions
diff --git a/protos/launcher_log.proto b/protos/launcher_log.proto new file mode 100644 index 000000000..a7b6429e4 --- /dev/null +++ b/protos/launcher_log.proto @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2016 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. + */ +syntax = "proto2"; + +option java_package = "com.android.launcher3.userevent.nano"; +option java_outer_classname = "LauncherLogProto"; + +package userevent; + +message Target { + enum Type { + NONE = 0; + ITEM = 1; + CONTROL = 2; + CONTAINER = 3; + } + + optional Type type = 1; + + // For container type and item type + // Used mainly for ContainerType.FOLDER, ItemType.* + optional Target parent = 2; + optional int32 page_index = 3; + optional int32 rank = 4; + optional int32 grid_x = 5; + optional int32 grid_y = 6; + + // For container types only + optional ContainerType container_type = 7; + optional int32 cardinality = 8; + + // For control types only + optional ControlType control_type = 9; + + // For item types only + optional ItemType item_type = 10; + optional int32 package_name_hash = 11; + optional int32 component_hash = 12; // Used for ItemType.WIDGET + optional int32 intent_hash = 13; // Used for ItemType.SHORTCUT + optional int32 span_x = 14 [default = 1];// Used for ItemType.WIDGET + optional int32 span_y = 15 [default = 1];// Used for ItemType.WIDGET +} + +enum ItemType { + APP_ICON = 0; + SHORTCUT = 1; + WIDGET = 2; + FOLDER_ICON = 3; +} + +enum ContainerType { + WORKSPACE = 0; + HOTSEAT = 1; + FOLDER = 2; + ALLAPPS = 3; + WIDGETS = 4; + OVERVIEW = 5; + PREDICTION = 6; + SEARCHRESULT = 7; +} + +enum ControlType { + ALL_APPS_BUTTON = 0; + WIDGETS_BUTTON = 1; + WALLPAPER_BUTTON = 2; + SETTINGS_BUTTON = 3; + REMOVE_TARGET = 4; + UNINSTALL_TARGET = 5; + APPINFO_TARGET = 6; + RESIZE_HANDLE = 7; + FAST_SCROLL_HANDLE = 8; + // HOME, BACK, GO_TO_PLAYSTORE +} + +message Action { + enum Type { + TOUCH = 0; + AUTOMATED = 1; + // SOFT_KEYBOARD, HARD_KEYBOARD, ASSIST + } + enum Touch { + TAP = 0; + LONGPRESS = 1; + DRAGDROP = 2; + SWIPE = 3; + FLING = 4; + PINCH = 5; + } + optional Type type = 1; + optional Touch touch = 2; +} + +// +// Context free grammar of typical user interaction: +// Action (Touch) + Target +// Action (Touch) + Target + Target +// +message LauncherEvent { + + required Action action = 1; + + // List of targets that touch actions can be operated on. + optional Target src_target = 2; + optional Target dest_target = 3; + + optional int64 action_duration_millis = 4; + optional int64 elapsed_container_millis = 5; + optional int64 elapsed_session_millis = 6; +} diff --git a/res/drawable/widget_internal_focus_bg.xml b/res/drawable/widget_internal_focus_bg.xml new file mode 100644 index 000000000..4d4bea63f --- /dev/null +++ b/res/drawable/widget_internal_focus_bg.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2015, 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. +*/ +--> + +<!-- Used as the widget host view background when giving focus to a child via keyboard. --> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_selected="true"> + <shape android:shape="rectangle"> + <stroke android:color="#fff" android:width="2dp" /> + </shape> + </item> +</selector>
\ No newline at end of file diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index cb2f7d312..414ebb4b1 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1378,11 +1378,14 @@ public class Launcher extends Activity // Setup Apps and Widgets mAppsView = (AllAppsContainerView) findViewById(R.id.apps_view); mWidgetsView = (WidgetsContainerView) findViewById(R.id.widgets_view); - if (mLauncherCallbacks != null && mLauncherCallbacks.getAllAppsSearchBarController() != null) { - mAppsView.setSearchBarController(mLauncherCallbacks.getAllAppsSearchBarController()); - } else { - mAppsView.setSearchBarController(new DefaultAppSearchController()); - } + mAppsView.setSearchBarController(new DefaultAppSearchController()); + + // TODO: Reenable this +// if (mLauncherCallbacks != null && mLauncherCallbacks.getAllAppsSearchBarController() != null) { +// mAppsView.setSearchBarController(mLauncherCallbacks.getAllAppsSearchBarController()); +// } else { +// mAppsView.setSearchBarController(new DefaultAppSearchController()); +// } // Setup the drag controller (drop targets have to be added in reverse order in priority) dragController.setDragScoller(mWorkspace); diff --git a/src/com/android/launcher3/LauncherAppWidgetHostView.java b/src/com/android/launcher3/LauncherAppWidgetHostView.java index 44cd8743d..f659f45f7 100644 --- a/src/com/android/launcher3/LauncherAppWidgetHostView.java +++ b/src/com/android/launcher3/LauncherAppWidgetHostView.java @@ -58,6 +58,8 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mDragLayer = ((Launcher) context).getDragLayer(); setAccessibilityDelegate(LauncherAppState.getInstance().getAccessibilityDelegate()); + + setBackgroundResource(R.drawable.widget_internal_focus_bg); } @Override @@ -242,6 +244,7 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) { if (gainFocus) { mChildrenFocused = false; + dispatchChildFocus(false); } super.onFocusChanged(gainFocus, direction, previouslyFocusedRect); } @@ -250,6 +253,9 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc public void requestChildFocus(View child, View focused) { super.requestChildFocus(child, focused); dispatchChildFocus(focused != null); + if (focused != null) { + focused.setFocusableInTouchMode(false); + } } @Override @@ -263,10 +269,9 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc return mChildrenFocused; } - private void dispatchChildFocus(boolean focused) { - if (getOnFocusChangeListener() != null) { - getOnFocusChangeListener().onFocusChange(this, focused || isFocused()); - } + private void dispatchChildFocus(boolean childIsFocused) { + // The host view's background changes when selected, to indicate the focus is inside. + setSelected(childIsFocused); } @Override |