81 lines
2.8 KiB
Java
81 lines
2.8 KiB
Java
|
package androidx.core.app;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.graphics.Bitmap;
|
||
|
import android.graphics.Canvas;
|
||
|
import android.graphics.Matrix;
|
||
|
import android.graphics.Rect;
|
||
|
import android.graphics.drawable.BitmapDrawable;
|
||
|
import android.graphics.drawable.Drawable;
|
||
|
import android.os.Bundle;
|
||
|
import android.os.Parcelable;
|
||
|
import android.view.View;
|
||
|
import android.widget.ImageView;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public abstract class SharedElementCallback {
|
||
|
Matrix a;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public interface Sts {
|
||
|
void c();
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static Bitmap ni_(Drawable drawable) {
|
||
|
int intrinsicWidth = drawable.getIntrinsicWidth();
|
||
|
int intrinsicHeight = drawable.getIntrinsicHeight();
|
||
|
if (intrinsicWidth <= 0 || intrinsicHeight <= 0) {
|
||
|
return null;
|
||
|
}
|
||
|
float min = Math.min(1.0f, 1048576.0f / (intrinsicWidth * intrinsicHeight));
|
||
|
if ((drawable instanceof BitmapDrawable) && min == 1.0f) {
|
||
|
return ((BitmapDrawable) drawable).getBitmap();
|
||
|
}
|
||
|
int i = (int) (intrinsicWidth * min);
|
||
|
int i2 = (int) (intrinsicHeight * min);
|
||
|
Bitmap createBitmap = Bitmap.createBitmap(i, i2, Bitmap.Config.ARGB_8888);
|
||
|
Canvas canvas = new Canvas(createBitmap);
|
||
|
Rect bounds = drawable.getBounds();
|
||
|
int i3 = bounds.left;
|
||
|
int i4 = bounds.top;
|
||
|
int i5 = bounds.right;
|
||
|
int i6 = bounds.bottom;
|
||
|
drawable.setBounds(0, 0, i, i2);
|
||
|
drawable.draw(canvas);
|
||
|
drawable.setBounds(i3, i4, i5, i6);
|
||
|
return createBitmap;
|
||
|
}
|
||
|
|
||
|
public static View nj_(Context context, Parcelable parcelable) {
|
||
|
if (parcelable instanceof Bundle) {
|
||
|
Bundle bundle = (Bundle) parcelable;
|
||
|
Bitmap bitmap = (Bitmap) bundle.getParcelable("sharedElement:snapshot:bitmap");
|
||
|
if (bitmap == null) {
|
||
|
return null;
|
||
|
}
|
||
|
ImageView imageView = new ImageView(context);
|
||
|
imageView.setImageBitmap(bitmap);
|
||
|
imageView.setScaleType(ImageView.ScaleType.valueOf(bundle.getString("sharedElement:snapshot:imageScaleType")));
|
||
|
if (imageView.getScaleType() != ImageView.ScaleType.MATRIX) {
|
||
|
return imageView;
|
||
|
}
|
||
|
float[] floatArray = bundle.getFloatArray("sharedElement:snapshot:imageMatrix");
|
||
|
Matrix matrix = new Matrix();
|
||
|
matrix.setValues(floatArray);
|
||
|
imageView.setImageMatrix(matrix);
|
||
|
return imageView;
|
||
|
}
|
||
|
if (!(parcelable instanceof Bitmap)) {
|
||
|
return null;
|
||
|
}
|
||
|
ImageView imageView2 = new ImageView(context);
|
||
|
imageView2.setImageBitmap((Bitmap) parcelable);
|
||
|
return imageView2;
|
||
|
}
|
||
|
|
||
|
public static void d(Sts sts) {
|
||
|
sts.c();
|
||
|
}
|
||
|
}
|