diff options
author | Joe Onorato <joeo@android.com> | 2010-01-06 20:42:25 -0800 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2010-01-11 11:15:08 -0500 |
commit | 6374c51a89678ae02c9bf4dccc17e4aeca6301c5 (patch) | |
tree | 63ccb464cea4f6f0316d964bbb0bed1307fd55a0 /src/com/android/launcher2/AllAppsView.java | |
parent | 8f19cdd62f6e2be05e3890916eabd11317ae1bc2 (diff) | |
download | android_packages_apps_Trebuchet-6374c51a89678ae02c9bf4dccc17e4aeca6301c5.tar.gz android_packages_apps_Trebuchet-6374c51a89678ae02c9bf4dccc17e4aeca6301c5.tar.bz2 android_packages_apps_Trebuchet-6374c51a89678ae02c9bf4dccc17e4aeca6301c5.zip |
Fix bug 2337808 - zoom state gets out of sync when the surface disappears
Diffstat (limited to 'src/com/android/launcher2/AllAppsView.java')
-rw-r--r-- | src/com/android/launcher2/AllAppsView.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java index 4e1d3a138..1d21da892 100644 --- a/src/com/android/launcher2/AllAppsView.java +++ b/src/com/android/launcher2/AllAppsView.java @@ -114,8 +114,10 @@ public class AllAppsView extends RSSurfaceView private boolean mShouldGainFocus; + private boolean mHaveSurface = false; private boolean mZoomDirty = false; private boolean mAnimateNextZoom; + private float mNextZoom; private float mZoom; private float mPosX; private float mVelocity; @@ -191,6 +193,10 @@ public class AllAppsView extends RSSurfaceView super.surfaceDestroyed(holder); // Without this, we leak mMessageCallback which leaks the context. mRS.mMessageCallback = null; + // We may lose any callbacks that are pending, so make sure that we re-sync that + // on the next surfaceChanged. + mZoomDirty = true; + mHaveSurface = false; } @Override @@ -199,6 +205,8 @@ public class AllAppsView extends RSSurfaceView super.surfaceChanged(holder, format, w, h); + mHaveSurface = true; + if (mRollo == null) { mRollo = new RolloRS(); mRollo.init(getResources(), w, h); @@ -633,10 +641,13 @@ public class AllAppsView extends RSSurfaceView */ public void zoom(float zoom, boolean animate) { cancelLongPress(); - if (mRollo == null) { + mNextZoom = zoom; + mAnimateNextZoom = animate; + // if we do setZoom while we don't have a surface, we won't + // get the callbacks that actually set mZoom. + if (mRollo == null || !mHaveSurface) { mZoomDirty = true; mZoom = zoom; - mAnimateNextZoom = animate; return; } else { mRollo.setZoom(zoom, animate); @@ -1040,7 +1051,7 @@ public class AllAppsView extends RSSurfaceView void dirtyCheck() { if (mZoomDirty) { - setZoom(mZoom, mAnimateNextZoom); + setZoom(mNextZoom, mAnimateNextZoom); } } |