package X6FRs_4.IMuAHx_6.Mqv2r_3;

import X6FRs_4.IMuAHx_6.Mqv2r_3.XnFJ5_9;
import android.app.Activity;
import android.app.SharedElementCallback;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.content.pm.PackageManager;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Parcelable;
import android.view.View;
import java.util.List;
import java.util.Map;
/* compiled from: ActivityCompat.java */
/* loaded from: classes.dex */
public class KQgRr5e_0 extends X6FRs_4.IMuAHx_6.X6FRs_4.KQgRr5e_0 {
    public static PGPF6hQ_2 KQgRr5e_0;

    /* compiled from: ActivityCompat.java */
    /* renamed from: X6FRs_4.IMuAHx_6.Mqv2r_3.KQgRr5e_0$KQgRr5e_0  reason: collision with other inner class name */
    /* loaded from: classes.dex */
    public static class RunnableC0039KQgRr5e_0 implements Runnable {
        public final /* synthetic */ int KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public final /* synthetic */ Activity f463KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public final /* synthetic */ String[] f464KQgRr5e_0;

        public RunnableC0039KQgRr5e_0(String[] strArr, Activity activity, int i) {
            this.f464KQgRr5e_0 = strArr;
            this.f463KQgRr5e_0 = activity;
            this.KQgRr5e_0 = i;
        }

        @Override // java.lang.Runnable
        public void run() {
            int[] iArr = new int[this.f464KQgRr5e_0.length];
            PackageManager packageManager = this.f463KQgRr5e_0.getPackageManager();
            String packageName = this.f463KQgRr5e_0.getPackageName();
            int length = this.f464KQgRr5e_0.length;
            for (int i = 0; i < length; i++) {
                iArr[i] = packageManager.checkPermission(this.f464KQgRr5e_0[i], packageName);
            }
            ((QxJ9d_1) this.f463KQgRr5e_0).onRequestPermissionsResult(this.KQgRr5e_0, this.f464KQgRr5e_0, iArr);
        }
    }

    /* compiled from: ActivityCompat.java */
    /* loaded from: classes.dex */
    public interface Mqv2r_3 {
        void validateRequestPermissionsRequestCode(int i);
    }

    /* compiled from: ActivityCompat.java */
    /* loaded from: classes.dex */
    public interface PGPF6hQ_2 {
        boolean KQgRr5e_0(Activity activity, int i, int i2, Intent intent);

        boolean KQgRr5e_0(Activity activity, String[] strArr, int i);
    }

    /* compiled from: ActivityCompat.java */
    /* loaded from: classes.dex */
    public interface QxJ9d_1 {
        void onRequestPermissionsResult(int i, String[] strArr, int[] iArr);
    }

    /* compiled from: ActivityCompat.java */
    /* loaded from: classes.dex */
    public static class X6FRs_4 extends SharedElementCallback {
        public final XnFJ5_9 KQgRr5e_0;

        /* compiled from: ActivityCompat.java */
        /* renamed from: X6FRs_4.IMuAHx_6.Mqv2r_3.KQgRr5e_0$X6FRs_4$KQgRr5e_0  reason: collision with other inner class name */
        /* loaded from: classes.dex */
        public class C0040KQgRr5e_0 implements XnFJ5_9.KQgRr5e_0 {
            public C0040KQgRr5e_0(X6FRs_4 x6FRs_4, SharedElementCallback.OnSharedElementsReadyListener onSharedElementsReadyListener) {
            }
        }

        public X6FRs_4(XnFJ5_9 xnFJ5_9) {
            this.KQgRr5e_0 = xnFJ5_9;
        }

        @Override // android.app.SharedElementCallback
        public Parcelable onCaptureSharedElementSnapshot(View view, Matrix matrix, RectF rectF) {
            return this.KQgRr5e_0.KQgRr5e_0(view, matrix, rectF);
        }

        @Override // android.app.SharedElementCallback
        public View onCreateSnapshotView(Context context, Parcelable parcelable) {
            return this.KQgRr5e_0.KQgRr5e_0(context, parcelable);
        }

        @Override // android.app.SharedElementCallback
        public void onMapSharedElements(List<String> list, Map<String, View> map) {
            this.KQgRr5e_0.KQgRr5e_0(list, map);
        }

        @Override // android.app.SharedElementCallback
        public void onRejectSharedElements(List<View> list) {
            this.KQgRr5e_0.KQgRr5e_0(list);
        }

        @Override // android.app.SharedElementCallback
        public void onSharedElementEnd(List<String> list, List<View> list2, List<View> list3) {
            this.KQgRr5e_0.KQgRr5e_0(list, list2, list3);
        }

        @Override // android.app.SharedElementCallback
        public void onSharedElementStart(List<String> list, List<View> list2, List<View> list3) {
            this.KQgRr5e_0.QxJ9d_1(list, list2, list3);
        }

        @Override // android.app.SharedElementCallback
        public void onSharedElementsArrived(List<String> list, List<View> list2, SharedElementCallback.OnSharedElementsReadyListener onSharedElementsReadyListener) {
            this.KQgRr5e_0.KQgRr5e_0(list, list2, new C0040KQgRr5e_0(this, onSharedElementsReadyListener));
        }
    }

    public static PGPF6hQ_2 KQgRr5e_0() {
        return KQgRr5e_0;
    }

    public static void Mqv2r_3(Activity activity) {
        if (Build.VERSION.SDK_INT >= 21) {
            activity.startPostponedEnterTransition();
        }
    }

    public static void PGPF6hQ_2(Activity activity) {
        if (Build.VERSION.SDK_INT >= 21) {
            activity.postponeEnterTransition();
        }
    }

    public static void QxJ9d_1(Activity activity) {
        if (Build.VERSION.SDK_INT >= 21) {
            activity.finishAfterTransition();
        } else {
            activity.finish();
        }
    }

    public static void KQgRr5e_0(Activity activity, Intent intent, int i, Bundle bundle) {
        if (Build.VERSION.SDK_INT >= 16) {
            activity.startActivityForResult(intent, i, bundle);
        } else {
            activity.startActivityForResult(intent, i);
        }
    }

    public static void QxJ9d_1(Activity activity, XnFJ5_9 xnFJ5_9) {
        if (Build.VERSION.SDK_INT >= 21) {
            activity.setExitSharedElementCallback(xnFJ5_9 != null ? new X6FRs_4(xnFJ5_9) : null);
        }
    }

    public static void KQgRr5e_0(Activity activity, IntentSender intentSender, int i, Intent intent, int i2, int i3, int i4, Bundle bundle) throws IntentSender.SendIntentException {
        if (Build.VERSION.SDK_INT >= 16) {
            activity.startIntentSenderForResult(intentSender, i, intent, i2, i3, i4, bundle);
        } else {
            activity.startIntentSenderForResult(intentSender, i, intent, i2, i3, i4);
        }
    }

    public static void KQgRr5e_0(Activity activity) {
        if (Build.VERSION.SDK_INT >= 16) {
            activity.finishAffinity();
        } else {
            activity.finish();
        }
    }

    public static void KQgRr5e_0(Activity activity, XnFJ5_9 xnFJ5_9) {
        if (Build.VERSION.SDK_INT >= 21) {
            activity.setEnterSharedElementCallback(xnFJ5_9 != null ? new X6FRs_4(xnFJ5_9) : null);
        }
    }

    public static void KQgRr5e_0(Activity activity, String[] strArr, int i) {
        PGPF6hQ_2 pGPF6hQ_2 = KQgRr5e_0;
        if (pGPF6hQ_2 == null || !pGPF6hQ_2.KQgRr5e_0(activity, strArr, i)) {
            if (Build.VERSION.SDK_INT >= 23) {
                if (activity instanceof Mqv2r_3) {
                    ((Mqv2r_3) activity).validateRequestPermissionsRequestCode(i);
                }
                activity.requestPermissions(strArr, i);
            } else if (activity instanceof QxJ9d_1) {
                new Handler(Looper.getMainLooper()).post(new RunnableC0039KQgRr5e_0(strArr, activity, i));
            }
        }
    }

    public static boolean KQgRr5e_0(Activity activity, String str) {
        if (Build.VERSION.SDK_INT >= 23) {
            return activity.shouldShowRequestPermissionRationale(str);
        }
        return false;
    }
}
