summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/dragndrop/DragLayer.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2017-09-28 13:43:24 -0700
committerSunny Goyal <sunnygoyal@google.com>2017-10-02 16:18:52 -0700
commit37920966888587900885c88a63785cb16567684c (patch)
treed4c0688a9d703afb1099061f2f316ac4752dd0ff /src/com/android/launcher3/dragndrop/DragLayer.java
parent326403e958344751539cefec62ecbc6d28abd2ce (diff)
downloadpackages_apps_Trebuchet-37920966888587900885c88a63785cb16567684c.tar.gz
packages_apps_Trebuchet-37920966888587900885c88a63785cb16567684c.tar.bz2
packages_apps_Trebuchet-37920966888587900885c88a63785cb16567684c.zip
Allowing the widgetBottomSheet to be dragged
even when the touch is started from outside the panel Removing various instanceOf checks in onNewIntent and onBackPress and moving all the corresponding logging in the FloatingView This simplifies handling of panel specific log and avoids missing a particular panel type in the if-else statement. Bug: 64751884 Bug: 64751923 Change-Id: I98f5aae18560a64be73c9efcf495479740d49a00
Diffstat (limited to 'src/com/android/launcher3/dragndrop/DragLayer.java')
-rw-r--r--src/com/android/launcher3/dragndrop/DragLayer.java90
1 files changed, 4 insertions, 86 deletions
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index fde7995ce..60ce3c36a 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -24,13 +24,11 @@ import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
-import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.Region;
import android.support.v4.graphics.ColorUtils;
import android.util.AttributeSet;
import android.view.KeyEvent;
-import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
@@ -42,13 +40,10 @@ import android.widget.FrameLayout;
import android.widget.TextView;
import com.android.launcher3.AbstractFloatingView;
-import com.android.launcher3.AppWidgetResizeFrame;
import com.android.launcher3.CellLayout;
import com.android.launcher3.DropTargetBar;
-import com.android.launcher3.ExtendedEditText;
import com.android.launcher3.InsettableFrameLayout;
import com.android.launcher3.Launcher;
-import com.android.launcher3.LauncherAppWidgetHostView;
import com.android.launcher3.PinchToOverviewListener;
import com.android.launcher3.R;
import com.android.launcher3.ShortcutAndWidgetContainer;
@@ -59,11 +54,9 @@ import com.android.launcher3.dynamicui.WallpaperColorInfo;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.keyboard.ViewGroupFocusHelper;
-import com.android.launcher3.logging.LoggerUtils;
import com.android.launcher3.util.Themes;
import com.android.launcher3.util.Thunk;
import com.android.launcher3.util.TouchController;
-import com.android.launcher3.widget.WidgetsBottomSheet;
import java.util.ArrayList;
@@ -81,10 +74,6 @@ public class DragLayer extends InsettableFrameLayout {
private Launcher mLauncher;
- // Variables relating to resizing widgets
- private final boolean mIsRtl;
- private AppWidgetResizeFrame mCurrentResizeFrame;
-
// Variables relating to animation of views after drop
private ValueAnimator mDropAnim = null;
private final TimeInterpolator mCubicEaseOutInterpolator = new DecelerateInterpolator(1.5f);
@@ -105,7 +94,6 @@ public class DragLayer extends InsettableFrameLayout {
private float mBackgroundAlpha = 0;
// Related to adjacent page hints
- private final Rect mScrollChildPosition = new Rect();
private final ViewGroupFocusHelper mFocusIndicatorHelper;
private final WallpaperColorInfo mWallpaperColorInfo;
@@ -129,7 +117,6 @@ public class DragLayer extends InsettableFrameLayout {
setMotionEventSplittingEnabled(false);
setChildrenDrawingOrderEnabled(true);
- mIsRtl = Utilities.isRtl(getResources());
mFocusIndicatorHelper = new ViewGroupFocusHelper(this);
mWallpaperColorInfo = WallpaperColorInfo.getInstance(getContext());
}
@@ -159,10 +146,6 @@ public class DragLayer extends InsettableFrameLayout {
? null : new PinchToOverviewListener(mLauncher);
}
- public boolean isEventOverPageIndicator(MotionEvent ev) {
- return isEventOverView(mLauncher.getWorkspace().getPageIndicator(), ev);
- }
-
public boolean isEventOverHotseat(MotionEvent ev) {
return isEventOverView(mLauncher.getHotseat(), ev);
}
@@ -180,36 +163,6 @@ public class DragLayer extends InsettableFrameLayout {
return mHitRect.contains((int) ev.getX(), (int) ev.getY());
}
- private boolean handleTouchDown(MotionEvent ev, boolean intercept) {
- AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mLauncher);
- if (topView != null && intercept) {
- ExtendedEditText textView = topView.getActiveTextView();
- if (textView != null) {
- if (!isEventOverView(textView, ev)) {
- textView.dispatchBackKey();
- return true;
- }
- } else if (!isEventOverView(topView, ev)) {
- if (isInAccessibleDrag()) {
- // Do not close the container if in drag and drop.
- if (!isEventOverDropTargetBar(ev)) {
- return true;
- }
- } else {
- mLauncher.getUserEventDispatcher().logActionTapOutside(
- LoggerUtils.newContainerTarget(topView.getLogContainerType()));
- topView.close(true);
-
- // We let touches on the original icon go through so that users can launch
- // the app with one tap if they don't find a shortcut they want.
- View extendedTouch = topView.getExtendedTouchView();
- return extendedTouch == null || !isEventOverView(extendedTouch, ev);
- }
- }
- }
- return false;
- }
-
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
int action = ev.getAction();
@@ -219,9 +172,6 @@ public class DragLayer extends InsettableFrameLayout {
// dray layer even if mAllAppsController is NOT the active controller.
// TODO: handle other input other than touch
mAllAppsController.cancelDiscoveryAnimation();
- if (handleTouchDown(ev, true)) {
- return true;
- }
} else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
if (mTouchCompleteListener != null) {
mTouchCompleteListener.onTouchComplete();
@@ -230,12 +180,10 @@ public class DragLayer extends InsettableFrameLayout {
}
mActiveController = null;
- if (mCurrentResizeFrame != null
- && mCurrentResizeFrame.onControllerInterceptTouchEvent(ev)) {
- mActiveController = mCurrentResizeFrame;
+ AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mLauncher);
+ if (topView != null && topView.onControllerInterceptTouchEvent(ev)) {
+ mActiveController = topView;
return true;
- } else {
- clearResizeFrame();
}
if (mDragController.onControllerInterceptTouchEvent(ev)) {
@@ -248,12 +196,6 @@ public class DragLayer extends InsettableFrameLayout {
return true;
}
- WidgetsBottomSheet widgetsBottomSheet = WidgetsBottomSheet.getOpen(mLauncher);
- if (widgetsBottomSheet != null && widgetsBottomSheet.onControllerInterceptTouchEvent(ev)) {
- mActiveController = widgetsBottomSheet;
- return true;
- }
-
if (mPinchListener != null && mPinchListener.onControllerInterceptTouchEvent(ev)) {
// Stop listening for scrolling etc. (onTouchEvent() handles the rest of the pinch.)
mActiveController = mPinchListener;
@@ -357,12 +299,7 @@ public class DragLayer extends InsettableFrameLayout {
@Override
public boolean onTouchEvent(MotionEvent ev) {
int action = ev.getAction();
-
- if (action == MotionEvent.ACTION_DOWN) {
- if (handleTouchDown(ev, false)) {
- return true;
- }
- } else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
+ if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
if (mTouchCompleteListener != null) {
mTouchCompleteListener.onTouchComplete();
}
@@ -542,25 +479,6 @@ public class DragLayer extends InsettableFrameLayout {
}
}
- public void clearResizeFrame() {
- if (mCurrentResizeFrame != null) {
- removeView(mCurrentResizeFrame);
- mCurrentResizeFrame = null;
- }
- }
-
- public void addResizeFrame(LauncherAppWidgetHostView widget, CellLayout cellLayout) {
- clearResizeFrame();
-
- mCurrentResizeFrame = (AppWidgetResizeFrame) LayoutInflater.from(mLauncher)
- .inflate(R.layout.app_widget_resize_frame, this, false);
- mCurrentResizeFrame.setupForWidget(widget, cellLayout, this);
- ((LayoutParams) mCurrentResizeFrame.getLayoutParams()).customPosition = true;
-
- addView(mCurrentResizeFrame);
- mCurrentResizeFrame.snapToWidget(false);
- }
-
public void animateViewIntoPosition(DragView dragView, final int[] pos, float alpha,
float scaleX, float scaleY, int animationEndStyle, Runnable onFinishRunnable,
int duration) {