use of android.graphics.drawable.AnimationDrawable in project cw-omnibus by commonsguy.
the class IcsProgressBar method tileifyIndeterminate.
/**
* Convert a AnimationDrawable for use as a barberpole animation.
* Each frame of the animation is wrapped in a ClipDrawable and
* given a tiling BitmapShader.
*/
private Drawable tileifyIndeterminate(Drawable drawable) {
if (drawable instanceof AnimationDrawable) {
AnimationDrawable background = (AnimationDrawable) drawable;
final int N = background.getNumberOfFrames();
AnimationDrawable newBg = new AnimationDrawable();
newBg.setOneShot(background.isOneShot());
for (int i = 0; i < N; i++) {
Drawable frame = tileify(background.getFrame(i), true);
frame.setLevel(10000);
newBg.addFrame(frame, background.getDuration(i));
}
newBg.setLevel(10000);
drawable = newBg;
}
return drawable;
}
use of android.graphics.drawable.AnimationDrawable in project AndroidTraining by mixi-inc.
the class IcsProgressBar method tileifyIndeterminate.
/**
* Convert a AnimationDrawable for use as a barberpole animation.
* Each frame of the animation is wrapped in a ClipDrawable and
* given a tiling BitmapShader.
*/
private Drawable tileifyIndeterminate(Drawable drawable) {
if (drawable instanceof AnimationDrawable) {
AnimationDrawable background = (AnimationDrawable) drawable;
final int N = background.getNumberOfFrames();
AnimationDrawable newBg = new AnimationDrawable();
newBg.setOneShot(background.isOneShot());
for (int i = 0; i < N; i++) {
Drawable frame = tileify(background.getFrame(i), true);
frame.setLevel(10000);
newBg.addFrame(frame, background.getDuration(i));
}
newBg.setLevel(10000);
drawable = newBg;
}
return drawable;
}
use of android.graphics.drawable.AnimationDrawable in project qksms by moezbhatti.
the class ComposeView method updateButtonState.
private void updateButtonState(SendButtonState buttonState) {
if (mButtonState != buttonState) {
// Check if we need to switch animations
AnimationDrawable animation = null;
if (buttonState == SendButtonState.SEND) {
animation = (AnimationDrawable) ContextCompat.getDrawable(mContext, R.drawable.plus_to_arrow);
} else if (mButtonState == SendButtonState.SEND) {
animation = (AnimationDrawable) ContextCompat.getDrawable(mContext, R.drawable.arrow_to_plus);
}
if (animation != null) {
mComposeIcon.setImageDrawable(animation);
animation.start();
}
// Handle any necessary rotation
float rotation = mComposeIcon.getRotation();
float target = buttonState == SendButtonState.ATTACH || buttonState == SendButtonState.SEND ? 0 : 45;
ObjectAnimator.ofFloat(mComposeIcon, "rotation", rotation, target).setDuration(ANIMATION_DURATION).start();
mButtonState = buttonState;
}
}
use of android.graphics.drawable.AnimationDrawable in project android_frameworks_base by ResurrectionRemix.
the class VectorDrawableAnimation method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Button button = new Button(this);
button.setBackgroundResource(R.drawable.animation_drawable_vector);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AnimationDrawable frameAnimation = (AnimationDrawable) v.getBackground();
// Start the animation (looped playback by default).
frameAnimation.start();
}
});
setContentView(button);
}
use of android.graphics.drawable.AnimationDrawable in project android_frameworks_base by DirtyUnicorns.
the class VectorDrawableAnimation method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Button button = new Button(this);
button.setBackgroundResource(R.drawable.animation_drawable_vector);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AnimationDrawable frameAnimation = (AnimationDrawable) v.getBackground();
// Start the animation (looped playback by default).
frameAnimation.start();
}
});
setContentView(button);
}
Aggregations