summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2011-08-30 16:42:23 -0700
committerJeff Sharkey <jsharkey@android.com>2011-08-30 16:42:44 -0700
commit0d32b317c2d1cacfa5acd34253cc626d6a776ec0 (patch)
tree32e35b18b0560fb941a8385b93e23c148bf1c471 /graphics
parentbe1a0493a8bf589137874bec4222297fbb712185 (diff)
downloadframeworks_base-0d32b317c2d1cacfa5acd34253cc626d6a776ec0.zip
frameworks_base-0d32b317c2d1cacfa5acd34253cc626d6a776ec0.tar.gz
frameworks_base-0d32b317c2d1cacfa5acd34253cc626d6a776ec0.tar.bz2
Accessors for frame count and duration.
Bug: 5233703 Change-Id: If6a758540248dc9bff56b64add04984ebd7b6833
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/drawable/AnimatedRotateDrawable.java25
1 files changed, 18 insertions, 7 deletions
diff --git a/graphics/java/android/graphics/drawable/AnimatedRotateDrawable.java b/graphics/java/android/graphics/drawable/AnimatedRotateDrawable.java
index 94a8488..7c4e147 100644
--- a/graphics/java/android/graphics/drawable/AnimatedRotateDrawable.java
+++ b/graphics/java/android/graphics/drawable/AnimatedRotateDrawable.java
@@ -55,7 +55,7 @@ public class AnimatedRotateDrawable extends Drawable implements Drawable.Callbac
private void init() {
final AnimatedRotateState state = mState;
- mIncrement = 360.0f / (float) state.mFramesCount;
+ mIncrement = 360.0f / state.mFramesCount;
final Drawable drawable = state.mDrawable;
if (drawable != null) {
drawable.setFilterBitmap(true);
@@ -65,6 +65,7 @@ public class AnimatedRotateDrawable extends Drawable implements Drawable.Callbac
}
}
+ @Override
public void draw(Canvas canvas) {
int saveCount = canvas.save();
@@ -146,14 +147,17 @@ public class AnimatedRotateDrawable extends Drawable implements Drawable.Callbac
| mState.mDrawable.getChangingConfigurations();
}
+ @Override
public void setAlpha(int alpha) {
mState.mDrawable.setAlpha(alpha);
}
+ @Override
public void setColorFilter(ColorFilter cf) {
mState.mDrawable.setColorFilter(cf);
}
+ @Override
public int getOpacity() {
return mState.mDrawable.getOpacity();
}
@@ -228,10 +232,10 @@ public class AnimatedRotateDrawable extends Drawable implements Drawable.Callbac
tv = a.peekValue(R.styleable.AnimatedRotateDrawable_pivotY);
final boolean pivotYRel = tv.type == TypedValue.TYPE_FRACTION;
final float pivotY = pivotYRel ? tv.getFraction(1.0f, 1.0f) : tv.getFloat();
-
- final int framesCount = a.getInt(R.styleable.AnimatedRotateDrawable_framesCount, 12);
- final int frameDuration = a.getInt(R.styleable.AnimatedRotateDrawable_frameDuration, 150);
-
+
+ setFramesCount(a.getInt(R.styleable.AnimatedRotateDrawable_framesCount, 12));
+ setFramesDuration(a.getInt(R.styleable.AnimatedRotateDrawable_frameDuration, 150));
+
final int res = a.getResourceId(R.styleable.AnimatedRotateDrawable_drawable, 0);
Drawable drawable = null;
if (res > 0) {
@@ -265,8 +269,6 @@ public class AnimatedRotateDrawable extends Drawable implements Drawable.Callbac
rotateState.mPivotX = pivotX;
rotateState.mPivotYRel = pivotYRel;
rotateState.mPivotY = pivotY;
- rotateState.mFramesCount = framesCount;
- rotateState.mFrameDuration = frameDuration;
init();
@@ -275,6 +277,15 @@ public class AnimatedRotateDrawable extends Drawable implements Drawable.Callbac
}
}
+ public void setFramesCount(int framesCount) {
+ mState.mFramesCount = framesCount;
+ mIncrement = 360.0f / mState.mFramesCount;
+ }
+
+ public void setFramesDuration(int framesDuration) {
+ mState.mFrameDuration = framesDuration;
+ }
+
@Override
public Drawable mutate() {
if (!mMutated && super.mutate() == this) {