132 lines
4.8 KiB
Java
132 lines
4.8 KiB
Java
package com.squareup.picasso;
|
|
|
|
import android.content.ContentResolver;
|
|
import android.content.ContentUris;
|
|
import android.content.Context;
|
|
import android.graphics.Bitmap;
|
|
import android.graphics.BitmapFactory;
|
|
import android.net.Uri;
|
|
import android.provider.MediaStore;
|
|
import com.ijm.dataencryption.de.DataDecryptTool;
|
|
import com.squareup.picasso.Picasso;
|
|
import com.squareup.picasso.RequestHandler;
|
|
import com.unity3d.ads.adunit.AdUnitActivity;
|
|
import java.io.IOException;
|
|
|
|
/* loaded from: classes.dex */
|
|
class MediaStoreRequestHandler extends ContentStreamRequestHandler {
|
|
private static final String[] b = {AdUnitActivity.EXTRA_ORIENTATION};
|
|
|
|
enum PicassoKind {
|
|
MICRO(3, 96, 96),
|
|
MINI(1, DataDecryptTool.DECRYPT_DB_FILE, 384),
|
|
FULL(2, -1, -1);
|
|
|
|
final int a;
|
|
final int b;
|
|
final int c;
|
|
|
|
PicassoKind(int i, int i2, int i3) {
|
|
this.a = i;
|
|
this.b = i2;
|
|
this.c = i3;
|
|
}
|
|
}
|
|
|
|
MediaStoreRequestHandler(Context context) {
|
|
super(context);
|
|
}
|
|
|
|
@Override // com.squareup.picasso.ContentStreamRequestHandler, com.squareup.picasso.RequestHandler
|
|
public boolean a(Request request) {
|
|
Uri uri = request.d;
|
|
return "content".equals(uri.getScheme()) && "media".equals(uri.getAuthority());
|
|
}
|
|
|
|
@Override // com.squareup.picasso.ContentStreamRequestHandler, com.squareup.picasso.RequestHandler
|
|
public RequestHandler.Result a(Request request, int i) throws IOException {
|
|
Bitmap thumbnail;
|
|
ContentResolver contentResolver = this.a.getContentResolver();
|
|
int a = a(contentResolver, request.d);
|
|
String type = contentResolver.getType(request.d);
|
|
boolean z = type != null && type.startsWith("video/");
|
|
if (request.c()) {
|
|
PicassoKind a2 = a(request.h, request.i);
|
|
if (!z && a2 == PicassoKind.FULL) {
|
|
return new RequestHandler.Result(null, c(request), Picasso.LoadedFrom.DISK, a);
|
|
}
|
|
long parseId = ContentUris.parseId(request.d);
|
|
BitmapFactory.Options b2 = RequestHandler.b(request);
|
|
b2.inJustDecodeBounds = true;
|
|
RequestHandler.a(request.h, request.i, a2.b, a2.c, b2, request);
|
|
if (z) {
|
|
thumbnail = MediaStore.Video.Thumbnails.getThumbnail(contentResolver, parseId, a2 == PicassoKind.FULL ? 1 : a2.a, b2);
|
|
} else {
|
|
thumbnail = MediaStore.Images.Thumbnails.getThumbnail(contentResolver, parseId, a2.a, b2);
|
|
}
|
|
if (thumbnail != null) {
|
|
return new RequestHandler.Result(thumbnail, null, Picasso.LoadedFrom.DISK, a);
|
|
}
|
|
}
|
|
return new RequestHandler.Result(null, c(request), Picasso.LoadedFrom.DISK, a);
|
|
}
|
|
|
|
static PicassoKind a(int i, int i2) {
|
|
PicassoKind picassoKind = PicassoKind.MICRO;
|
|
if (i <= picassoKind.b && i2 <= picassoKind.c) {
|
|
return picassoKind;
|
|
}
|
|
PicassoKind picassoKind2 = PicassoKind.MINI;
|
|
return (i > picassoKind2.b || i2 > picassoKind2.c) ? PicassoKind.FULL : picassoKind2;
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:15:0x0022, code lost:
|
|
|
|
r1.close();
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
|
*/
|
|
static int a(android.content.ContentResolver r8, android.net.Uri r9) {
|
|
/*
|
|
r0 = 0
|
|
r1 = 0
|
|
java.lang.String[] r4 = com.squareup.picasso.MediaStoreRequestHandler.b // Catch: java.lang.Throwable -> L26 java.lang.RuntimeException -> L2d
|
|
r5 = 0
|
|
r6 = 0
|
|
r7 = 0
|
|
r2 = r8
|
|
r3 = r9
|
|
android.database.Cursor r1 = r2.query(r3, r4, r5, r6, r7) // Catch: java.lang.Throwable -> L26 java.lang.RuntimeException -> L2d
|
|
if (r1 == 0) goto L20
|
|
boolean r8 = r1.moveToFirst() // Catch: java.lang.Throwable -> L26 java.lang.RuntimeException -> L2d
|
|
if (r8 != 0) goto L16
|
|
goto L20
|
|
L16:
|
|
int r8 = r1.getInt(r0) // Catch: java.lang.Throwable -> L26 java.lang.RuntimeException -> L2d
|
|
if (r1 == 0) goto L1f
|
|
r1.close()
|
|
L1f:
|
|
return r8
|
|
L20:
|
|
if (r1 == 0) goto L25
|
|
r1.close()
|
|
L25:
|
|
return r0
|
|
L26:
|
|
r8 = move-exception
|
|
if (r1 == 0) goto L2c
|
|
r1.close()
|
|
L2c:
|
|
throw r8
|
|
L2d:
|
|
if (r1 == 0) goto L33
|
|
r1.close()
|
|
L33:
|
|
return r0
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.squareup.picasso.MediaStoreRequestHandler.a(android.content.ContentResolver, android.net.Uri):int");
|
|
}
|
|
}
|