diff options
Diffstat (limited to 'src/com/android/launcher/Workspace.java')
-rw-r--r-- | src/com/android/launcher/Workspace.java | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/com/android/launcher/Workspace.java b/src/com/android/launcher/Workspace.java index bc5347e7a..359767aea 100644 --- a/src/com/android/launcher/Workspace.java +++ b/src/com/android/launcher/Workspace.java @@ -26,6 +26,7 @@ import android.graphics.Paint; import android.graphics.RectF; import android.graphics.Rect; import android.graphics.Region; +import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.VelocityTracker; @@ -34,6 +35,7 @@ import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.ViewParent; import android.widget.Scroller; +import android.widget.TextView; import android.os.Parcelable; import android.os.Parcel; @@ -1240,7 +1242,41 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag } } } - + + void updateShortcutsForPackage(String packageName) { + final int count = getChildCount(); + for (int i = 0; i < count; i++) { + final CellLayout layout = (CellLayout) getChildAt(i); + int childCount = layout.getChildCount(); + for (int j = 0; j < childCount; j++) { + final View view = layout.getChildAt(j); + Object tag = view.getTag(); + if (tag instanceof ApplicationInfo) { + ApplicationInfo info = (ApplicationInfo) tag; + // We need to check for ACTION_MAIN otherwise getComponent() might + // return null for some shortcuts (for instance, for shortcuts to + // web pages.) + final Intent intent = info.intent; + final ComponentName name = intent.getComponent(); + if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION && + Intent.ACTION_MAIN.equals(intent.getAction()) && name != null && + packageName.equals(name.getPackageName())) { + + final Drawable icon = Launcher.getModel().getApplicationInfoIcon( + mLauncher.getPackageManager(), info); + if (icon != null && icon != info.icon) { + info.icon.setCallback(null); + info.icon = Utilities.createIconThumbnail(icon, mContext); + info.filtered = true; + ((TextView) view).setCompoundDrawablesWithIntrinsicBounds(null, + info.icon, null, null); + } + } + } + } + } + } + // TODO: remove widgets when appwidgetmanager tells us they're gone // void removeAppWidgetsForProvider() { // } |