Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9edc4e89 authored by Romain Guy's avatar Romain Guy
Browse files

GestureOverlayView was not invalidating itself when calling clear(false)....

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.
parent e7c36dda
Loading
Loading
Loading
Loading
+23 −15
Original line number Diff line number Diff line
@@ -354,19 +354,28 @@ public class GestureOverlayView extends FrameLayout {

    private void clear(boolean animated, boolean fireActionPerformed) {
        setPaintAlpha(255);
        removeCallbacks(mFadingOut);
        mFadingOut.fireActionPerformed = fireActionPerformed;

        if (animated && mCurrentGesture != null) {
            if (mFadeEnabled) {
            mFadingAlpha = 1.0f;
            mIsFadingOut = true;
            mFadingHasStarted = false;
                mFadingOut.fireActionPerformed = fireActionPerformed;
                removeCallbacks(mFadingOut);
            mFadingStart = AnimationUtils.currentAnimationTimeMillis() + mFadeOffset;
            }

            postDelayed(mFadingOut, mFadeOffset);
        } else {
            mPath.rewind();
            mFadingAlpha = 1.0f;
            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) {
                clear(true, mIsGesturing);
                clear(mFadeEnabled, mIsGesturing);
            }
        } else {
            // pass the event to handlers
@@ -650,17 +659,16 @@ public class GestureOverlayView extends FrameLayout {
                    setPaintAlpha((int) (255 * mFadingAlpha));
                    postDelayed(this, FADE_ANIMATION_RATE);
                }

                invalidate();
            } else if (!mFadeEnabled) {
            } else {
                fireOnGesturePerformed();

                mIsFadingOut = false;
                mFadingHasStarted = false;
                mPath.rewind();
                mCurrentGesture = null;
                setPaintAlpha(255);
            }

            invalidate();            
        }
    }