FragmentCompat.java 4.54 KB
package android.support.v13.app;

import android.annotation.TargetApi;
import android.app.Fragment;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build.VERSION;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
import android.support.v4.os.BuildCompat;
import java.util.Arrays;

@TargetApi(13)
@RequiresApi(13)
public class FragmentCompat
{
  static final b a = new a();
  
  static
  {
    if (BuildCompat.isAtLeastN())
    {
      a = new f();
      return;
    }
    if (Build.VERSION.SDK_INT >= 23)
    {
      a = new e();
      return;
    }
    if (Build.VERSION.SDK_INT >= 15)
    {
      a = new d();
      return;
    }
    if (Build.VERSION.SDK_INT >= 14)
    {
      a = new c();
      return;
    }
  }
  
  public static void requestPermissions(@NonNull Fragment paramFragment, @NonNull String[] paramArrayOfString, int paramInt)
  {
    a.a(paramFragment, paramArrayOfString, paramInt);
  }
  
  public static void setMenuVisibility(Fragment paramFragment, boolean paramBoolean)
  {
    a.a(paramFragment, paramBoolean);
  }
  
  public static void setUserVisibleHint(Fragment paramFragment, boolean paramBoolean)
  {
    a.b(paramFragment, paramBoolean);
  }
  
  public static boolean shouldShowRequestPermissionRationale(@NonNull Fragment paramFragment, @NonNull String paramString)
  {
    return a.a(paramFragment, paramString);
  }
  
  public static abstract interface OnRequestPermissionsResultCallback
  {
    public abstract void onRequestPermissionsResult(int paramInt, @NonNull String[] paramArrayOfString, @NonNull int[] paramArrayOfInt);
  }
  
  static class a
    implements FragmentCompat.b
  {
    public void a(Fragment paramFragment, boolean paramBoolean) {}
    
    public void a(final Fragment paramFragment, final String[] paramArrayOfString, final int paramInt)
    {
      new Handler(Looper.getMainLooper()).post(new Runnable()
      {
        public final void run()
        {
          int[] arrayOfInt = new int[paramArrayOfString.length];
          Object localObject = paramFragment.getActivity();
          if (localObject != null)
          {
            PackageManager localPackageManager = ((Context)localObject).getPackageManager();
            localObject = ((Context)localObject).getPackageName();
            int j = paramArrayOfString.length;
            int i = 0;
            while (i < j)
            {
              arrayOfInt[i] = localPackageManager.checkPermission(paramArrayOfString[i], (String)localObject);
              i += 1;
            }
          }
          Arrays.fill(arrayOfInt, -1);
          ((FragmentCompat.OnRequestPermissionsResultCallback)paramFragment).onRequestPermissionsResult(paramInt, paramArrayOfString, arrayOfInt);
        }
      });
    }
    
    public boolean a(Fragment paramFragment, String paramString)
    {
      return false;
    }
    
    public void b(Fragment paramFragment, boolean paramBoolean) {}
  }
  
  static abstract interface b
  {
    public abstract void a(Fragment paramFragment, boolean paramBoolean);
    
    public abstract void a(Fragment paramFragment, String[] paramArrayOfString, int paramInt);
    
    public abstract boolean a(Fragment paramFragment, String paramString);
    
    public abstract void b(Fragment paramFragment, boolean paramBoolean);
  }
  
  static class c
    extends FragmentCompat.a
  {
    public final void a(Fragment paramFragment, boolean paramBoolean)
    {
      paramFragment.setMenuVisibility(paramBoolean);
    }
  }
  
  static class d
    extends FragmentCompat.c
  {
    public void b(Fragment paramFragment, boolean paramBoolean)
    {
      if (paramFragment.getFragmentManager() != null) {
        paramFragment.setUserVisibleHint(paramBoolean);
      }
    }
  }
  
  static class e
    extends FragmentCompat.d
  {
    public final void a(Fragment paramFragment, String[] paramArrayOfString, int paramInt)
    {
      paramFragment.requestPermissions(paramArrayOfString, paramInt);
    }
    
    public final boolean a(Fragment paramFragment, String paramString)
    {
      return paramFragment.shouldShowRequestPermissionRationale(paramString);
    }
  }
  
  static final class f
    extends FragmentCompat.e
  {
    public final void b(Fragment paramFragment, boolean paramBoolean)
    {
      paramFragment.setUserVisibleHint(paramBoolean);
    }
  }
}


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