Ejemplo n.º 1
0
 public String getAnimationInformation(Animatable animatable) {
   if (animatable instanceof AbstractAnimatedDrawable) {
     AbstractAnimatedDrawable animatedDrawable = (AbstractAnimatedDrawable) animatable;
     int animationDuration = animatedDrawable.getDuration();
     int frameCount = animatedDrawable.getFrameCount();
     String loopCountString = getLoopCountString(animatedDrawable);
     return getString(R.string.animation_info, animationDuration, frameCount, loopCountString);
   }
   return getString(R.string.unknown_animation_info);
 }
Ejemplo n.º 2
0
 public boolean tryPausing(Animatable animatable) {
   // AbstractAnimatedDrawable supports pausing, but we could also have a different Animatable
   if (animatable instanceof AbstractAnimatedDrawable) {
     AbstractAnimatedDrawable animatedDrawable = (AbstractAnimatedDrawable) animatable;
     animatedDrawable.pause();
     return true;
   } else {
     Toast.makeText(this, "Could not pause animation", Toast.LENGTH_SHORT).show();
     return false;
   }
 }
Ejemplo n.º 3
0
 private String getLoopCountString(AbstractAnimatedDrawable animatedDrawable) {
   return animatedDrawable.getLoopCount() == AnimatedImage.LOOP_COUNT_INFINITE
       ? getString(R.string.infinite)
       : animatedDrawable.getLoopCount() + "";
 }