Make sure startAnimation won't be called after onPause. Change-Id: I6c5238394b2ad64e22fbcb250ecd1534da7e8d03 fix: 5629252
diff --git a/src/com/android/gallery3d/ui/SlotView.java b/src/com/android/gallery3d/ui/SlotView.java index a6e94d2..3e0e2f2 100644 --- a/src/com/android/gallery3d/ui/SlotView.java +++ b/src/com/android/gallery3d/ui/SlotView.java
@@ -18,6 +18,7 @@ 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 @@ // 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 @@ mGestureDetector = new GestureDetector(context, new MyGestureListener()); mScroller = new ScrollerHelper(context); + mHandler = new Handler(context.getMainLooper()); } public void setCenterIndex(int index) { @@ -323,8 +326,15 @@ } 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; }