GestureOverlayView was not invalidating itself when calling clear(false). Calling clear(true) was working properly. This change also makes clear(false) and clear(true) both behave similarly when fireActionPerformed == true.

This commit is contained in:
Romain Guy
2009-05-25 19:08:31 -07:00
parent e7c36dda7a
commit 9edc4e8930

View File

@@ -354,19 +354,28 @@ public class GestureOverlayView extends FrameLayout {
private void clear(boolean animated, boolean fireActionPerformed) { private void clear(boolean animated, boolean fireActionPerformed) {
setPaintAlpha(255); setPaintAlpha(255);
removeCallbacks(mFadingOut);
mFadingOut.fireActionPerformed = fireActionPerformed;
if (animated && mCurrentGesture != null) { if (animated && mCurrentGesture != null) {
if (mFadeEnabled) { mFadingAlpha = 1.0f;
mFadingAlpha = 1.0f; mIsFadingOut = true;
mIsFadingOut = true; mFadingHasStarted = false;
mFadingHasStarted = false; mFadingStart = AnimationUtils.currentAnimationTimeMillis() + mFadeOffset;
mFadingOut.fireActionPerformed = fireActionPerformed;
removeCallbacks(mFadingOut);
mFadingStart = AnimationUtils.currentAnimationTimeMillis() + mFadeOffset;
}
postDelayed(mFadingOut, mFadeOffset); postDelayed(mFadingOut, mFadeOffset);
} else { } else {
mPath.rewind(); mFadingAlpha = 1.0f;
mCurrentGesture = null; mIsFadingOut = false;
mFadingHasStarted = false;
if (fireActionPerformed) {
post(mFadingOut);
} else {
mCurrentGesture = null;
mPath.rewind();
invalidate();
}
} }
} }
@@ -598,7 +607,7 @@ public class GestureOverlayView extends FrameLayout {
} }
if (mHandleGestureActions) { if (mHandleGestureActions) {
clear(true, mIsGesturing); clear(mFadeEnabled, mIsGesturing);
} }
} else { } else {
// pass the event to handlers // pass the event to handlers
@@ -650,17 +659,16 @@ public class GestureOverlayView extends FrameLayout {
setPaintAlpha((int) (255 * mFadingAlpha)); setPaintAlpha((int) (255 * mFadingAlpha));
postDelayed(this, FADE_ANIMATION_RATE); postDelayed(this, FADE_ANIMATION_RATE);
} }
} else {
invalidate();
} else if (!mFadeEnabled) {
fireOnGesturePerformed(); fireOnGesturePerformed();
mIsFadingOut = false;
mFadingHasStarted = false; mFadingHasStarted = false;
mPath.rewind(); mPath.rewind();
mCurrentGesture = null; mCurrentGesture = null;
setPaintAlpha(255); setPaintAlpha(255);
} }
invalidate();
} }
} }