Fixing issue where shortcuts and widgets were not being removed when the package was uninstalled (Bug 2657997, Bug 6335843)

- Also fixes issue if we are dragging a shortcut/widget and it is removed.
- Also exposes App Info for shortcuts and widgets

Change-Id: I3bd5056f50f20e8b277dde6456df26eac815bcde
This commit is contained in:
Winson Chung
2012-04-27 15:12:38 -07:00
parent 9cfcb39bff
commit 11a4937fbf
7 changed files with 35 additions and 25 deletions

View File

@@ -16,6 +16,7 @@
package com.android.launcher2;
import android.appwidget.AppWidgetProviderInfo;
import android.content.ComponentName;
import android.content.Context;
import android.content.res.ColorStateList;
@@ -62,8 +63,8 @@ public class InfoDropTarget extends ButtonDropTarget {
}
}
private boolean isAllAppsApplication(DragSource source, Object info) {
return (source instanceof AppsCustomizePagedView) && (info instanceof ApplicationInfo);
private boolean isFromAllApps(DragSource source) {
return (source instanceof AppsCustomizePagedView);
}
@Override
@@ -76,6 +77,8 @@ public class InfoDropTarget extends ButtonDropTarget {
componentName = ((ApplicationInfo) d.dragInfo).componentName;
} else if (d.dragInfo instanceof ShortcutInfo) {
componentName = ((ShortcutInfo) d.dragInfo).intent.getComponent();
} else if (d.dragInfo instanceof PendingAddItemInfo) {
componentName = ((PendingAddItemInfo) d.dragInfo).componentName;
}
if (componentName != null) {
mLauncher.startApplicationDetailsActivity(componentName);
@@ -90,8 +93,8 @@ public class InfoDropTarget extends ButtonDropTarget {
public void onDragStart(DragSource source, Object info, int dragAction) {
boolean isVisible = true;
// If we are dragging a widget or shortcut, hide the info target
if (!isAllAppsApplication(source, info)) {
// Hide this button unless we are dragging something from AllApps
if (!isFromAllApps(source)) {
isVisible = false;
}