am 8368ef0b: Manual merge of 40080 DO NOT MERGE Properly notifies listener when an animation is cancelled. Bug: #2428005.
Merge commit '8368ef0b670f8193f3161671b119e78b1fb659a1' into eclair-plus-aosp * commit '8368ef0b670f8193f3161671b119e78b1fb659a1': Manual merge of 40080 DO NOT MERGE
This commit is contained in:
@@ -8191,6 +8191,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
|
|||||||
* Cancels any animations for this view.
|
* Cancels any animations for this view.
|
||||||
*/
|
*/
|
||||||
public void clearAnimation() {
|
public void clearAnimation() {
|
||||||
|
if (mCurrentAnimation != null) {
|
||||||
|
mCurrentAnimation.cancel();
|
||||||
|
}
|
||||||
mCurrentAnimation = null;
|
mCurrentAnimation = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -255,6 +255,28 @@ public abstract class Animation implements Cloneable {
|
|||||||
mOneMoreTime = true;
|
mOneMoreTime = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancel the animation. Cancelling an animation invokes the animation
|
||||||
|
* listener, if set, to notify the end of the animation.
|
||||||
|
*
|
||||||
|
* If you cancel an animation manually, you must call {@link #reset()}
|
||||||
|
* before starting the animation again.
|
||||||
|
*
|
||||||
|
* @see #reset()
|
||||||
|
* @see #start()
|
||||||
|
* @see #startNow()
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void cancel() {
|
||||||
|
if (mStarted && !mEnded) {
|
||||||
|
if (mListener != null) mListener.onAnimationEnd(this);
|
||||||
|
mEnded = true;
|
||||||
|
}
|
||||||
|
// Make sure we move the animation to the end
|
||||||
|
mStartTime = Long.MIN_VALUE;
|
||||||
|
mMore = mOneMoreTime = false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the animation has been initialized.
|
* Whether or not the animation has been initialized.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user