Adding a horizontal popup when when workspace is longPressed
Change-Id: I5b3c48262c246bfe53e0010ca89c820f42503eef
diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java
index 824040a..12f022f 100644
--- a/src/com/android/launcher3/AbstractFloatingView.java
+++ b/src/com/android/launcher3/AbstractFloatingView.java
@@ -42,9 +42,11 @@
TYPE_WIDGETS_BOTTOM_SHEET,
TYPE_WIDGET_RESIZE_FRAME,
TYPE_WIDGETS_FULL_SHEET,
- TYPE_QUICKSTEP_PREVIEW,
TYPE_ON_BOARD_POPUP,
- TYPE_TASK_MENU
+
+ TYPE_QUICKSTEP_PREVIEW,
+ TYPE_TASK_MENU,
+ TYPE_OPTIONS_POPUP
})
@Retention(RetentionPolicy.SOURCE)
public @interface FloatingViewType {}
@@ -53,17 +55,20 @@
public static final int TYPE_WIDGETS_BOTTOM_SHEET = 1 << 2;
public static final int TYPE_WIDGET_RESIZE_FRAME = 1 << 3;
public static final int TYPE_WIDGETS_FULL_SHEET = 1 << 4;
- public static final int TYPE_QUICKSTEP_PREVIEW = 1 << 5;
- public static final int TYPE_ON_BOARD_POPUP = 1 << 6;
+ public static final int TYPE_ON_BOARD_POPUP = 1 << 5;
+
+ // Popups related to quickstep UI
+ public static final int TYPE_QUICKSTEP_PREVIEW = 1 << 6;
public static final int TYPE_TASK_MENU = 1 << 7;
+ public static final int TYPE_OPTIONS_POPUP = 1 << 8;
public static final int TYPE_ALL = TYPE_FOLDER | TYPE_ACTION_POPUP
| TYPE_WIDGETS_BOTTOM_SHEET | TYPE_WIDGET_RESIZE_FRAME | TYPE_WIDGETS_FULL_SHEET
- | TYPE_QUICKSTEP_PREVIEW | TYPE_ON_BOARD_POPUP | TYPE_TASK_MENU;
+ | TYPE_QUICKSTEP_PREVIEW | TYPE_ON_BOARD_POPUP | TYPE_TASK_MENU | TYPE_OPTIONS_POPUP;
// Type of popups which should be kept open during launcher rebind
public static final int TYPE_REBIND_SAFE = TYPE_WIDGETS_FULL_SHEET
- | TYPE_QUICKSTEP_PREVIEW | TYPE_ON_BOARD_POPUP;
+ | TYPE_QUICKSTEP_PREVIEW | TYPE_ON_BOARD_POPUP | TYPE_OPTIONS_POPUP;
protected boolean mIsOpen;
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 38a3044..32342b2 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -56,6 +56,7 @@
import android.content.pm.PackageManager;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Point;
+import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
@@ -268,7 +269,7 @@
*/
private PendingRequestArgs mPendingRequestArgs;
- private float mLastDispatchTouchEventX = 0.0f;
+ private final PointF mLastDispatchTouchEvent = new PointF();
public ViewGroupFocusHelper mFocusHandler;
private boolean mRotationEnabled = false;
@@ -2013,7 +2014,7 @@
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
- mLastDispatchTouchEventX = ev.getX();
+ mLastDispatchTouchEvent.set(ev.getX(), ev.getY());
return super.dispatchTouchEvent(ev);
}
@@ -2024,7 +2025,7 @@
if (!isInState(NORMAL) && !isInState(OVERVIEW)) return false;
boolean ignoreLongPressToOverview =
- mDeviceProfile.shouldIgnoreLongPressToOverview(mLastDispatchTouchEventX);
+ mDeviceProfile.shouldIgnoreLongPressToOverview(mLastDispatchTouchEvent.x);
if (v instanceof Workspace) {
if (!isInState(OVERVIEW)) {
@@ -2032,7 +2033,7 @@
getUserEventDispatcher().logActionOnContainer(Action.Touch.LONGPRESS,
Action.Direction.NONE, ContainerType.WORKSPACE,
mWorkspace.getCurrentPage());
- UiFactory.onWorkspaceLongPress(this);
+ UiFactory.onWorkspaceLongPress(this, mLastDispatchTouchEvent);
mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
return true;
@@ -2069,7 +2070,7 @@
getUserEventDispatcher().logActionOnContainer(Action.Touch.LONGPRESS,
Action.Direction.NONE, ContainerType.WORKSPACE,
mWorkspace.getCurrentPage());
- UiFactory.onWorkspaceLongPress(this);
+ UiFactory.onWorkspaceLongPress(this, mLastDispatchTouchEvent);
}
mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
diff --git a/src/com/android/launcher3/anim/RevealOutlineAnimation.java b/src/com/android/launcher3/anim/RevealOutlineAnimation.java
index c6b62fa..afb8875 100644
--- a/src/com/android/launcher3/anim/RevealOutlineAnimation.java
+++ b/src/com/android/launcher3/anim/RevealOutlineAnimation.java
@@ -80,4 +80,8 @@
public float getRadius() {
return mOutlineRadius;
}
+
+ public void getOutline(Rect out) {
+ out.set(mOutline);
+ }
}
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index f90abb4..b3ef7bb 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -62,6 +62,7 @@
import com.android.launcher3.Utilities;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
import com.android.launcher3.accessibility.ShortcutMenuAccessibilityDelegate;
+import com.android.launcher3.anim.RevealOutlineAnimation;
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
import com.android.launcher3.badge.BadgeInfo;
import com.android.launcher3.dragndrop.DragController;
@@ -810,10 +811,10 @@
return;
}
mEndRect.setEmpty();
+ if (getOutlineProvider() instanceof RevealOutlineAnimation) {
+ ((RevealOutlineAnimation) getOutlineProvider()).getOutline(mEndRect);
+ }
if (mOpenCloseAnimator != null) {
- Outline outline = new Outline();
- getOutlineProvider().getOutline(this, outline);
- outline.getRect(mEndRect);
mOpenCloseAnimator.cancel();
}
mIsOpen = false;