FragmentPagerAdapter.java 3.35 KB
package android.support.v13.app;

import android.annotation.TargetApi;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Parcelable;
import android.support.annotation.RequiresApi;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

@TargetApi(13)
@RequiresApi(13)
public abstract class FragmentPagerAdapter
  extends PagerAdapter
{
  private final FragmentManager a;
  private FragmentTransaction b = null;
  private Fragment c = null;
  
  public FragmentPagerAdapter(FragmentManager paramFragmentManager)
  {
    this.a = paramFragmentManager;
  }
  
  private static String a(int paramInt, long paramLong)
  {
    return "android:switcher:" + paramInt + ":" + paramLong;
  }
  
  public void destroyItem(ViewGroup paramViewGroup, int paramInt, Object paramObject)
  {
    if (this.b == null) {
      this.b = this.a.beginTransaction();
    }
    this.b.detach((Fragment)paramObject);
  }
  
  public void finishUpdate(ViewGroup paramViewGroup)
  {
    if (this.b != null)
    {
      this.b.commitAllowingStateLoss();
      this.b = null;
      this.a.executePendingTransactions();
    }
  }
  
  public abstract Fragment getItem(int paramInt);
  
  public long getItemId(int paramInt)
  {
    return paramInt;
  }
  
  public Object instantiateItem(ViewGroup paramViewGroup, int paramInt)
  {
    if (this.b == null) {
      this.b = this.a.beginTransaction();
    }
    long l = getItemId(paramInt);
    Object localObject = a(paramViewGroup.getId(), l);
    localObject = this.a.findFragmentByTag((String)localObject);
    if (localObject != null) {
      this.b.attach((Fragment)localObject);
    }
    for (paramViewGroup = (ViewGroup)localObject;; paramViewGroup = (ViewGroup)localObject)
    {
      if (paramViewGroup != this.c)
      {
        FragmentCompat.setMenuVisibility(paramViewGroup, false);
        FragmentCompat.setUserVisibleHint(paramViewGroup, false);
      }
      return paramViewGroup;
      localObject = getItem(paramInt);
      this.b.add(paramViewGroup.getId(), (Fragment)localObject, a(paramViewGroup.getId(), l));
    }
  }
  
  public boolean isViewFromObject(View paramView, Object paramObject)
  {
    return ((Fragment)paramObject).getView() == paramView;
  }
  
  public void restoreState(Parcelable paramParcelable, ClassLoader paramClassLoader) {}
  
  public Parcelable saveState()
  {
    return null;
  }
  
  public void setPrimaryItem(ViewGroup paramViewGroup, int paramInt, Object paramObject)
  {
    paramViewGroup = (Fragment)paramObject;
    if (paramViewGroup != this.c)
    {
      if (this.c != null)
      {
        FragmentCompat.setMenuVisibility(this.c, false);
        FragmentCompat.setUserVisibleHint(this.c, false);
      }
      if (paramViewGroup != null)
      {
        FragmentCompat.setMenuVisibility(paramViewGroup, true);
        FragmentCompat.setUserVisibleHint(paramViewGroup, true);
      }
      this.c = paramViewGroup;
    }
  }
  
  public void startUpdate(ViewGroup paramViewGroup)
  {
    if (paramViewGroup.getId() == -1) {
      throw new IllegalStateException("ViewPager with adapter " + this + " requires a view id");
    }
  }
}


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