Add a dummy activity which we can catch on-click in launcher to open allapps/widgets
Change-Id: Idc718a9e03e7358f972c59fcfc3bf2eaf75e56ee
This commit is contained in:
parent
9efb412971
commit
b5fe60c8a5
|
@ -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"
|
||||
|
|
|
@ -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 & hold to pick up a widget.</string>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package com.android.launcher3;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
public class WidgetAdder extends Activity {
|
||||
|
||||
}
|
Loading…
Reference in New Issue