summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/widget
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/widget
parent326403e958344751539cefec62ecbc6d28abd2ce (diff)
downloadandroid_packages_apps_Trebuchet-37920966888587900885c88a63785cb16567684c.tar.gz
android_packages_apps_Trebuchet-37920966888587900885c88a63785cb16567684c.tar.bz2
android_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/widget')
-rw-r--r--src/com/android/launcher3/widget/WidgetsBottomSheet.java34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/com/android/launcher3/widget/WidgetsBottomSheet.java b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
index 01101ac74..432efa75e 100644
--- a/src/com/android/launcher3/widget/WidgetsBottomSheet.java
+++ b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
@@ -40,24 +40,23 @@ import com.android.launcher3.LauncherAnimUtils;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
-import com.android.launcher3.touch.SwipeDetector;
import com.android.launcher3.anim.PropertyListBuilder;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.graphics.GradientView;
import com.android.launcher3.model.WidgetItem;
-import com.android.launcher3.userevent.nano.LauncherLogProto;
+import com.android.launcher3.touch.SwipeDetector;
+import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.util.PackageUserKey;
import com.android.launcher3.util.SystemUiController;
import com.android.launcher3.util.Themes;
-import com.android.launcher3.util.TouchController;
import java.util.List;
/**
* Bottom sheet for the "Widgets" system shortcut in the long-press popup.
*/
-public class WidgetsBottomSheet extends AbstractFloatingView implements Insettable, TouchController,
+public class WidgetsBottomSheet extends AbstractFloatingView implements Insettable,
SwipeDetector.Listener, View.OnClickListener, View.OnLongClickListener,
DragController.DragListener {
@@ -242,18 +241,6 @@ public class WidgetsBottomSheet extends AbstractFloatingView implements Insettab
}
@Override
- public int getLogContainerType() {
- return LauncherLogProto.ContainerType.WIDGETS; // TODO: be more specific
- }
-
- /**
- * Returns a {@link WidgetsBottomSheet} which is already open or null
- */
- public static WidgetsBottomSheet getOpen(Launcher launcher) {
- return getOpenView(launcher, TYPE_WIDGETS_BOTTOM_SHEET);
- }
-
- @Override
public void setInsets(Rect insets) {
// Extend behind left, right, and bottom insets.
int leftInset = insets.left - mInsets.left;
@@ -302,12 +289,27 @@ public class WidgetsBottomSheet extends AbstractFloatingView implements Insettab
}
@Override
+ public void logActionCommand(int command) {
+ // TODO: be more specific
+ mLauncher.getUserEventDispatcher().logActionCommand(command, ContainerType.WIDGETS);
+ }
+
+ @Override
public boolean onControllerTouchEvent(MotionEvent ev) {
return mSwipeDetector.onTouchEvent(ev);
}
@Override
public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
+ if (ev.getAction() == MotionEvent.ACTION_UP) {
+ // If we got ACTION_UP without ever returning true on intercept,
+ // the user never started dragging the bottom sheet.
+ if (!mLauncher.getDragLayer().isEventOverView(this, ev)) {
+ close(true);
+ return false;
+ }
+ }
+
int directionsToDetectScroll = mSwipeDetector.isIdleState() ?
SwipeDetector.DIRECTION_NEGATIVE : 0;
mSwipeDetector.setDetectableScrollConditions(