Add a dummy activity which we can catch on-click in launcher to open allapps/widgets
Change-Id: Idc718a9e03e7358f972c59fcfc3bf2eaf75e56ee
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 347a1d4..1214806 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -236,14 +236,7 @@
public void onClick(View v) {
Object tag = v.getTag();
if (tag instanceof ShortcutInfo) {
- // refactor this code from Folder
- ShortcutInfo item = (ShortcutInfo) tag;
- int[] pos = new int[2];
- v.getLocationOnScreen(pos);
- item.intent.setSourceBounds(new Rect(pos[0], pos[1],
- pos[0] + v.getWidth(), pos[1] + v.getHeight()));
-
- mLauncher.startActivitySafely(v, item.intent, item);
+ mLauncher.onClick(v);
}
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index a5a90d2..664b763 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -2000,6 +2000,12 @@
if (tag instanceof ShortcutInfo) {
// Open shortcut
final Intent intent = ((ShortcutInfo) tag).intent;
+
+ ComponentName widgetComp = new ComponentName(this, WidgetAdder.class);
+ if (intent.getComponent().getClassName().equals(widgetComp.getClassName())) {
+ showAllApps(true);
+ return;
+ }
int[] pos = new int[2];
v.getLocationOnScreen(pos);
intent.setSourceBounds(new Rect(pos[0], pos[1],
diff --git a/src/com/android/launcher3/WidgetAdder.java b/src/com/android/launcher3/WidgetAdder.java
new file mode 100644
index 0000000..79ac504
--- /dev/null
+++ b/src/com/android/launcher3/WidgetAdder.java
@@ -0,0 +1,7 @@
+package com.android.launcher3;
+
+import android.app.Activity;
+
+public class WidgetAdder extends Activity {
+
+}