diff options
author | Adam Cohen <adamcohen@google.com> | 2012-03-28 19:03:19 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2012-03-28 19:31:59 -0700 |
commit | 2acce88b5fa316e7a314109f9957ad233a6c31a6 (patch) | |
tree | 9c2adfa046a9895ad4c957d34c5e68049129f537 /src/com/android/launcher2/CellLayout.java | |
parent | 4b57851287a8806cad6f836e24c5b835a48c22a9 (diff) | |
download | android_packages_apps_Trebuchet-2acce88b5fa316e7a314109f9957ad233a6c31a6.tar.gz android_packages_apps_Trebuchet-2acce88b5fa316e7a314109f9957ad233a6c31a6.tar.bz2 android_packages_apps_Trebuchet-2acce88b5fa316e7a314109f9957ad233a6c31a6.zip |
Fixing crash when dropping item in hotseat (issue 6246039)
Change-Id: I50ad5439127adbb29423116bf0471a970f62e1bf
Diffstat (limited to 'src/com/android/launcher2/CellLayout.java')
-rw-r--r-- | src/com/android/launcher2/CellLayout.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index fb319fe0c..5aa39c425 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -57,6 +57,7 @@ import java.util.Stack; public class CellLayout extends ViewGroup { static final String TAG = "CellLayout"; + private Launcher mLauncher; private int mOriginalCellWidth; private int mOriginalCellHeight; private int mCellWidth; @@ -175,6 +176,7 @@ public class CellLayout extends ViewGroup { // A ViewGroup usually does not draw, but CellLayout needs to draw a rectangle to show // the user where a dragged item will land when dropped. setWillNotDraw(false); + mLauncher = (Launcher) context; TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CellLayout, defStyle, 0); @@ -2071,11 +2073,14 @@ public class CellLayout extends ViewGroup { View child = mShortcutsAndWidgets.getChildAt(i); LayoutParams lp = (LayoutParams) child.getLayoutParams(); ItemInfo info = (ItemInfo) child.getTag(); - info.cellX = lp.cellX = lp.tmpCellX; - info.cellY = lp.cellY = lp.tmpCellY; + // We do a null check here because the item info can be null in the case of the + // AllApps button in the hotseat. + if (info != null) { + info.cellX = lp.cellX = lp.tmpCellX; + info.cellY = lp.cellY = lp.tmpCellY; + } } - Workspace workspace = (Workspace) getParent(); - workspace.updateItemLocationsInDatabase(this); + mLauncher.getWorkspace().updateItemLocationsInDatabase(this); } public void setUseTempCoords(boolean useTempCoords) { |