diff options
author | Wei Huang <weih@google.com> | 2011-11-18 02:37:31 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-11-18 02:37:31 -0800 |
commit | a536a575c770ed560a478e692d4af7e6e28e696a (patch) | |
tree | 40407db08b1c3fbf71e3225bd19f61d78fd16755 /src | |
parent | d441f560d3e9302af814267b33d5e52e4b54e086 (diff) | |
parent | 4acafbe1b90e3d817ceb6fa965402e49236ca885 (diff) | |
download | android_packages_apps_Snap-a536a575c770ed560a478e692d4af7e6e28e696a.tar.gz android_packages_apps_Snap-a536a575c770ed560a478e692d4af7e6e28e696a.tar.bz2 android_packages_apps_Snap-a536a575c770ed560a478e692d4af7e6e28e696a.zip |
am 71a296c2: Merge "Make sure startAnimation won\'t be called after onPause." into ics-mr1
* commit '71a296c27389fefa9361adada41715ae4623af32':
Make sure startAnimation won't be called after onPause.
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/gallery3d/app/PhotoPage.java | 13 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/SlotView.java | 14 |
2 files changed, 22 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index ec7d16175..5d0fd15c7 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -17,8 +17,8 @@ package com.android.gallery3d.app; import android.app.ActionBar; -import android.app.Activity; import android.app.ActionBar.OnMenuVisibilityListener; +import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; @@ -30,8 +30,8 @@ import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; -import android.view.WindowManager; import android.view.View.MeasureSpec; +import android.view.WindowManager; import android.widget.ShareActionProvider; import android.widget.Toast; @@ -344,6 +344,7 @@ public class PhotoPage extends ActivityState } } + @Override public void onUserInteraction() { showBars(); refreshHidingMessage(); @@ -359,15 +360,21 @@ public class PhotoPage extends ActivityState } } + @Override public void onUserInteractionBegin() { showBars(); mIsInteracting = true; refreshHidingMessage(); } + @Override public void onUserInteractionEnd() { mIsInteracting = false; - refreshHidingMessage(); + + // This function could be called from GL thread (in SlotView.render) + // and post to the main thread. So, it could be executed while the + // activity is paused. + if (mIsActive) refreshHidingMessage(); } @Override diff --git a/src/com/android/gallery3d/ui/SlotView.java b/src/com/android/gallery3d/ui/SlotView.java index a6e94d222..3e0e2f22c 100644 --- a/src/com/android/gallery3d/ui/SlotView.java +++ b/src/com/android/gallery3d/ui/SlotView.java @@ -18,6 +18,7 @@ package com.android.gallery3d.ui; import android.content.Context; import android.graphics.Rect; +import android.os.Handler; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.animation.DecelerateInterpolator; @@ -81,6 +82,7 @@ public class SlotView extends GLView { // whether the down action happened while the view is scrolling. private boolean mDownInScrolling; private int mOverscrollEffect = OVERSCROLL_3D; + private final Handler mHandler; public static final int OVERSCROLL_3D = 0; public static final int OVERSCROLL_SYSTEM = 1; @@ -90,6 +92,7 @@ public class SlotView extends GLView { mGestureDetector = new GestureDetector(context, new MyGestureListener()); mScroller = new ScrollerHelper(context); + mHandler = new Handler(context.getMainLooper()); } public void setCenterIndex(int index) { @@ -323,8 +326,15 @@ public class SlotView extends GLView { } if (more) invalidate(); - if (mMoreAnimation && !more && mUIListener != null) { - mUIListener.onUserInteractionEnd(); + + final UserInteractionListener listener = mUIListener; + if (mMoreAnimation && !more && listener != null) { + mHandler.post(new Runnable() { + @Override + public void run() { + listener.onUserInteractionEnd(); + } + }); } mMoreAnimation = more; } |