summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Dubroy <dubroy@google.com>2011-01-18 17:08:11 -0800
committerPatrick Dubroy <dubroy@google.com>2011-01-18 17:09:51 -0800
commit0dfcf68b58bec1ac74f9b8700e3357f8e6d8b4a3 (patch)
tree3057a1488ac1a893b2279cfabcf81170389cb279
parentf4ffdc63d3d5b400174624f5bb8c41c7ed17265b (diff)
downloadandroid_packages_apps_Trebuchet-0dfcf68b58bec1ac74f9b8700e3357f8e6d8b4a3.tar.gz
android_packages_apps_Trebuchet-0dfcf68b58bec1ac74f9b8700e3357f8e6d8b4a3.tar.bz2
android_packages_apps_Trebuchet-0dfcf68b58bec1ac74f9b8700e3357f8e6d8b4a3.zip
Prevent NPE when shrinking workspace
Change-Id: I61f1793d4db5f3006f2e1bceb0f0c578b35e4e71
-rw-r--r--src/com/android/launcher2/Workspace.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index af7d080a7..f73d01f85 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -1142,25 +1142,30 @@ public class Workspace extends SmoothPagedView
mWaitingToShrinkState = shrinkState;
return;
}
- mIsSmall = true;
- mShrinkState = shrinkState;
-
// Stop any scrolling, move to the current page right away
setCurrentPage((mNextPage != INVALID_PAGE) ? mNextPage : mCurrentPage);
if (!mIsDragInProcess) {
- updateWhichPagesAcceptDrops(mShrinkState);
+ updateWhichPagesAcceptDrops(shrinkState);
}
- // we intercept and reject all touch events when we're small, so be sure to reset the state
- mTouchState = TOUCH_STATE_REST;
- mActivePointerId = INVALID_POINTER;
-
CellLayout currentPage = (CellLayout) getChildAt(mCurrentPage);
+ if (currentPage == null) {
+ Log.w(TAG, "currentPage is NULL! mCurrentPage " + mCurrentPage
+ + " mNextPage " + mNextPage);
+ return;
+ }
if (currentPage.getBackgroundAlphaMultiplier() < 1.0f) {
currentPage.setBackgroundAlpha(0.0f);
}
currentPage.setBackgroundAlphaMultiplier(1.0f);
+ mIsSmall = true;
+ mShrinkState = shrinkState;
+
+ // we intercept and reject all touch events when we're small, so be sure to reset the state
+ mTouchState = TOUCH_STATE_REST;
+ mActivePointerId = INVALID_POINTER;
+
final Resources res = getResources();
final int screenWidth = getWidth();
final int screenHeight = getHeight();