cu.java 1.48 KB
import android.view.View;
import android.view.View.OnAttachStateChangeListener;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnPreDrawListener;

final class cu
  implements View.OnAttachStateChangeListener, ViewTreeObserver.OnPreDrawListener
{
  private final View a;
  private ViewTreeObserver b;
  private final Runnable c;
  
  private cu(View paramView, Runnable paramRunnable)
  {
    this.a = paramView;
    this.b = paramView.getViewTreeObserver();
    this.c = paramRunnable;
  }
  
  public static cu a(View paramView, Runnable paramRunnable)
  {
    paramRunnable = new cu(paramView, paramRunnable);
    paramView.getViewTreeObserver().addOnPreDrawListener(paramRunnable);
    paramView.addOnAttachStateChangeListener(paramRunnable);
    return paramRunnable;
  }
  
  private void a()
  {
    if (this.b.isAlive()) {
      this.b.removeOnPreDrawListener(this);
    }
    for (;;)
    {
      this.a.removeOnAttachStateChangeListener(this);
      return;
      this.a.getViewTreeObserver().removeOnPreDrawListener(this);
    }
  }
  
  public final boolean onPreDraw()
  {
    a();
    this.c.run();
    return true;
  }
  
  public final void onViewAttachedToWindow(View paramView)
  {
    this.b = paramView.getViewTreeObserver();
  }
  
  public final void onViewDetachedFromWindow(View paramView)
  {
    a();
  }
}


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