diff options
author | Joe Onorato <joeo@google.com> | 2010-02-19 12:51:37 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-02-19 12:51:37 -0800 |
commit | 2c1f3cc0cd42982ac91d7954770820316549844e (patch) | |
tree | 77273524bebd72fe8a3e71579e50fd9055b6b83d | |
parent | 7506dc2633853c56b46ee3f500358ac0e2280f2d (diff) | |
parent | 956091ba7863bd72086275e61084864994dd6fa7 (diff) | |
download | android_packages_apps_Trebuchet-2c1f3cc0cd42982ac91d7954770820316549844e.tar.gz android_packages_apps_Trebuchet-2c1f3cc0cd42982ac91d7954770820316549844e.tar.bz2 android_packages_apps_Trebuchet-2c1f3cc0cd42982ac91d7954770820316549844e.zip |
Merge "fix 2453680 - acore NPE on startup: setWallpaperPosition"
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index de4f0518a..64dfdd99c 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -29,6 +29,7 @@ import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.net.Uri; +import android.os.IBinder; import android.os.Parcelable; import android.os.Parcel; import android.util.AttributeSet; @@ -377,8 +378,11 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag } private void updateWallpaperOffset(int scrollRange) { - mWallpaperManager.setWallpaperOffsetSteps(1.0f / (getChildCount() - 1), 0 ); - mWallpaperManager.setWallpaperOffsets(getWindowToken(), mScrollX / (float) scrollRange, 0); + IBinder token = getWindowToken(); + if (token != null) { + mWallpaperManager.setWallpaperOffsetSteps(1.0f / (getChildCount() - 1), 0 ); + mWallpaperManager.setWallpaperOffsets(getWindowToken(), mScrollX/(float)scrollRange, 0); + } } @Override @@ -435,6 +439,7 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag protected void onAttachedToWindow() { super.onAttachedToWindow(); + computeScroll(); mDragController.setWindowToken(getWindowToken()); } |