Add a dummy activity which we can catch on-click in launcher to open allapps/widgets

Change-Id: Idc718a9e03e7358f972c59fcfc3bf2eaf75e56ee
This commit is contained in:
Adam Cohen 2013-06-06 22:03:51 -07:00
parent 9efb412971
commit b5fe60c8a5
5 changed files with 27 additions and 8 deletions

View File

@ -82,6 +82,17 @@
</intent-filter>
</activity>
<activity
android:name="com.android.launcher3.WidgetAdder"
android:label="@string/widget_adder"
android:icon="@mipmap/ic_launcher_home">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.android.launcher3.WallpaperChooser"
android:theme="@style/Theme.WallpaperPicker"

View File

@ -39,6 +39,8 @@
<!-- Labels for the tabs in the customize drawer -->
<string name="widgets_tab_label">Widgets</string>
<string name="widget_adder">Widgets</string>
<!-- AppsCustomize pane -->
<!-- Message to tell the user to press and hold on a widget to add it [CHAR_LIMIT=50] -->
<string name="long_press_widget_to_add">Touch &amp; hold to pick up a widget.</string>

View File

@ -236,14 +236,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
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);
}
}

View File

@ -2000,6 +2000,12 @@ public final class Launcher extends Activity
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],

View File

@ -0,0 +1,7 @@
package com.android.launcher3;
import android.app.Activity;
public class WidgetAdder extends Activity {
}