Ejemplo n.º 1
0
 public void startGifFromAsset(String assetPath, boolean loop) {
   try {
     if (gifDrawable == null) {
       InputStream stream = getContext().getAssets().open(assetPath);
       gifDrawable = new GifAnimationDrawable(stream);
     }
     setImageDrawable(gifDrawable);
     gifDrawable.startAnimation(loop);
   } catch (Exception ex) {
     ex.printStackTrace();
   }
 }
Ejemplo n.º 2
0
 public void startGifFromDrawable(int GifID, boolean loop) {
   try {
     if (gifDrawable == null) {
       InputStream is =
           FormatBitmapTools.getInstance()
               .Bitmap2InputStream(BitmapFactory.decodeResource(getResources(), GifID));
       gifDrawable = new GifAnimationDrawable(is);
     }
     setImageDrawable(gifDrawable);
     gifDrawable.startAnimation(loop);
   } catch (Exception e) {
     // TODO: handle exception
     e.printStackTrace();
   }
 }
Ejemplo n.º 3
0
 public void stopGIF() {
   if (gifDrawable != null) gifDrawable.stop();
 }