ContentLoadingProgressBar.java 2 KB
package android.support.v4.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ProgressBar;

public class ContentLoadingProgressBar
  extends ProgressBar
{
  long a = -1L;
  boolean b = false;
  boolean c = false;
  boolean d = false;
  private final Runnable e = new Runnable()
  {
    public final void run()
    {
      ContentLoadingProgressBar.this.b = false;
      ContentLoadingProgressBar.this.a = -1L;
      ContentLoadingProgressBar.this.setVisibility(8);
    }
  };
  private final Runnable f = new Runnable()
  {
    public final void run()
    {
      ContentLoadingProgressBar.this.c = false;
      if (!ContentLoadingProgressBar.this.d)
      {
        ContentLoadingProgressBar.this.a = System.currentTimeMillis();
        ContentLoadingProgressBar.this.setVisibility(0);
      }
    }
  };
  
  public ContentLoadingProgressBar(Context paramContext)
  {
    this(paramContext, null);
  }
  
  public ContentLoadingProgressBar(Context paramContext, AttributeSet paramAttributeSet)
  {
    super(paramContext, paramAttributeSet, 0);
  }
  
  private void a()
  {
    removeCallbacks(this.e);
    removeCallbacks(this.f);
  }
  
  public void hide()
  {
    this.d = true;
    removeCallbacks(this.f);
    long l = System.currentTimeMillis() - this.a;
    if ((l >= 500L) || (this.a == -1L)) {
      setVisibility(8);
    }
    while (this.b) {
      return;
    }
    postDelayed(this.e, 500L - l);
    this.b = true;
  }
  
  public void onAttachedToWindow()
  {
    super.onAttachedToWindow();
    a();
  }
  
  public void onDetachedFromWindow()
  {
    super.onDetachedFromWindow();
    a();
  }
  
  public void show()
  {
    this.a = -1L;
    this.d = false;
    removeCallbacks(this.e);
    if (!this.c)
    {
      postDelayed(this.f, 500L);
      this.c = true;
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/widget/ContentLoadingProgressBar.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */