Bug 760708 - Add ability to remove homescreen shortcuts. r=mfinkle
This commit is contained in:
@@ -808,6 +808,35 @@ public class GeckoAppShell
|
||||
});
|
||||
}
|
||||
|
||||
public static void removeShortcut(final String aTitle, final String aURI, final String aType) {
|
||||
getHandler().post(new Runnable() {
|
||||
public void run() {
|
||||
Log.w(LOGTAG, "removeShortcut for " + aURI + " [" + aTitle + "] > " + aType);
|
||||
|
||||
// the intent to be launched by the shortcut
|
||||
Intent shortcutIntent = new Intent();
|
||||
if (aType.equalsIgnoreCase(SHORTCUT_TYPE_WEBAPP)) {
|
||||
shortcutIntent.setAction(GeckoApp.ACTION_WEBAPP);
|
||||
} else {
|
||||
shortcutIntent.setAction(GeckoApp.ACTION_BOOKMARK);
|
||||
}
|
||||
shortcutIntent.setData(Uri.parse(aURI));
|
||||
shortcutIntent.setClassName(GeckoApp.mAppContext,
|
||||
GeckoApp.mAppContext.getPackageName() + ".App");
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
|
||||
if (aTitle != null)
|
||||
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, aTitle);
|
||||
else
|
||||
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, aURI);
|
||||
|
||||
intent.setAction("com.android.launcher.action.UNINSTALL_SHORTCUT");
|
||||
GeckoApp.mAppContext.sendBroadcast(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static private Bitmap getLauncherIcon(Bitmap aSource, String aType) {
|
||||
final int kOffset = 6;
|
||||
final int kRadius = 5;
|
||||
|
||||
Reference in New Issue
Block a user