summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2013-12-13 00:24:05 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-12-13 00:24:06 +0000
commit69a10949d62255f6b32dff8c3a6a91cbfcf98587 (patch)
tree07b0621f6cd018784e521700422bd905f62c0a9c
parent306c1cf200d4e334b19e09a5a5a2026d9f6d12b2 (diff)
parent4de0974c460ce6439cce7931fb0ba945095a4b94 (diff)
downloadandroid_packages_apps_Trebuchet-69a10949d62255f6b32dff8c3a6a91cbfcf98587.zip
android_packages_apps_Trebuchet-69a10949d62255f6b32dff8c3a6a91cbfcf98587.tar.gz
android_packages_apps_Trebuchet-69a10949d62255f6b32dff8c3a6a91cbfcf98587.tar.bz2
Merge "Fix NPE from feedback (issue 12106858)" into jb-ub-now-kermit
-rw-r--r--src/com/android/launcher3/PagedView.java26
-rw-r--r--src/com/android/launcher3/Workspace.java2
2 files changed, 14 insertions, 14 deletions
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index c216f92..1e4f4fa 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -1152,22 +1152,22 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
@Override
protected void dispatchDraw(Canvas canvas) {
- int halfScreenSize = getViewportWidth() / 2;
- // mOverScrollX is equal to getScrollX() when we're within the normal scroll range.
- // Otherwise it is equal to the scaled overscroll position.
- int screenCenter = mOverScrollX + halfScreenSize;
-
- if (screenCenter != mLastScreenCenter || mForceScreenScrolled) {
- // set mForceScreenScrolled before calling screenScrolled so that screenScrolled can
- // set it for the next frame
- mForceScreenScrolled = false;
- screenScrolled(screenCenter);
- mLastScreenCenter = screenCenter;
- }
-
// Find out which screens are visible; as an optimization we only call draw on them
final int pageCount = getChildCount();
if (pageCount > 0) {
+ int halfScreenSize = getViewportWidth() / 2;
+ // mOverScrollX is equal to getScrollX() when we're within the normal scroll range.
+ // Otherwise it is equal to the scaled overscroll position.
+ int screenCenter = mOverScrollX + halfScreenSize;
+
+ if (screenCenter != mLastScreenCenter || mForceScreenScrolled) {
+ // set mForceScreenScrolled before calling screenScrolled so that screenScrolled can
+ // set it for the next frame
+ mForceScreenScrolled = false;
+ screenScrolled(screenCenter);
+ mLastScreenCenter = screenCenter;
+ }
+
getVisiblePages(mTempVisiblePagesRange);
final int leftScreen = mTempVisiblePagesRange[0];
final int rightScreen = mTempVisiblePagesRange[1];
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 2e944a2..9937fc5 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -1657,7 +1657,7 @@ public class Workspace extends SmoothPagedView
cl.setOverscrollTransformsDirty(true);
}
} else {
- if (mOverscrollTransformsSet) {
+ if (mOverscrollTransformsSet && getChildCount() > 0) {
mOverscrollTransformsSet = false;
((CellLayout) getChildAt(0)).resetOverscrollTransforms();
((CellLayout) getChildAt(getChildCount() - 1)).resetOverscrollTransforms();