bh.java 6.64 KB
import android.annotation.TargetApi;
import android.support.annotation.RequiresApi;
import android.support.transition.TransitionPort;
import android.support.transition.TransitionPort.TransitionListenerAdapter;
import android.support.v4.util.ArrayMap;
import android.support.v4.view.ViewCompat;
import android.view.View;
import android.view.View.OnAttachStateChangeListener;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnPreDrawListener;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;

@TargetApi(14)
@RequiresApi(14)
final class bh
{
  static TransitionPort a;
  static ArrayList<ViewGroup> b = new ArrayList();
  private static final String[] g = new String[0];
  private static String h = "TransitionManager";
  private static ThreadLocal<WeakReference<ArrayMap<ViewGroup, ArrayList<TransitionPort>>>> i;
  ArrayMap<as, TransitionPort> c = new ArrayMap();
  ArrayMap<as, ArrayMap<as, TransitionPort>> d = new ArrayMap();
  ArrayMap<as, ArrayMap<String, TransitionPort>> e = new ArrayMap();
  ArrayMap<String, ArrayMap<as, TransitionPort>> f = new ArrayMap();
  
  static
  {
    a = new af();
    i = new ThreadLocal();
  }
  
  static ArrayMap<ViewGroup, ArrayList<TransitionPort>> a()
  {
    WeakReference localWeakReference2 = (WeakReference)i.get();
    WeakReference localWeakReference1;
    if (localWeakReference2 != null)
    {
      localWeakReference1 = localWeakReference2;
      if (localWeakReference2.get() != null) {}
    }
    else
    {
      localWeakReference1 = new WeakReference(new ArrayMap());
      i.set(localWeakReference1);
    }
    return (ArrayMap)localWeakReference1.get();
  }
  
  public static void a(ViewGroup paramViewGroup)
  {
    a(paramViewGroup, null);
  }
  
  public static void a(ViewGroup paramViewGroup, TransitionPort paramTransitionPort)
  {
    if ((!b.contains(paramViewGroup)) && (ViewCompat.isLaidOut(paramViewGroup)))
    {
      b.add(paramViewGroup);
      TransitionPort localTransitionPort = paramTransitionPort;
      if (paramTransitionPort == null) {
        localTransitionPort = a;
      }
      paramTransitionPort = localTransitionPort.e();
      c(paramViewGroup, paramTransitionPort);
      as.a(paramViewGroup, null);
      b(paramViewGroup, paramTransitionPort);
    }
  }
  
  public static void a(as paramas)
  {
    a(paramas, a);
  }
  
  static void a(as paramas, TransitionPort paramTransitionPort)
  {
    ViewGroup localViewGroup = paramas.d;
    TransitionPort localTransitionPort = null;
    if (paramTransitionPort != null)
    {
      localTransitionPort = paramTransitionPort.e();
      localTransitionPort.b(localViewGroup);
    }
    paramTransitionPort = as.a(localViewGroup);
    if (paramTransitionPort != null) {
      if (paramTransitionPort.c <= 0) {
        break label69;
      }
    }
    label69:
    for (int j = 1;; j = 0)
    {
      if (j != 0) {
        localTransitionPort.b(true);
      }
      c(localViewGroup, localTransitionPort);
      paramas.b();
      b(localViewGroup, localTransitionPort);
      return;
    }
  }
  
  private static void b(ViewGroup paramViewGroup, TransitionPort paramTransitionPort)
  {
    if ((paramTransitionPort != null) && (paramViewGroup != null))
    {
      paramTransitionPort = new bh.a(paramTransitionPort, paramViewGroup);
      paramViewGroup.addOnAttachStateChangeListener(paramTransitionPort);
      paramViewGroup.getViewTreeObserver().addOnPreDrawListener(paramTransitionPort);
    }
  }
  
  public static void b(as paramas, TransitionPort paramTransitionPort)
  {
    a(paramas, paramTransitionPort);
  }
  
  private static void c(ViewGroup paramViewGroup, TransitionPort paramTransitionPort)
  {
    Object localObject = (ArrayList)a().get(paramViewGroup);
    if ((localObject != null) && (((ArrayList)localObject).size() > 0))
    {
      localObject = ((ArrayList)localObject).iterator();
      while (((Iterator)localObject).hasNext()) {
        ((TransitionPort)((Iterator)localObject).next()).c(paramViewGroup);
      }
    }
    if (paramTransitionPort != null) {
      paramTransitionPort.a(paramViewGroup, true);
    }
    paramViewGroup = as.a(paramViewGroup);
    if (paramViewGroup != null) {
      paramViewGroup.a();
    }
  }
  
  static final class a
    implements View.OnAttachStateChangeListener, ViewTreeObserver.OnPreDrawListener
  {
    TransitionPort a;
    ViewGroup b;
    
    a(TransitionPort paramTransitionPort, ViewGroup paramViewGroup)
    {
      this.a = paramTransitionPort;
      this.b = paramViewGroup;
    }
    
    private void a()
    {
      this.b.getViewTreeObserver().removeOnPreDrawListener(this);
      this.b.removeOnAttachStateChangeListener(this);
    }
    
    public final boolean onPreDraw()
    {
      a();
      bh.b.remove(this.b);
      final ArrayMap localArrayMap = bh.a();
      ArrayList localArrayList = (ArrayList)localArrayMap.get(this.b);
      Object localObject;
      if (localArrayList == null)
      {
        localArrayList = new ArrayList();
        localArrayMap.put(this.b, localArrayList);
        localObject = null;
      }
      for (;;)
      {
        localArrayList.add(this.a);
        this.a.a(new TransitionPort.TransitionListenerAdapter()
        {
          public final void onTransitionEnd(TransitionPort paramAnonymousTransitionPort)
          {
            ((ArrayList)localArrayMap.get(bh.a.this.b)).remove(paramAnonymousTransitionPort);
          }
        });
        this.a.a(this.b, false);
        if (localObject != null)
        {
          localObject = ((ArrayList)localObject).iterator();
          for (;;)
          {
            if (((Iterator)localObject).hasNext())
            {
              ((TransitionPort)((Iterator)localObject).next()).d(this.b);
              continue;
              if (localArrayList.size() <= 0) {
                break label162;
              }
              localObject = new ArrayList(localArrayList);
              break;
            }
          }
        }
        this.a.a(this.b);
        return true;
        label162:
        localObject = null;
      }
    }
    
    public final void onViewAttachedToWindow(View paramView) {}
    
    public final void onViewDetachedFromWindow(View paramView)
    {
      a();
      bh.b.remove(this.b);
      paramView = (ArrayList)bh.a().get(this.b);
      if ((paramView != null) && (paramView.size() > 0))
      {
        paramView = paramView.iterator();
        while (paramView.hasNext()) {
          ((TransitionPort)paramView.next()).d(this.b);
        }
      }
      this.a.a(true);
    }
  }
}


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