Skip to content
This repository
Browse code

Add boot animation preview (1/2)

This change is needed to get notified once the animation is finished.
The usecase would be multipart animations where the first part is shown
once and the second is shown in a loop.

Change-Id: Ibd9c83a4662bef2a866c5bb076d94f49e714dd63
Signed-off-by: Dirk Rettschlag <dirk.rettschlag@gmail.com>
  • Loading branch information...
commit 968d2909bb0794279c254e565ebbb8d3f481481c 1 parent aa12936
Dirk Rettschlag MarcLandis authored
15 graphics/java/android/graphics/drawable/AnimationDrawable.java
@@ -82,6 +82,7 @@
82 82 private final AnimationState mAnimationState;
83 83 private int mCurFrame = -1;
84 84 private boolean mMutated;
  85 + private OnAnimationFinishedListener mOnAnimationFinishedListener;
85 86
86 87 public AnimationDrawable() {
87 88 this(null, null);
@@ -211,6 +212,9 @@ private void nextFrame(boolean unschedule) {
211 212 int next = mCurFrame+1;
212 213 final int N = mAnimationState.getChildCount();
213 214 if (next >= N) {
  215 + if (mOnAnimationFinishedListener != null) {
  216 + mOnAnimationFinishedListener.onAnimationFinished();
  217 + }
214 218 next = 0;
215 219 }
216 220 setFrame(next, unschedule, !mAnimationState.mOneShot || next < (N - 1));
@@ -361,5 +365,16 @@ private AnimationDrawable(AnimationState state, Resources res) {
361 365 setFrame(0, true, false);
362 366 }
363 367 }
  368 +
  369 + // @hide
  370 + public interface OnAnimationFinishedListener
  371 + {
  372 + public void onAnimationFinished();
  373 + }
  374 +
  375 + // @hide
  376 + public void setOnAnimationFinishedListener(OnAnimationFinishedListener l) {
  377 + mOnAnimationFinishedListener = l;
  378 + }
364 379 }
365 380

Git Notes

review

Code-Review+1: Will DeBerry <hillbillyhacker86@gmail.com>
Verified+1: Will DeBerry <hillbillyhacker86@gmail.com>
Code-Review+2: Khas Mek <boushh@gmail.com>
Verified+1: Khas Mek <boushh@gmail.com>
Submitted-by: Khas Mek <boushh@gmail.com>
Submitted-at: Thu, 13 Sep 2012 07:57:14 +0100
Reviewed-on: http://gerrit.sudoservers.com/3235
Project: AOKP/frameworks_base
Branch: refs/heads/jb

0 comments on commit 968d290

Please sign in to comment.
Something went wrong with that request. Please try again.