292 lines
11 KiB
Java
292 lines
11 KiB
Java
|
package androidx.core.app;
|
||
|
|
||
|
import android.app.Activity;
|
||
|
import android.app.SharedElementCallback;
|
||
|
import android.content.Context;
|
||
|
import android.content.Intent;
|
||
|
import android.content.IntentSender;
|
||
|
import android.graphics.Bitmap;
|
||
|
import android.graphics.Canvas;
|
||
|
import android.graphics.Matrix;
|
||
|
import android.graphics.RectF;
|
||
|
import android.graphics.drawable.Drawable;
|
||
|
import android.os.Build;
|
||
|
import android.os.Bundle;
|
||
|
import android.os.Handler;
|
||
|
import android.os.Parcelable;
|
||
|
import android.text.TextUtils;
|
||
|
import android.view.View;
|
||
|
import android.widget.ImageView;
|
||
|
import androidx.core.app.ActivityCompat;
|
||
|
import androidx.core.app.SharedElementCallback;
|
||
|
import java.util.Arrays;
|
||
|
import java.util.HashSet;
|
||
|
import java.util.List;
|
||
|
import java.util.Map;
|
||
|
import o.C0348Epo;
|
||
|
import o.C17488xFm;
|
||
|
import o.nMh;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public class ActivityCompat extends nMh {
|
||
|
private static PermissionCompatDelegate a;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public interface IeS {
|
||
|
void validateRequestPermissionsRequestCode(int i);
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public interface PermissionCompatDelegate {
|
||
|
boolean md_(Activity activity, String[] strArr, int i);
|
||
|
}
|
||
|
|
||
|
protected ActivityCompat() {
|
||
|
}
|
||
|
|
||
|
public static void lQ_(Activity activity, Intent intent, int i, Bundle bundle) {
|
||
|
HBt.lU_(activity, intent, i, bundle);
|
||
|
}
|
||
|
|
||
|
public static void lR_(Activity activity, IntentSender intentSender, int i, Intent intent, int i2, int i3, int i4, Bundle bundle) throws IntentSender.SendIntentException {
|
||
|
HBt.lV_(activity, intentSender, i, intent, i2, i3, i4, bundle);
|
||
|
}
|
||
|
|
||
|
public static void lH_(Activity activity) {
|
||
|
HBt.lT_(activity);
|
||
|
}
|
||
|
|
||
|
public static void lI_(Activity activity) {
|
||
|
Sts.lW_(activity);
|
||
|
}
|
||
|
|
||
|
public static void lN_(Activity activity, SharedElementCallback sharedElementCallback) {
|
||
|
Sts.lY_(activity, sharedElementCallback != null ? new LWm(sharedElementCallback) : null);
|
||
|
}
|
||
|
|
||
|
public static void lO_(Activity activity, SharedElementCallback sharedElementCallback) {
|
||
|
Sts.lZ_(activity, sharedElementCallback != null ? new LWm(sharedElementCallback) : null);
|
||
|
}
|
||
|
|
||
|
public static void lK_(Activity activity) {
|
||
|
Sts.lX_(activity);
|
||
|
}
|
||
|
|
||
|
public static void lS_(Activity activity) {
|
||
|
Sts.ma_(activity);
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
public static void lM_(Activity activity, String[] strArr, int i) {
|
||
|
PermissionCompatDelegate permissionCompatDelegate = a;
|
||
|
if (permissionCompatDelegate == null || !permissionCompatDelegate.md_(activity, strArr, i)) {
|
||
|
HashSet hashSet = new HashSet();
|
||
|
for (int i2 = 0; i2 < strArr.length; i2++) {
|
||
|
if (TextUtils.isEmpty(strArr[i2])) {
|
||
|
StringBuilder sb = new StringBuilder("Permission request for permissions ");
|
||
|
sb.append(Arrays.toString(strArr));
|
||
|
sb.append(" must not contain null or empty values");
|
||
|
throw new IllegalArgumentException(sb.toString());
|
||
|
}
|
||
|
if (!C17488xFm.c() && TextUtils.equals(strArr[i2], "android.permission.POST_NOTIFICATIONS")) {
|
||
|
hashSet.add(Integer.valueOf(i2));
|
||
|
}
|
||
|
}
|
||
|
int size = hashSet.size();
|
||
|
String[] strArr2 = size > 0 ? new String[strArr.length - size] : strArr;
|
||
|
if (size > 0) {
|
||
|
if (size == strArr.length) {
|
||
|
return;
|
||
|
}
|
||
|
int i3 = 0;
|
||
|
for (int i4 = 0; i4 < strArr.length; i4++) {
|
||
|
if (!hashSet.contains(Integer.valueOf(i4))) {
|
||
|
strArr2[i3] = strArr[i4];
|
||
|
i3++;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if (activity instanceof IeS) {
|
||
|
((IeS) activity).validateRequestPermissionsRequestCode(i);
|
||
|
}
|
||
|
RVV.mb_(activity, strArr, i);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static boolean lP_(Activity activity, String str) {
|
||
|
if (C17488xFm.c() || !TextUtils.equals("android.permission.POST_NOTIFICATIONS", str)) {
|
||
|
return RVV.mc_(activity, str);
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
public static void lL_(final Activity activity) {
|
||
|
if (Build.VERSION.SDK_INT >= 28) {
|
||
|
activity.recreate();
|
||
|
} else {
|
||
|
new Handler(activity.getMainLooper()).post(new Runnable(activity) { // from class: o.THe
|
||
|
public final Activity e;
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public final void run() {
|
||
|
ActivityCompat.lJ_(this.e);
|
||
|
}
|
||
|
|
||
|
{
|
||
|
this.e = activity;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static /* synthetic */ void lJ_(Activity activity) {
|
||
|
if (activity.isFinishing() || C0348Epo.mh_(activity)) {
|
||
|
return;
|
||
|
}
|
||
|
activity.recreate();
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public static class LWm extends android.app.SharedElementCallback {
|
||
|
private final SharedElementCallback d;
|
||
|
|
||
|
@Override // android.app.SharedElementCallback
|
||
|
public void onMapSharedElements(List<String> list, Map<String, View> map) {
|
||
|
}
|
||
|
|
||
|
@Override // android.app.SharedElementCallback
|
||
|
public void onRejectSharedElements(List<View> list) {
|
||
|
}
|
||
|
|
||
|
@Override // android.app.SharedElementCallback
|
||
|
public void onSharedElementEnd(List<String> list, List<View> list2, List<View> list3) {
|
||
|
}
|
||
|
|
||
|
@Override // android.app.SharedElementCallback
|
||
|
public void onSharedElementStart(List<String> list, List<View> list2, List<View> list3) {
|
||
|
}
|
||
|
|
||
|
LWm(SharedElementCallback sharedElementCallback) {
|
||
|
this.d = sharedElementCallback;
|
||
|
}
|
||
|
|
||
|
@Override // android.app.SharedElementCallback
|
||
|
public View onCreateSnapshotView(Context context, Parcelable parcelable) {
|
||
|
return SharedElementCallback.nj_(context, parcelable);
|
||
|
}
|
||
|
|
||
|
@Override // android.app.SharedElementCallback
|
||
|
public void onSharedElementsArrived(List<String> list, List<View> list2, final SharedElementCallback.OnSharedElementsReadyListener onSharedElementsReadyListener) {
|
||
|
SharedElementCallback.d(new SharedElementCallback.Sts(onSharedElementsReadyListener) { // from class: o.uBK
|
||
|
public final SharedElementCallback.OnSharedElementsReadyListener b;
|
||
|
|
||
|
@Override // androidx.core.app.SharedElementCallback.Sts
|
||
|
public final void c() {
|
||
|
ActivityCompat.RVV.e(this.b);
|
||
|
}
|
||
|
|
||
|
{
|
||
|
this.b = onSharedElementsReadyListener;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@Override // android.app.SharedElementCallback
|
||
|
public Parcelable onCaptureSharedElementSnapshot(View view, Matrix matrix, RectF rectF) {
|
||
|
Bitmap ni_;
|
||
|
SharedElementCallback sharedElementCallback = this.d;
|
||
|
if (view instanceof ImageView) {
|
||
|
ImageView imageView = (ImageView) view;
|
||
|
Drawable drawable = imageView.getDrawable();
|
||
|
Drawable background = imageView.getBackground();
|
||
|
if (drawable != null && background == null && (ni_ = SharedElementCallback.ni_(drawable)) != null) {
|
||
|
Bundle bundle = new Bundle();
|
||
|
bundle.putParcelable("sharedElement:snapshot:bitmap", ni_);
|
||
|
bundle.putString("sharedElement:snapshot:imageScaleType", imageView.getScaleType().toString());
|
||
|
if (imageView.getScaleType() == ImageView.ScaleType.MATRIX) {
|
||
|
float[] fArr = new float[9];
|
||
|
imageView.getImageMatrix().getValues(fArr);
|
||
|
bundle.putFloatArray("sharedElement:snapshot:imageMatrix", fArr);
|
||
|
}
|
||
|
return bundle;
|
||
|
}
|
||
|
}
|
||
|
int round = Math.round(rectF.width());
|
||
|
int round2 = Math.round(rectF.height());
|
||
|
if (round <= 0 || round2 <= 0) {
|
||
|
return null;
|
||
|
}
|
||
|
float min = Math.min(1.0f, 1048576.0f / (round * round2));
|
||
|
int i = (int) (round * min);
|
||
|
int i2 = (int) (round2 * min);
|
||
|
if (sharedElementCallback.a == null) {
|
||
|
sharedElementCallback.a = new Matrix();
|
||
|
}
|
||
|
sharedElementCallback.a.set(matrix);
|
||
|
sharedElementCallback.a.postTranslate(-rectF.left, -rectF.top);
|
||
|
sharedElementCallback.a.postScale(min, min);
|
||
|
Bitmap createBitmap = Bitmap.createBitmap(i, i2, Bitmap.Config.ARGB_8888);
|
||
|
Canvas canvas = new Canvas(createBitmap);
|
||
|
canvas.concat(sharedElementCallback.a);
|
||
|
view.draw(canvas);
|
||
|
return createBitmap;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes.dex */
|
||
|
public static class HBt {
|
||
|
static void lU_(Activity activity, Intent intent, int i, Bundle bundle) {
|
||
|
activity.startActivityForResult(intent, i, bundle);
|
||
|
}
|
||
|
|
||
|
static void lV_(Activity activity, IntentSender intentSender, int i, Intent intent, int i2, int i3, int i4, Bundle bundle) throws IntentSender.SendIntentException {
|
||
|
activity.startIntentSenderForResult(intentSender, i, intent, i2, i3, i4, bundle);
|
||
|
}
|
||
|
|
||
|
static void lT_(Activity activity) {
|
||
|
activity.finishAffinity();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
static class Sts {
|
||
|
static void lW_(Activity activity) {
|
||
|
activity.finishAfterTransition();
|
||
|
}
|
||
|
|
||
|
static void lY_(Activity activity, android.app.SharedElementCallback sharedElementCallback) {
|
||
|
activity.setEnterSharedElementCallback(sharedElementCallback);
|
||
|
}
|
||
|
|
||
|
static void lZ_(Activity activity, android.app.SharedElementCallback sharedElementCallback) {
|
||
|
activity.setExitSharedElementCallback(sharedElementCallback);
|
||
|
}
|
||
|
|
||
|
static void lX_(Activity activity) {
|
||
|
activity.postponeEnterTransition();
|
||
|
}
|
||
|
|
||
|
static void ma_(Activity activity) {
|
||
|
activity.startPostponedEnterTransition();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes.dex */
|
||
|
public static class RVV {
|
||
|
static void mb_(Activity activity, String[] strArr, int i) {
|
||
|
activity.requestPermissions(strArr, i);
|
||
|
}
|
||
|
|
||
|
static boolean mc_(Activity activity, String str) {
|
||
|
return activity.shouldShowRequestPermissionRationale(str);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static void e(Object obj) {
|
||
|
((SharedElementCallback.OnSharedElementsReadyListener) obj).onSharedElementsReady();
|
||
|
}
|
||
|
}
|
||
|
}
|