100 lines
3.2 KiB
Java
100 lines
3.2 KiB
Java
package o;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.Bitmap;
|
|
import android.graphics.BitmapFactory;
|
|
import android.net.Uri;
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.InputStream;
|
|
import java.util.concurrent.Callable;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public final class LyE implements InterfaceC4255bUm {
|
|
private final Context d;
|
|
|
|
@InterfaceC13391fZD
|
|
public LyE(Context context) {
|
|
this.d = context;
|
|
}
|
|
|
|
@Override // o.InterfaceC4255bUm
|
|
public final AbstractC13163fSk<byte[]> e(final String str, final int i, final int i2) {
|
|
return AbstractC13163fSk.fromCallable(new Callable(this, str, i2, i) { // from class: o.uPh
|
|
private int a;
|
|
private int c;
|
|
private String d;
|
|
private LyE e;
|
|
|
|
@Override // java.util.concurrent.Callable
|
|
public final Object call() {
|
|
return this.e.c(this.d, this.c, this.a);
|
|
}
|
|
|
|
{
|
|
this.e = this;
|
|
this.d = str;
|
|
this.c = i2;
|
|
this.a = i;
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public final /* synthetic */ byte[] c(String str, int i, int i2) throws Exception {
|
|
Bitmap QO_ = QO_(Uri.parse(str), i, i2);
|
|
byte[] bArr = new byte[0];
|
|
try {
|
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
QO_.compress(Bitmap.CompressFormat.JPEG, 90, byteArrayOutputStream);
|
|
bArr = byteArrayOutputStream.toByteArray();
|
|
} catch (Exception e) {
|
|
guQ.a(e);
|
|
}
|
|
QO_.recycle();
|
|
return bArr;
|
|
}
|
|
|
|
private Bitmap QO_(Uri uri, int i, int i2) {
|
|
InputStream openInputStream;
|
|
BitmapFactory.Options options;
|
|
InputStream openInputStream2;
|
|
Bitmap bitmap = null;
|
|
try {
|
|
openInputStream = this.d.getContentResolver().openInputStream(uri);
|
|
try {
|
|
options = new BitmapFactory.Options();
|
|
int i3 = 1;
|
|
options.inJustDecodeBounds = true;
|
|
BitmapFactory.decodeStream(openInputStream, null, options);
|
|
int i4 = options.outHeight;
|
|
int i5 = options.outWidth;
|
|
if (i4 > i2 || i5 > i) {
|
|
int i6 = (i4 / 2) / i2;
|
|
int i7 = (i5 / 2) / i;
|
|
if (i6 + i7 > 2) {
|
|
i3 = 1 + Math.min(i6, i7);
|
|
}
|
|
}
|
|
options.inSampleSize = i3;
|
|
options.inJustDecodeBounds = false;
|
|
openInputStream2 = this.d.getContentResolver().openInputStream(uri);
|
|
} finally {
|
|
}
|
|
} catch (Exception e) {
|
|
guQ.a(e);
|
|
}
|
|
try {
|
|
bitmap = BitmapFactory.decodeStream(openInputStream2, null, options);
|
|
openInputStream2.close();
|
|
if (openInputStream2 != null) {
|
|
openInputStream2.close();
|
|
}
|
|
if (openInputStream != null) {
|
|
openInputStream.close();
|
|
}
|
|
return bitmap;
|
|
} finally {
|
|
}
|
|
}
|
|
}
|