Temorarily changing the long press action on the homescreen to show a popup menu
Change-Id: If160a2e4d0f73e2e1ecb424a0625d642b8775ada
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 782ddc3..cb63510 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -60,6 +60,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;
@@ -123,6 +124,7 @@
import com.android.launcher3.shortcuts.DeepShortcutManager;
import com.android.launcher3.states.AllAppsState;
import com.android.launcher3.states.InternalStateHandler;
+import com.android.launcher3.uioverrides.UiFactory;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
@@ -2062,11 +2064,16 @@
intent.setPackage(pickerPackage);
}
- intent.setSourceBounds(getViewBounds(v));
+ final Bundle launchOptions;
+ if (v != null) {
+ intent.setSourceBounds(getViewBounds(v));
+ // If there is no target package, use the default intent chooser animation
+ launchOptions = hasTargetPackage ? getActivityLaunchOptions(v) : null;
+ } else {
+ launchOptions = null;
+ }
try {
- startActivityForResult(intent, REQUEST_PICK_WALLPAPER,
- // If there is no target package, use the default intent chooser animation
- hasTargetPackage ? getActivityLaunchOptions(v) : null);
+ startActivityForResult(intent, REQUEST_PICK_WALLPAPER, launchOptions);
} catch (ActivityNotFoundException e) {
setWaitingForResult(null);
Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
@@ -2222,7 +2229,7 @@
getUserEventDispatcher().logActionOnContainer(Action.Touch.LONGPRESS,
Action.Direction.NONE, ContainerType.WORKSPACE,
mWorkspace.getCurrentPage());
- getStateManager().goToState(OVERVIEW);
+ UiFactory.onWorkspaceLongPress(this);
mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
return true;
@@ -2259,7 +2266,7 @@
getUserEventDispatcher().logActionOnContainer(Action.Touch.LONGPRESS,
Action.Direction.NONE, ContainerType.WORKSPACE,
mWorkspace.getCurrentPage());
- getStateManager().goToState(OVERVIEW);
+ UiFactory.onWorkspaceLongPress(this);
}
mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);