Loading res/layout/search_result_widget_live.xml 0 → 100644 +5 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <com.android.launcher3.views.SearchResultWidget android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android" android:gravity="center" android:layout_width="match_parent" /> No newline at end of file src/com/android/launcher3/AppWidgetResizeFrame.java +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O private static final Rect sTmpRect = new Rect(); // Represents the cell size on the grid in the two orientations. private static final MainThreadInitializedObject<Point[]> CELL_SIZE = public static final MainThreadInitializedObject<Point[]> CELL_SIZE = new MainThreadInitializedObject<>(c -> { InvariantDeviceProfile inv = LauncherAppState.getIDP(c); return new Point[] {inv.landscapeProfile.getCellSize(), Loading src/com/android/launcher3/Launcher.java +10 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ import com.android.launcher3.allapps.AllAppsContainerView; import com.android.launcher3.allapps.AllAppsStore; import com.android.launcher3.allapps.AllAppsTransitionController; import com.android.launcher3.allapps.DiscoveryBounce; import com.android.launcher3.allapps.search.LiveSearchManager; import com.android.launcher3.anim.PropertyListBuilder; import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.config.FeatureFlags; Loading Loading @@ -276,6 +277,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche private LifecycleRegistry mLifecycleRegistry; private LiveSearchManager mLiveSearchManager; @Thunk Workspace mWorkspace; @Thunk Loading Loading @@ -389,6 +392,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche mIconCache = app.getIconCache(); mAccessibilityDelegate = new LauncherAccessibilityDelegate(this); mLiveSearchManager = new LiveSearchManager(this); mDragController = new DragController(this); mAllAppsController = new AllAppsTransitionController(this); mStateManager = new StateManager<>(this, NORMAL); Loading Loading @@ -492,6 +497,10 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche return mLifecycleRegistry; } public LiveSearchManager getLiveSearchManager() { return mLiveSearchManager; } protected LauncherOverlayManager getDefaultOverlay() { return new LauncherOverlayManager() { }; } Loading Loading @@ -1583,6 +1592,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche mAppTransitionManager.unregisterRemoteAnimations(); mUserChangedCallbackCloseable.close(); mLifecycleRegistry.setCurrentState(Lifecycle.State.DESTROYED); mLiveSearchManager.stop(); } public LauncherAccessibilityDelegate getAccessibilityDelegate() { Loading src/com/android/launcher3/allapps/AllAppsGridAdapter.java +12 −1 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import com.android.launcher3.allapps.search.SearchSectionInfo; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.views.SearchResultWidget; import com.android.systemui.plugins.shared.SearchTarget; import java.util.List; Loading Loading @@ -89,6 +90,8 @@ public class AllAppsGridAdapter extends public static final int VIEW_TYPE_SEARCH_ICON = 1 << 14; public static final int VIEW_TYPE_SEARCH_WIDGET_LIVE = 1 << 15; // Common view type masks public static final int VIEW_TYPE_MASK_DIVIDER = VIEW_TYPE_ALL_APPS_DIVIDER; public static final int VIEW_TYPE_MASK_ICON = VIEW_TYPE_ICON | VIEW_TYPE_SEARCH_ICON; Loading Loading @@ -181,7 +184,8 @@ public class AllAppsGridAdapter extends || viewType == VIEW_TYPE_SEARCH_THUMBNAIL || viewType == VIEW_TYPE_SEARCH_ICON_ROW || viewType == VIEW_TYPE_SEARCH_ICON || viewType == VIEW_TYPE_SEARCH_SUGGEST; || viewType == VIEW_TYPE_SEARCH_SUGGEST || viewType == VIEW_TYPE_SEARCH_WIDGET_LIVE; } } Loading Loading @@ -427,6 +431,9 @@ public class AllAppsGridAdapter extends case VIEW_TYPE_SEARCH_SUGGEST: return new ViewHolder(mLayoutInflater.inflate( R.layout.search_result_suggest, parent, false)); case VIEW_TYPE_SEARCH_WIDGET_LIVE: return new ViewHolder(mLayoutInflater.inflate( R.layout.search_result_widget_live, parent, false)); default: throw new RuntimeException("Unexpected view type"); } Loading Loading @@ -469,6 +476,7 @@ public class AllAppsGridAdapter extends case VIEW_TYPE_SEARCH_PEOPLE: case VIEW_TYPE_SEARCH_THUMBNAIL: case VIEW_TYPE_SEARCH_SUGGEST: case VIEW_TYPE_SEARCH_WIDGET_LIVE: SearchAdapterItem item = (SearchAdapterItem) mApps.getAdapterItems().get(position); SearchTargetHandler payloadResultView = (SearchTargetHandler) holder.itemView; Loading @@ -487,6 +495,9 @@ public class AllAppsGridAdapter extends if (holder.itemView instanceof AllAppsSectionDecorator.SelfDecoratingView) { ((AllAppsSectionDecorator.SelfDecoratingView) holder.itemView).removeDecoration(); } if (holder.itemView instanceof SearchResultWidget) { ((SearchResultWidget) holder.itemView).removeListener(); } } @Override Loading src/com/android/launcher3/allapps/AllAppsTransitionController.java +4 −0 Original line number Diff line number Diff line Loading @@ -264,11 +264,15 @@ public class AllAppsTransitionController implements StateHandler<LauncherState>, if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && BuildCompat.isAtLeastR()) { mInsetController.onAnimationEnd(mProgress); if (Float.compare(mProgress, 0f) == 0) { mLauncher.getLiveSearchManager().start(); EditText editText = mAppsView.getSearchUiManager().getEditText(); if (editText != null) { editText.requestFocus(); } } else { mLauncher.getLiveSearchManager().stop(); } // TODO: should make the controller hide synchronously } } Loading Loading
res/layout/search_result_widget_live.xml 0 → 100644 +5 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <com.android.launcher3.views.SearchResultWidget android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android" android:gravity="center" android:layout_width="match_parent" /> No newline at end of file
src/com/android/launcher3/AppWidgetResizeFrame.java +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O private static final Rect sTmpRect = new Rect(); // Represents the cell size on the grid in the two orientations. private static final MainThreadInitializedObject<Point[]> CELL_SIZE = public static final MainThreadInitializedObject<Point[]> CELL_SIZE = new MainThreadInitializedObject<>(c -> { InvariantDeviceProfile inv = LauncherAppState.getIDP(c); return new Point[] {inv.landscapeProfile.getCellSize(), Loading
src/com/android/launcher3/Launcher.java +10 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ import com.android.launcher3.allapps.AllAppsContainerView; import com.android.launcher3.allapps.AllAppsStore; import com.android.launcher3.allapps.AllAppsTransitionController; import com.android.launcher3.allapps.DiscoveryBounce; import com.android.launcher3.allapps.search.LiveSearchManager; import com.android.launcher3.anim.PropertyListBuilder; import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.config.FeatureFlags; Loading Loading @@ -276,6 +277,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche private LifecycleRegistry mLifecycleRegistry; private LiveSearchManager mLiveSearchManager; @Thunk Workspace mWorkspace; @Thunk Loading Loading @@ -389,6 +392,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche mIconCache = app.getIconCache(); mAccessibilityDelegate = new LauncherAccessibilityDelegate(this); mLiveSearchManager = new LiveSearchManager(this); mDragController = new DragController(this); mAllAppsController = new AllAppsTransitionController(this); mStateManager = new StateManager<>(this, NORMAL); Loading Loading @@ -492,6 +497,10 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche return mLifecycleRegistry; } public LiveSearchManager getLiveSearchManager() { return mLiveSearchManager; } protected LauncherOverlayManager getDefaultOverlay() { return new LauncherOverlayManager() { }; } Loading Loading @@ -1583,6 +1592,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche mAppTransitionManager.unregisterRemoteAnimations(); mUserChangedCallbackCloseable.close(); mLifecycleRegistry.setCurrentState(Lifecycle.State.DESTROYED); mLiveSearchManager.stop(); } public LauncherAccessibilityDelegate getAccessibilityDelegate() { Loading
src/com/android/launcher3/allapps/AllAppsGridAdapter.java +12 −1 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import com.android.launcher3.allapps.search.SearchSectionInfo; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.views.SearchResultWidget; import com.android.systemui.plugins.shared.SearchTarget; import java.util.List; Loading Loading @@ -89,6 +90,8 @@ public class AllAppsGridAdapter extends public static final int VIEW_TYPE_SEARCH_ICON = 1 << 14; public static final int VIEW_TYPE_SEARCH_WIDGET_LIVE = 1 << 15; // Common view type masks public static final int VIEW_TYPE_MASK_DIVIDER = VIEW_TYPE_ALL_APPS_DIVIDER; public static final int VIEW_TYPE_MASK_ICON = VIEW_TYPE_ICON | VIEW_TYPE_SEARCH_ICON; Loading Loading @@ -181,7 +184,8 @@ public class AllAppsGridAdapter extends || viewType == VIEW_TYPE_SEARCH_THUMBNAIL || viewType == VIEW_TYPE_SEARCH_ICON_ROW || viewType == VIEW_TYPE_SEARCH_ICON || viewType == VIEW_TYPE_SEARCH_SUGGEST; || viewType == VIEW_TYPE_SEARCH_SUGGEST || viewType == VIEW_TYPE_SEARCH_WIDGET_LIVE; } } Loading Loading @@ -427,6 +431,9 @@ public class AllAppsGridAdapter extends case VIEW_TYPE_SEARCH_SUGGEST: return new ViewHolder(mLayoutInflater.inflate( R.layout.search_result_suggest, parent, false)); case VIEW_TYPE_SEARCH_WIDGET_LIVE: return new ViewHolder(mLayoutInflater.inflate( R.layout.search_result_widget_live, parent, false)); default: throw new RuntimeException("Unexpected view type"); } Loading Loading @@ -469,6 +476,7 @@ public class AllAppsGridAdapter extends case VIEW_TYPE_SEARCH_PEOPLE: case VIEW_TYPE_SEARCH_THUMBNAIL: case VIEW_TYPE_SEARCH_SUGGEST: case VIEW_TYPE_SEARCH_WIDGET_LIVE: SearchAdapterItem item = (SearchAdapterItem) mApps.getAdapterItems().get(position); SearchTargetHandler payloadResultView = (SearchTargetHandler) holder.itemView; Loading @@ -487,6 +495,9 @@ public class AllAppsGridAdapter extends if (holder.itemView instanceof AllAppsSectionDecorator.SelfDecoratingView) { ((AllAppsSectionDecorator.SelfDecoratingView) holder.itemView).removeDecoration(); } if (holder.itemView instanceof SearchResultWidget) { ((SearchResultWidget) holder.itemView).removeListener(); } } @Override Loading
src/com/android/launcher3/allapps/AllAppsTransitionController.java +4 −0 Original line number Diff line number Diff line Loading @@ -264,11 +264,15 @@ public class AllAppsTransitionController implements StateHandler<LauncherState>, if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && BuildCompat.isAtLeastR()) { mInsetController.onAnimationEnd(mProgress); if (Float.compare(mProgress, 0f) == 0) { mLauncher.getLiveSearchManager().start(); EditText editText = mAppsView.getSearchUiManager().getEditText(); if (editText != null) { editText.requestFocus(); } } else { mLauncher.getLiveSearchManager().stop(); } // TODO: should make the controller hide synchronously } } Loading