Merge changes I2ede15d8,I86a0ffc0,I7c5fdbc7
* changes:
Do not scale down taskbar all apps icons.
Inflate taskbar all apps in abstract slide-in view.
Introduce initial A-Z app drawer to taskbar.
diff --git a/quickstep/res/layout/taskbar_all_apps.xml b/quickstep/res/layout/taskbar_all_apps.xml
new file mode 100644
index 0000000..2848b0f
--- /dev/null
+++ b/quickstep/res/layout/taskbar_all_apps.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 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.
+-->
+<com.android.launcher3.taskbar.TaskbarAllAppsSlideInView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <com.android.launcher3.taskbar.TaskbarAllAppsContainerView
+ android:id="@+id/apps_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:clipChildren="true"
+ android:clipToPadding="false"
+ android:focusable="false"
+ android:saveEnabled="false"
+ android:theme="?attr/allAppsTheme">
+
+ <include
+ layout="@layout/all_apps_rv_layout"
+ android:visibility="gone" />
+
+ <com.android.launcher3.allapps.FloatingHeaderView
+ android:id="@+id/all_apps_header"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/search_container_all_apps"
+ android:clipToPadding="false"
+ android:paddingTop="@dimen/all_apps_header_top_padding"
+ android:orientation="vertical">
+
+ <include layout="@layout/all_apps_personal_work_tabs" />
+ </com.android.launcher3.allapps.FloatingHeaderView>
+
+ <include layout="@layout/all_apps_fast_scroller" />
+ </com.android.launcher3.taskbar.TaskbarAllAppsContainerView>
+</com.android.launcher3.taskbar.TaskbarAllAppsSlideInView>
diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java
index d2ac7c1..4132c68 100644
--- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java
@@ -37,8 +37,8 @@
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.InstanceId;
import com.android.launcher3.logging.InstanceIdSequence;
+import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.ItemInfoWithIcon;
-import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.util.OnboardingPrefs;
import com.android.quickstep.AnimatedFloat;
import com.android.quickstep.RecentsAnimationCallbacks;
@@ -238,7 +238,7 @@
}
@Override
- public void onTaskbarIconLaunched(WorkspaceItemInfo item) {
+ public void onTaskbarIconLaunched(ItemInfo item) {
InstanceId instanceId = new InstanceIdSequence().newInstanceId();
mLauncher.logAppLaunch(mControllers.taskbarActivityContext.getStatsLogManager(), item,
instanceId);
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
index 6a59bc2..abe8aad 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
@@ -64,6 +64,7 @@
import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.logger.LauncherAtom;
+import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.FolderInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
@@ -100,6 +101,7 @@
private final LayoutInflater mLayoutInflater;
private final TaskbarDragLayer mDragLayer;
+ private final TaskbarAllAppsContainerView mAppsView;
private final TaskbarControllers mControllers;
private DeviceProfile mDeviceProfile;
@@ -153,6 +155,11 @@
FrameLayout navButtonsView = mDragLayer.findViewById(R.id.navbuttons_view);
StashedHandleView stashedHandleView = mDragLayer.findViewById(R.id.stashed_handle);
+ TaskbarAllAppsSlideInView appsSlideInView =
+ (TaskbarAllAppsSlideInView) mLayoutInflater.inflate(R.layout.taskbar_all_apps,
+ mDragLayer, false);
+ mAppsView = appsSlideInView.getAppsView();
+
Display display = windowContext.getDisplay();
Context c = display.getDisplayId() == Display.DEFAULT_DISPLAY
? windowContext.getApplicationContext()
@@ -189,7 +196,8 @@
new TaskbarEduController(this),
new TaskbarAutohideSuspendController(this),
new TaskbarPopupController(this),
- new TaskbarForceVisibleImmersiveController(this));
+ new TaskbarForceVisibleImmersiveController(this),
+ new TaskbarAllAppsViewController(this, appsSlideInView));
}
public void init(TaskbarSharedState sharedState) {
@@ -226,6 +234,7 @@
mDeviceProfile.updateIconSize(1, resources);
float iconScale = taskbarIconSize / mDeviceProfile.iconSizePx;
mDeviceProfile.updateIconSize(iconScale, resources);
+ mDeviceProfile.updateAllAppsIconSize(1, resources); // Leave all apps unscaled.
}
/** Creates LayoutParams for adding a view directly to WindowManager as a new window */
@@ -280,6 +289,11 @@
}
@Override
+ public TaskbarAllAppsContainerView getAppsView() {
+ return mAppsView;
+ }
+
+ @Override
public DeviceProfile getDeviceProfile() {
return mDeviceProfile;
}
@@ -619,11 +633,8 @@
String packageName = intent.getPackage();
getSystemService(LauncherApps.class)
.startShortcut(packageName, id, null, null, info.user);
- } else if (info.user.equals(Process.myUserHandle())) {
- startActivity(intent);
} else {
- getSystemService(LauncherApps.class).startMainActivity(
- intent.getComponent(), info.user, intent.getSourceBounds(), null);
+ startItemInfoActivity(info);
}
mControllers.uiController.onTaskbarIconLaunched(info);
@@ -633,6 +644,8 @@
Log.e(TAG, "Unable to launch. tag=" + info + " intent=" + intent, e);
}
}
+ } else if (tag instanceof AppInfo) {
+ startItemInfoActivity((AppInfo) tag);
} else {
Log.e(TAG, "Unknown type clicked: " + tag);
}
@@ -640,6 +653,24 @@
AbstractFloatingView.closeAllOpenViews(this);
}
+ private void startItemInfoActivity(ItemInfo info) {
+ Intent intent = new Intent(info.getIntent())
+ .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ try {
+ if (info.user.equals(Process.myUserHandle())) {
+ // TODO(b/216683257): Use startActivityForResult for search results that require it.
+ startActivity(intent);
+ } else {
+ getSystemService(LauncherApps.class).startMainActivity(
+ intent.getComponent(), info.user, intent.getSourceBounds(), null);
+ }
+ } catch (NullPointerException | ActivityNotFoundException | SecurityException e) {
+ Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT)
+ .show();
+ Log.e(TAG, "Unable to launch. tag=" + info + " intent=" + intent, e);
+ }
+ }
+
/**
* Called when we detect a long press in the nav region before passing the gesture slop.
* @return Whether taskbar handled the long press, and thus should cancel the gesture.
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarAllAppsContainerView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarAllAppsContainerView.java
new file mode 100644
index 0000000..d6eb716
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarAllAppsContainerView.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2022 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.launcher3.taskbar;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.WindowInsets;
+
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.android.launcher3.allapps.AllAppsGridAdapter;
+import com.android.launcher3.allapps.BaseAllAppsContainerView;
+import com.android.launcher3.allapps.search.SearchAdapterProvider;
+
+/** All apps container accessible from taskbar. */
+public class TaskbarAllAppsContainerView extends BaseAllAppsContainerView<TaskbarActivityContext> {
+ public TaskbarAllAppsContainerView(Context context) {
+ this(context, null);
+ }
+
+ public TaskbarAllAppsContainerView(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public TaskbarAllAppsContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ @Override
+ protected SearchAdapterProvider<?> createMainAdapterProvider() {
+ // Task bar all apps does not yet support search, so this implementation is minimal.
+ return new SearchAdapterProvider<TaskbarActivityContext>(mActivityContext) {
+ @Override
+ public boolean launchHighlightedItem() {
+ return false;
+ }
+
+ @Override
+ public View getHighlightedItem() {
+ return null;
+ }
+
+ @Override
+ public RecyclerView.ItemDecoration getDecorator() {
+ return null;
+ }
+
+ @Override
+ public boolean isViewSupported(int viewType) {
+ return false;
+ }
+
+ @Override
+ public void onBindView(AllAppsGridAdapter.ViewHolder holder, int position) { }
+
+ @Override
+ public AllAppsGridAdapter.ViewHolder onCreateViewHolder(LayoutInflater layoutInflater,
+ ViewGroup parent, int viewType) {
+ return null;
+ }
+ };
+ }
+
+ @Override
+ public WindowInsets onApplyWindowInsets(WindowInsets insets) {
+ // TODO(b/204696617): Switch to status bar insets once they work.
+ setInsets(insets.getInsets(WindowInsets.Type.tappableElement()).toRect());
+ return super.onApplyWindowInsets(insets);
+ }
+}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarAllAppsSlideInView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarAllAppsSlideInView.java
new file mode 100644
index 0000000..63690c4
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarAllAppsSlideInView.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2022 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.launcher3.taskbar;
+
+import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE;
+
+import android.animation.PropertyValuesHolder;
+import android.content.Context;
+import android.graphics.Rect;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+
+import com.android.launcher3.Insettable;
+import com.android.launcher3.R;
+import com.android.launcher3.views.AbstractSlideInView;
+
+/** Wrapper for taskbar all apps with slide-in behavior. */
+public class TaskbarAllAppsSlideInView extends
+ AbstractSlideInView<TaskbarActivityContext> implements Insettable {
+
+ private static final int DEFAULT_OPEN_DURATION = 500;
+ private static final int DEFAULT_CLOSE_DURATION = 200;
+
+ private TaskbarAllAppsContainerView mAppsView;
+
+ public TaskbarAllAppsSlideInView(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public TaskbarAllAppsSlideInView(Context context, AttributeSet attrs,
+ int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ /** Opens the all apps view. */
+ public void show() {
+ if (mIsOpen || mOpenCloseAnimator.isRunning()) {
+ return;
+ }
+ mIsOpen = true;
+ attachToContainer();
+
+ mOpenCloseAnimator.setValues(
+ PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED));
+ mOpenCloseAnimator.setInterpolator(AGGRESSIVE_EASE);
+ mOpenCloseAnimator.setDuration(DEFAULT_OPEN_DURATION).start();
+ }
+
+ /** The apps container inside this view. */
+ public TaskbarAllAppsContainerView getAppsView() {
+ return mAppsView;
+ }
+
+ @Override
+ protected void handleClose(boolean animate) {
+ handleClose(animate, DEFAULT_CLOSE_DURATION);
+ }
+
+ @Override
+ protected boolean isOfType(int type) {
+ return (type & TYPE_TASKBAR_ALL_APPS) != 0;
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ mAppsView = findViewById(R.id.apps_view);
+ mContent = mAppsView;
+ }
+
+ @Override
+ protected int getScrimColor(Context context) {
+ return context.getColor(R.color.widgets_picker_scrim);
+ }
+
+ @Override
+ public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
+ if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+ mNoIntercept = !mAppsView.shouldContainerScroll(ev);
+ }
+ return super.onControllerInterceptTouchEvent(ev);
+ }
+
+ @Override
+ public void setInsets(Rect insets) {
+ mAppsView.setInsets(insets);
+ }
+}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarAllAppsViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarAllAppsViewController.java
new file mode 100644
index 0000000..0b53cc2
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarAllAppsViewController.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2022 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.launcher3.taskbar;
+
+import com.android.launcher3.R;
+import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.model.data.AppInfo;
+
+/** Handles the {@link TaskbarAllAppsContainerView} initialization and updates. */
+public final class TaskbarAllAppsViewController {
+
+ private final TaskbarActivityContext mContext;
+ private final TaskbarAllAppsSlideInView mSlideInView;
+ private final TaskbarAllAppsContainerView mAppsView;
+
+ public TaskbarAllAppsViewController(
+ TaskbarActivityContext context, TaskbarAllAppsSlideInView slideInView) {
+ mContext = context;
+ mSlideInView = slideInView;
+ mAppsView = mSlideInView.getAppsView();
+ }
+
+ /** Initialize the controller. */
+ public void init(TaskbarControllers controllers) {
+ if (!FeatureFlags.ENABLE_ALL_APPS_IN_TASKBAR.get()) {
+ return;
+ }
+
+ mAppsView.setOnIconLongClickListener(
+ controllers.taskbarDragController::startDragOnLongClick);
+
+ // TODO(b/205803230): Remove once entry point button is implemented.
+ mContext.getDragLayer().findViewById(R.id.taskbar_view).setOnClickListener(v -> show());
+ }
+
+ /** Binds the current {@link AppInfo} instances to the {@link TaskbarAllAppsContainerView}. */
+ public void setApps(AppInfo[] apps, int flags) {
+ if (FeatureFlags.ENABLE_ALL_APPS_IN_TASKBAR.get()) {
+ mAppsView.getAppsStore().setApps(apps, flags);
+ }
+ }
+
+ /** Opens the {@link TaskbarAllAppsContainerView}. */
+ public void show() {
+ if (FeatureFlags.ENABLE_ALL_APPS_IN_TASKBAR.get()) {
+ mContext.setTaskbarWindowFullscreen(true);
+ mSlideInView.show();
+ }
+ }
+}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
index 8364137..21fbb3b 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
@@ -48,6 +48,7 @@
public final TaskbarAutohideSuspendController taskbarAutohideSuspendController;
public final TaskbarPopupController taskbarPopupController;
public final TaskbarForceVisibleImmersiveController taskbarForceVisibleImmersiveController;
+ public final TaskbarAllAppsViewController taskbarAllAppsViewController;
@Nullable private LoggableTaskbarController[] mControllersToLog = null;
@@ -72,7 +73,8 @@
TaskbarEduController taskbarEduController,
TaskbarAutohideSuspendController taskbarAutoHideSuspendController,
TaskbarPopupController taskbarPopupController,
- TaskbarForceVisibleImmersiveController taskbarForceVisibleImmersiveController) {
+ TaskbarForceVisibleImmersiveController taskbarForceVisibleImmersiveController,
+ TaskbarAllAppsViewController taskbarAllAppsViewController) {
this.taskbarActivityContext = taskbarActivityContext;
this.taskbarDragController = taskbarDragController;
this.navButtonController = navButtonController;
@@ -89,6 +91,7 @@
this.taskbarAutohideSuspendController = taskbarAutoHideSuspendController;
this.taskbarPopupController = taskbarPopupController;
this.taskbarForceVisibleImmersiveController = taskbarForceVisibleImmersiveController;
+ this.taskbarAllAppsViewController = taskbarAllAppsViewController;
}
/**
@@ -112,6 +115,7 @@
taskbarEduController.init(this);
taskbarPopupController.init(this);
taskbarForceVisibleImmersiveController.init(this);
+ taskbarAllAppsViewController.init(this);
mControllersToLog = new LoggableTaskbarController[] {
taskbarDragController, navButtonController, navbarButtonsViewController,
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java
index 3323104..e152915 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java
@@ -182,7 +182,7 @@
dragLayerX,
dragLayerY,
(View target, DropTarget.DragObject d, boolean success) -> {} /* DragSource */,
- (WorkspaceItemInfo) btv.getTag(),
+ (ItemInfo) btv.getTag(),
/* dragVisualizeOffset = */ null,
dragRect,
scale * iconScale,
@@ -289,8 +289,8 @@
Object tag = btv.getTag();
ClipDescription clipDescription = null;
Intent intent = null;
- if (tag instanceof WorkspaceItemInfo) {
- WorkspaceItemInfo item = (WorkspaceItemInfo) tag;
+ if (tag instanceof ItemInfo) {
+ ItemInfo item = (ItemInfo) tag;
LauncherApps launcherApps = mActivity.getSystemService(LauncherApps.class);
clipDescription = new ClipDescription(item.title,
new String[] {
@@ -300,14 +300,15 @@
});
intent = new Intent();
if (item.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
+ String deepShortcutId = ((WorkspaceItemInfo) item).getDeepShortcutId();
intent.putExtra(ClipDescriptionCompat.EXTRA_PENDING_INTENT,
launcherApps.getShortcutIntent(
item.getIntent().getPackage(),
- item.getDeepShortcutId(),
+ deepShortcutId,
null,
item.user));
intent.putExtra(Intent.EXTRA_PACKAGE_NAME, item.getIntent().getPackage());
- intent.putExtra(Intent.EXTRA_SHORTCUT_ID, item.getDeepShortcutId());
+ intent.putExtra(Intent.EXTRA_SHORTCUT_ID, deepShortcutId);
} else {
intent.putExtra(ClipDescriptionCompat.EXTRA_PENDING_INTENT,
LauncherAppsCompat.getMainActivityLaunchIntent(launcherApps,
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarModelCallbacks.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarModelCallbacks.java
index 910752a..2bafccd 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarModelCallbacks.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarModelCallbacks.java
@@ -21,6 +21,7 @@
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.model.BgDataModel;
import com.android.launcher3.model.BgDataModel.FixedContainerItems;
+import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.util.ComponentKey;
@@ -198,6 +199,11 @@
mControllers.taskbarPopupController.setDeepShortcutMap(deepShortcutMapCopy);
}
+ @Override
+ public void bindAllApplications(AppInfo[] apps, int flags) {
+ mControllers.taskbarAllAppsViewController.setApps(apps, flags);
+ }
+
protected void dumpLogs(String prefix, PrintWriter pw) {
pw.println(prefix + "TaskbarModelCallbacks:");
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
index abad906..07b851f 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
@@ -19,8 +19,8 @@
import androidx.annotation.CallSuper;
+import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.ItemInfoWithIcon;
-import com.android.launcher3.model.data.WorkspaceItemInfo;
import java.util.stream.Stream;
@@ -54,7 +54,8 @@
return Stream.empty();
}
- public void onTaskbarIconLaunched(WorkspaceItemInfo item) { }
+ /** Called when an icon is launched. */
+ public void onTaskbarIconLaunched(ItemInfo item) { }
public View getRootView() {
return mControllers.taskbarActivityContext.getDragLayer();
diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java
index e3cfb59..ceb38d0 100644
--- a/src/com/android/launcher3/AbstractFloatingView.java
+++ b/src/com/android/launcher3/AbstractFloatingView.java
@@ -65,7 +65,8 @@
TYPE_ICON_SURFACE,
TYPE_PIN_WIDGET_FROM_EXTERNAL_POPUP,
TYPE_WIDGETS_EDUCATION_DIALOG,
- TYPE_TASKBAR_EDUCATION_DIALOG
+ TYPE_TASKBAR_EDUCATION_DIALOG,
+ TYPE_TASKBAR_ALL_APPS
})
@Retention(RetentionPolicy.SOURCE)
public @interface FloatingViewType {}
@@ -89,19 +90,20 @@
public static final int TYPE_PIN_WIDGET_FROM_EXTERNAL_POPUP = 1 << 14;
public static final int TYPE_WIDGETS_EDUCATION_DIALOG = 1 << 15;
public static final int TYPE_TASKBAR_EDUCATION_DIALOG = 1 << 16;
+ public static final int TYPE_TASKBAR_ALL_APPS = 1 << 17;
public static final int TYPE_ALL = TYPE_FOLDER | TYPE_ACTION_POPUP
| TYPE_WIDGETS_BOTTOM_SHEET | TYPE_WIDGET_RESIZE_FRAME | TYPE_WIDGETS_FULL_SHEET
| TYPE_ON_BOARD_POPUP | TYPE_DISCOVERY_BOUNCE | TYPE_TASK_MENU
| TYPE_OPTIONS_POPUP | TYPE_SNACKBAR | TYPE_LISTENER | TYPE_ALL_APPS_EDU
| TYPE_ICON_SURFACE | TYPE_DRAG_DROP_POPUP | TYPE_PIN_WIDGET_FROM_EXTERNAL_POPUP
- | TYPE_WIDGETS_EDUCATION_DIALOG | TYPE_TASKBAR_EDUCATION_DIALOG;
+ | TYPE_WIDGETS_EDUCATION_DIALOG | TYPE_TASKBAR_EDUCATION_DIALOG | TYPE_TASKBAR_ALL_APPS;
// Type of popups which should be kept open during launcher rebind
public static final int TYPE_REBIND_SAFE = TYPE_WIDGETS_FULL_SHEET
| TYPE_WIDGETS_BOTTOM_SHEET | TYPE_ON_BOARD_POPUP | TYPE_DISCOVERY_BOUNCE
| TYPE_ALL_APPS_EDU | TYPE_ICON_SURFACE | TYPE_WIDGETS_EDUCATION_DIALOG
- | TYPE_TASKBAR_EDUCATION_DIALOG;
+ | TYPE_TASKBAR_EDUCATION_DIALOG | TYPE_TASKBAR_ALL_APPS;
// Usually we show the back button when a floating view is open. Instead, hide for these types.
public static final int TYPE_HIDE_BACK_BUTTON = TYPE_ON_BOARD_POPUP | TYPE_DISCOVERY_BOUNCE
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 572b3c2..1a5b321 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -701,25 +701,7 @@
}
// All apps
- if (numShownAllAppsColumns != inv.numColumns) {
- allAppsIconSizePx =
- pxFromDp(inv.allAppsIconSize[mTypeIndex], mMetrics);
- allAppsIconTextSizePx =
- pxFromSp(inv.allAppsIconTextSize[mTypeIndex], mMetrics);
- allAppsIconDrawablePaddingPx = iconDrawablePaddingOriginalPx;
- autoResizeAllAppsCells();
- } else {
- allAppsIconSizePx = iconSizePx;
- allAppsIconTextSizePx = iconTextSizePx;
- allAppsIconDrawablePaddingPx = iconDrawablePaddingPx;
- allAppsCellHeightPx = getCellSize().y;
- }
- allAppsCellWidthPx = allAppsIconSizePx + (2 * allAppsIconDrawablePaddingPx);
- updateAllAppsWidth(res);
-
- if (isVerticalLayout) {
- hideWorkspaceLabelsIfNotEnoughSpace();
- }
+ updateAllAppsIconSize(scale, res);
// Hotseat
hotseatBorderSpace = pxFromDp(inv.hotseatBorderSpaces[mTypeIndex], mMetrics, scale);
@@ -747,6 +729,34 @@
folderIconOffsetYPx = (iconSizePx - folderIconSizePx) / 2;
}
+
+ /**
+ * Updates the iconSize for allApps* variants.
+ */
+ public void updateAllAppsIconSize(float scale, Resources res) {
+ if (numShownAllAppsColumns != inv.numColumns) {
+ allAppsIconSizePx =
+ pxFromDp(inv.allAppsIconSize[mTypeIndex], mMetrics);
+ allAppsIconTextSizePx =
+ pxFromSp(inv.allAppsIconTextSize[mTypeIndex], mMetrics);
+ allAppsIconDrawablePaddingPx = iconDrawablePaddingOriginalPx;
+ autoResizeAllAppsCells();
+ } else {
+ float invIconSizeDp = inv.iconSize[mTypeIndex];
+ float invIconTextSizeSp = inv.iconTextSize[mTypeIndex];
+ allAppsIconSizePx = Math.max(1, pxFromDp(invIconSizeDp, mMetrics, scale));
+ allAppsIconTextSizePx = (int) (pxFromSp(invIconTextSizeSp, mMetrics) * scale);
+ allAppsIconDrawablePaddingPx = (int) (iconDrawablePaddingOriginalPx * scale);
+ allAppsCellHeightPx = getCellSize().y;
+ }
+
+ allAppsCellWidthPx = allAppsIconSizePx + (2 * allAppsIconDrawablePaddingPx);
+ updateAllAppsWidth(res);
+ if (isVerticalBarLayout()) {
+ hideWorkspaceLabelsIfNotEnoughSpace();
+ }
+ }
+
private void updateAvailableFolderCellDimensions(Resources res) {
updateFolderCellSize(1f, res);
diff --git a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
index 1253863..b257407 100644
--- a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
@@ -249,6 +249,10 @@
* Returns whether the view itself will handle the touch event or not.
*/
public boolean shouldContainerScroll(MotionEvent ev) {
+ // Scroll if not within the container view (e.g. over large-screen scrim).
+ if (!mActivityContext.getDragLayer().isEventOverView(this, ev)) {
+ return true;
+ }
// TODO(b/216203409) Support dragging down from bottom sheet divider, if present.
AllAppsRecyclerView rv = getActiveRecyclerView();
if (rv == null) {
diff --git a/src/com/android/launcher3/views/AbstractSlideInView.java b/src/com/android/launcher3/views/AbstractSlideInView.java
index 8ac40b8..c22d60d 100644
--- a/src/com/android/launcher3/views/AbstractSlideInView.java
+++ b/src/com/android/launcher3/views/AbstractSlideInView.java
@@ -203,6 +203,7 @@
mOpenCloseAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
+ mOpenCloseAnimator.removeListener(this);
onCloseComplete();
}
});