From ec25df9fbc685be384f8dd764fa224a4d923e9d8 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 25 May 2009 04:39:37 -0700 Subject: [PATCH] Fix drawing bug: opaque invalidations should not be taken into account when the invalidated view is animating. Also add the ability to disable the auto-fade on the GestureOverlayView. --- api/current.xml | 46 ++++++++++++---- .../android/gesture/GestureOverlayView.java | 52 ++++++++++++++----- core/java/android/view/ViewGroup.java | 3 +- core/res/res/values/attrs.xml | 2 + core/res/res/values/public.xml | 1 + 5 files changed, 79 insertions(+), 25 deletions(-) diff --git a/api/current.xml b/api/current.xml index 94e2bb10d5942..81405899e5d51 100644 --- a/api/current.xml +++ b/api/current.xml @@ -3518,17 +3518,6 @@ visibility="public" > - - + + + + + + + + actionListeners = + mOnGesturePerformedListeners; + final int count = actionListeners.size(); + for (int i = 0; i < count; i++) { + actionListeners.get(i).onGesturePerformed(GestureOverlayView.this, + mCurrentGesture); + } + } + private class FadeOutRunnable implements Runnable { boolean fireActionPerformed; @@ -594,13 +618,7 @@ public class GestureOverlayView extends FrameLayout { if (duration > mFadeDuration) { if (fireActionPerformed) { - final ArrayList actionListeners = - mOnGesturePerformedListeners; - final int count = actionListeners.size(); - for (int i = 0; i < count; i++) { - actionListeners.get(i).onGesturePerformed(GestureOverlayView.this, - mCurrentGesture); - } + fireOnGesturePerformed(); } mIsFadingOut = false; @@ -618,6 +636,14 @@ public class GestureOverlayView extends FrameLayout { } invalidate(); + } else if (!mFadeEnabled) { + fireOnGesturePerformed(); + + mIsFadingOut = false; + mFadingHasStarted = false; + mPath.rewind(); + mCurrentGesture = null; + setPaintAlpha(255); } } } diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index c6f36a05d4254..8b0629cf2b231 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -2351,7 +2351,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager final boolean drawAnimation = (child.mPrivateFlags & DRAW_ANIMATION) == DRAW_ANIMATION; // Check whether the child that requests the invalidate is fully opaque - final boolean isOpaque = child.isOpaque(); + final boolean isOpaque = child.isOpaque() && !drawAnimation && + child.getAnimation() != null; // Mark the child as dirty, using the appropriate flag // Make sure we do not set both flags at the same time final int opaqueFlag = isOpaque ? DIRTY_OPAQUE : DIRTY; diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index e5fa2c50f30eb..b54802b56f15f 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -2107,6 +2107,8 @@ + + diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index e36159d0d17db..621270e8198e5 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -1112,6 +1112,7 @@ +