Add WidgetsAndMore bottom sheet
- Contains two rows, one for widgets, and one for "configurable
shortcuts" that have customization activities
- Extends AbstractFloatingView and uses VerticalPullDetector for
touch interactions
- No way to show this currently; will add options to popup in followup
Bug: 34940468
Change-Id: Iab62c2cb89428f91119c9c86f9db886496c321fd
diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java
index bd12686..dbef054 100644
--- a/src/com/android/launcher3/AbstractFloatingView.java
+++ b/src/com/android/launcher3/AbstractFloatingView.java
@@ -16,9 +16,11 @@
package com.android.launcher3;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.support.annotation.IntDef;
import android.util.AttributeSet;
+import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
@@ -32,11 +34,16 @@
*/
public abstract class AbstractFloatingView extends LinearLayout {
- @IntDef(flag = true, value = {TYPE_FOLDER, TYPE_POPUP_CONTAINER_WITH_ARROW})
+ @IntDef(flag = true, value = {
+ TYPE_FOLDER,
+ TYPE_POPUP_CONTAINER_WITH_ARROW,
+ TYPE_WIDGETS_AND_MORE
+ })
@Retention(RetentionPolicy.SOURCE)
public @interface FloatingViewType {}
public static final int TYPE_FOLDER = 1 << 0;
public static final int TYPE_POPUP_CONTAINER_WITH_ARROW = 1 << 1;
+ public static final int TYPE_WIDGETS_AND_MORE = 1 << 2;
protected boolean mIsOpen;
@@ -48,6 +55,15 @@
super(context, attrs, defStyleAttr);
}
+ /**
+ * We need to handle touch events to prevent them from falling through to the workspace below.
+ */
+ @SuppressLint("ClickableViewAccessibility")
+ @Override
+ public boolean onTouchEvent(MotionEvent ev) {
+ return true;
+ }
+
public final void close(boolean animate) {
animate &= !Utilities.isPowerSaverOn(getContext());
handleClose(animate);
@@ -119,7 +135,8 @@
}
public static AbstractFloatingView getTopOpenView(Launcher launcher) {
- return getOpenView(launcher, TYPE_FOLDER | TYPE_POPUP_CONTAINER_WITH_ARROW);
+ return getOpenView(launcher, TYPE_FOLDER | TYPE_POPUP_CONTAINER_WITH_ARROW
+ | TYPE_WIDGETS_AND_MORE);
}
public abstract int getLogContainerType();