AnimatedImageView.java 3.08 KB
package com.instabug.library.internal.view;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.util.AttributeSet;
import android.widget.ImageView;

public class AnimatedImageView
  extends ImageView
{
  private a[] a;
  private Drawable b = null;
  private final Handler c = new Handler();
  private boolean d = false;
  private Thread e;
  private final Runnable f = new Runnable()
  {
    public final void run()
    {
      if (AnimatedImageView.a(AnimatedImageView.this) != null) {
        AnimatedImageView.this.setImageDrawable(AnimatedImageView.a(AnimatedImageView.this));
      }
    }
  };
  
  public AnimatedImageView(Context paramContext)
  {
    super(paramContext);
  }
  
  public AnimatedImageView(Context paramContext, AttributeSet paramAttributeSet)
  {
    super(paramContext, paramAttributeSet);
  }
  
  public void a()
  {
    int i = 1;
    this.d = true;
    if ((this.d) && (this.a != null) && (this.e == null)) {}
    for (;;)
    {
      if (i != 0)
      {
        this.e = new Thread(new b((byte)0));
        this.e.start();
      }
      return;
      i = 0;
    }
  }
  
  public void b()
  {
    this.d = false;
    if (this.e != null)
    {
      this.e.interrupt();
      this.e = null;
    }
  }
  
  public void setFrames(a[] paramArrayOfa)
  {
    this.a = paramArrayOfa;
    try
    {
      this.b = getResources().getDrawable(paramArrayOfa[0].a);
      setImageDrawable(this.b);
      a();
      return;
    }
    catch (OutOfMemoryError paramArrayOfa)
    {
      paramArrayOfa.printStackTrace();
      this.a = null;
    }
  }
  
  public static class a
  {
    public int a;
    public int b;
    
    public a(int paramInt1, int paramInt2)
    {
      this.b = paramInt2;
      this.a = paramInt1;
    }
  }
  
  final class b
    implements Runnable
  {
    private b() {}
    
    public final void run()
    {
      int j = AnimatedImageView.b(AnimatedImageView.this).length;
      for (;;)
      {
        int i = 0;
        label11:
        if (i < j)
        {
          Drawable localDrawable = AnimatedImageView.a(AnimatedImageView.this);
          AnimatedImageView.a(AnimatedImageView.this, AnimatedImageView.this.getResources().getDrawable(AnimatedImageView.b(AnimatedImageView.this)[i].a));
          if (localDrawable != null) {
            localDrawable.setCallback(null);
          }
        }
        try
        {
          Thread.sleep(AnimatedImageView.b(AnimatedImageView.this)[i].b);
          AnimatedImageView.d(AnimatedImageView.this).post(AnimatedImageView.c(AnimatedImageView.this));
          i += 1;
          break label11;
          if (AnimatedImageView.e(AnimatedImageView.this)) {
            continue;
          }
          return;
        }
        catch (InterruptedException localInterruptedException)
        {
          for (;;) {}
        }
      }
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/instabug/library/internal/view/AnimatedImageView.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */