diff options
author | Winson Chung <winsonc@google.com> | 2011-10-03 16:31:06 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2011-10-04 11:29:11 -0700 |
commit | a182096cb20e0580dfca6661b2e5871c8886c834 (patch) | |
tree | 6634c1b30211ae7e165143894fdef4d0d431fa3b /src | |
parent | 700eef7bc66687ba626e507d93dcb93f829a5fba (diff) | |
download | android_packages_apps_Trebuchet-a182096cb20e0580dfca6661b2e5871c8886c834.tar.gz android_packages_apps_Trebuchet-a182096cb20e0580dfca6661b2e5871c8886c834.tar.bz2 android_packages_apps_Trebuchet-a182096cb20e0580dfca6661b2e5871c8886c834.zip |
Fixing crash when you are dragging an app and the packages change under you. (Bug: 5280181)
- Removing unused dimension for app icon content size
Change-Id: If3910010577e902937d284296479f9a699516de3
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher2/DragController.java | 17 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 4 | ||||
-rw-r--r-- | src/com/android/launcher2/Utilities.java | 8 |
3 files changed, 20 insertions, 9 deletions
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java index 107f8ef9d..82aa30fef 100644 --- a/src/com/android/launcher2/DragController.java +++ b/src/com/android/launcher2/DragController.java @@ -16,6 +16,8 @@ package com.android.launcher2; +import android.appwidget.AppWidgetManager; +import android.appwidget.AppWidgetProviderInfo; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Rect; @@ -367,6 +369,21 @@ public class DragController { } endDrag(); } + public void onAppsRemoved(ArrayList<ApplicationInfo> apps, Context context) { + // Cancel the current drag if we are removing an app that we are dragging + if (mDragObject != null) { + Object rawDragInfo = mDragObject.dragInfo; + if (rawDragInfo instanceof ShortcutInfo) { + ShortcutInfo dragInfo = (ShortcutInfo) rawDragInfo; + for (ApplicationInfo info : apps) { + if (dragInfo.intent.getComponent().equals(info.intent.getComponent())) { + cancelDrag(); + return; + } + } + } + } + } private void endDrag() { if (mDragging) { diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 83bce6db7..1fbf7a5a6 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -3030,13 +3030,15 @@ public final class Launcher extends Activity mAppsCustomizeContent.removeApps(apps); } updateIconsAffectedByPackageManagerChanges(); + + // Notify the drag controller + mDragController.onAppsRemoved(apps, this); } /** * A number of packages were updated. */ public void bindPackagesUpdated() { - if (mAppsCustomizeContent != null) { mAppsCustomizeContent.onPackagesUpdated(); } diff --git a/src/com/android/launcher2/Utilities.java b/src/com/android/launcher2/Utilities.java index f7f97c590..e5169a206 100644 --- a/src/com/android/launcher2/Utilities.java +++ b/src/com/android/launcher2/Utilities.java @@ -47,7 +47,6 @@ final class Utilities { private static int sIconWidth = -1; private static int sIconHeight = -1; - private static int sIconContentSize = -1; private static int sIconTextureWidth = -1; private static int sIconTextureHeight = -1; @@ -65,10 +64,6 @@ final class Utilities { static int sColors[] = { 0xffff0000, 0xff00ff00, 0xff0000ff }; static int sColorIndex = 0; - static int getIconContentSize() { - return sIconContentSize; - } - /** * Returns a bitmap suitable for the all apps view. Used to convert pre-ICS * icon bitmaps that are stored in the database (which were 74x74 pixels at hdpi size) @@ -242,9 +237,6 @@ final class Utilities { final float density = metrics.density; sIconWidth = sIconHeight = (int) resources.getDimension(R.dimen.app_icon_size); - if (LauncherApplication.isScreenLarge()) { - sIconContentSize = (int) resources.getDimension(R.dimen.app_icon_content_size); - } sIconTextureWidth = sIconTextureHeight = sIconWidth; sBlurPaint.setMaskFilter(new BlurMaskFilter(5 * density, BlurMaskFilter.Blur.NORMAL)); |