ActivityCompat.java 9.67 KB
package android.support.v4.app;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.content.IntentSender.SendIntentException;
import android.content.pm.PackageManager;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.net.Uri;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Parcelable;
import android.support.annotation.IntRange;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.view.View;
import java.util.List;
import java.util.Map;

public class ActivityCompat
  extends ContextCompat
{
  private static ActivityCompatApi21.SharedElementCallback21 a(SharedElementCallback paramSharedElementCallback)
  {
    a locala = null;
    if (paramSharedElementCallback != null) {
      locala = new a(paramSharedElementCallback);
    }
    return locala;
  }
  
  private static ActivityCompatApi23.SharedElementCallback23 b(SharedElementCallback paramSharedElementCallback)
  {
    b localb = null;
    if (paramSharedElementCallback != null) {
      localb = new b(paramSharedElementCallback);
    }
    return localb;
  }
  
  public static void finishAffinity(Activity paramActivity)
  {
    if (Build.VERSION.SDK_INT >= 16)
    {
      paramActivity.finishAffinity();
      return;
    }
    paramActivity.finish();
  }
  
  public static void finishAfterTransition(Activity paramActivity)
  {
    if (Build.VERSION.SDK_INT >= 21)
    {
      paramActivity.finishAfterTransition();
      return;
    }
    paramActivity.finish();
  }
  
  @Nullable
  public static Uri getReferrer(Activity paramActivity)
  {
    if (Build.VERSION.SDK_INT >= 22) {
      paramActivity = paramActivity.getReferrer();
    }
    Intent localIntent;
    Uri localUri;
    do
    {
      return paramActivity;
      localIntent = paramActivity.getIntent();
      localUri = (Uri)localIntent.getParcelableExtra("android.intent.extra.REFERRER");
      paramActivity = localUri;
    } while (localUri != null);
    paramActivity = localIntent.getStringExtra("android.intent.extra.REFERRER_NAME");
    if (paramActivity != null) {
      return Uri.parse(paramActivity);
    }
    return null;
  }
  
  public static boolean invalidateOptionsMenu(Activity paramActivity)
  {
    if (Build.VERSION.SDK_INT >= 11)
    {
      paramActivity.invalidateOptionsMenu();
      return true;
    }
    return false;
  }
  
  public static void postponeEnterTransition(Activity paramActivity)
  {
    if (Build.VERSION.SDK_INT >= 21) {
      paramActivity.postponeEnterTransition();
    }
  }
  
  public static void requestPermissions(@NonNull final Activity paramActivity, @NonNull String[] paramArrayOfString, @IntRange(from=0L) final int paramInt)
  {
    if (Build.VERSION.SDK_INT >= 23)
    {
      if ((paramActivity instanceof ActivityCompatApi23.RequestPermissionsRequestCodeValidator)) {
        ((ActivityCompatApi23.RequestPermissionsRequestCodeValidator)paramActivity).validateRequestPermissionsRequestCode(paramInt);
      }
      paramActivity.requestPermissions(paramArrayOfString, paramInt);
    }
    while (!(paramActivity instanceof OnRequestPermissionsResultCallback)) {
      return;
    }
    new Handler(Looper.getMainLooper()).post(new Runnable()
    {
      public final void run()
      {
        int[] arrayOfInt = new int[this.a.length];
        PackageManager localPackageManager = paramActivity.getPackageManager();
        String str = paramActivity.getPackageName();
        int j = this.a.length;
        int i = 0;
        while (i < j)
        {
          arrayOfInt[i] = localPackageManager.checkPermission(this.a[i], str);
          i += 1;
        }
        ((ActivityCompat.OnRequestPermissionsResultCallback)paramActivity).onRequestPermissionsResult(paramInt, this.a, arrayOfInt);
      }
    });
  }
  
  public static void setEnterSharedElementCallback(Activity paramActivity, SharedElementCallback paramSharedElementCallback)
  {
    if (Build.VERSION.SDK_INT >= 23) {
      paramActivity.setEnterSharedElementCallback(ActivityCompatApi23.a(b(paramSharedElementCallback)));
    }
    while (Build.VERSION.SDK_INT < 21) {
      return;
    }
    paramActivity.setEnterSharedElementCallback(ActivityCompatApi21.a(a(paramSharedElementCallback)));
  }
  
  public static void setExitSharedElementCallback(Activity paramActivity, SharedElementCallback paramSharedElementCallback)
  {
    if (Build.VERSION.SDK_INT >= 23) {
      paramActivity.setExitSharedElementCallback(ActivityCompatApi23.a(b(paramSharedElementCallback)));
    }
    while (Build.VERSION.SDK_INT < 21) {
      return;
    }
    paramActivity.setExitSharedElementCallback(ActivityCompatApi21.a(a(paramSharedElementCallback)));
  }
  
  public static boolean shouldShowRequestPermissionRationale(@NonNull Activity paramActivity, @NonNull String paramString)
  {
    if (Build.VERSION.SDK_INT >= 23) {
      return paramActivity.shouldShowRequestPermissionRationale(paramString);
    }
    return false;
  }
  
  public static void startActivityForResult(Activity paramActivity, Intent paramIntent, int paramInt, @Nullable Bundle paramBundle)
  {
    if (Build.VERSION.SDK_INT >= 16)
    {
      paramActivity.startActivityForResult(paramIntent, paramInt, paramBundle);
      return;
    }
    paramActivity.startActivityForResult(paramIntent, paramInt);
  }
  
  public static void startIntentSenderForResult(Activity paramActivity, IntentSender paramIntentSender, int paramInt1, Intent paramIntent, int paramInt2, int paramInt3, int paramInt4, @Nullable Bundle paramBundle)
    throws IntentSender.SendIntentException
  {
    if (Build.VERSION.SDK_INT >= 16)
    {
      paramActivity.startIntentSenderForResult(paramIntentSender, paramInt1, paramIntent, paramInt2, paramInt3, paramInt4, paramBundle);
      return;
    }
    paramActivity.startIntentSenderForResult(paramIntentSender, paramInt1, paramIntent, paramInt2, paramInt3, paramInt4);
  }
  
  public static void startPostponedEnterTransition(Activity paramActivity)
  {
    if (Build.VERSION.SDK_INT >= 21) {
      paramActivity.startPostponedEnterTransition();
    }
  }
  
  public static abstract interface OnRequestPermissionsResultCallback
  {
    public abstract void onRequestPermissionsResult(int paramInt, @NonNull String[] paramArrayOfString, @NonNull int[] paramArrayOfInt);
  }
  
  static final class a
    extends ActivityCompatApi21.SharedElementCallback21
  {
    private SharedElementCallback a;
    
    public a(SharedElementCallback paramSharedElementCallback)
    {
      this.a = paramSharedElementCallback;
    }
    
    public final Parcelable onCaptureSharedElementSnapshot(View paramView, Matrix paramMatrix, RectF paramRectF)
    {
      return this.a.onCaptureSharedElementSnapshot(paramView, paramMatrix, paramRectF);
    }
    
    public final View onCreateSnapshotView(Context paramContext, Parcelable paramParcelable)
    {
      return this.a.onCreateSnapshotView(paramContext, paramParcelable);
    }
    
    public final void onMapSharedElements(List<String> paramList, Map<String, View> paramMap)
    {
      this.a.onMapSharedElements(paramList, paramMap);
    }
    
    public final void onRejectSharedElements(List<View> paramList)
    {
      this.a.onRejectSharedElements(paramList);
    }
    
    public final void onSharedElementEnd(List<String> paramList, List<View> paramList1, List<View> paramList2)
    {
      this.a.onSharedElementEnd(paramList, paramList1, paramList2);
    }
    
    public final void onSharedElementStart(List<String> paramList, List<View> paramList1, List<View> paramList2)
    {
      this.a.onSharedElementStart(paramList, paramList1, paramList2);
    }
  }
  
  static final class b
    extends ActivityCompatApi23.SharedElementCallback23
  {
    private SharedElementCallback a;
    
    public b(SharedElementCallback paramSharedElementCallback)
    {
      this.a = paramSharedElementCallback;
    }
    
    public final Parcelable onCaptureSharedElementSnapshot(View paramView, Matrix paramMatrix, RectF paramRectF)
    {
      return this.a.onCaptureSharedElementSnapshot(paramView, paramMatrix, paramRectF);
    }
    
    public final View onCreateSnapshotView(Context paramContext, Parcelable paramParcelable)
    {
      return this.a.onCreateSnapshotView(paramContext, paramParcelable);
    }
    
    public final void onMapSharedElements(List<String> paramList, Map<String, View> paramMap)
    {
      this.a.onMapSharedElements(paramList, paramMap);
    }
    
    public final void onRejectSharedElements(List<View> paramList)
    {
      this.a.onRejectSharedElements(paramList);
    }
    
    public final void onSharedElementEnd(List<String> paramList, List<View> paramList1, List<View> paramList2)
    {
      this.a.onSharedElementEnd(paramList, paramList1, paramList2);
    }
    
    public final void onSharedElementStart(List<String> paramList, List<View> paramList1, List<View> paramList2)
    {
      this.a.onSharedElementStart(paramList, paramList1, paramList2);
    }
    
    public final void onSharedElementsArrived(List<String> paramList, List<View> paramList1, final ActivityCompatApi23.OnSharedElementsReadyListenerBridge paramOnSharedElementsReadyListenerBridge)
    {
      this.a.onSharedElementsArrived(paramList, paramList1, new SharedElementCallback.OnSharedElementsReadyListener()
      {
        public final void onSharedElementsReady()
        {
          paramOnSharedElementsReadyListenerBridge.onSharedElementsReady();
        }
      });
    }
  }
}


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