jimu-decompiled/sources/com/squareup/picasso/RequestHandler.java
2025-05-13 19:24:51 +02:00

123 lines
3.5 KiB
Java

package com.squareup.picasso;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.NetworkInfo;
import com.squareup.picasso.Picasso;
import java.io.IOException;
import java.io.InputStream;
/* loaded from: classes.dex */
public abstract class RequestHandler {
public static final class Result {
private final Picasso.LoadedFrom a;
private final Bitmap b;
private final InputStream c;
private final int d;
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public Result(Bitmap bitmap, Picasso.LoadedFrom loadedFrom) {
this(bitmap, null, loadedFrom, 0);
Utils.a(bitmap, "bitmap == null");
}
public Bitmap a() {
return this.b;
}
int b() {
return this.d;
}
public Picasso.LoadedFrom c() {
return this.a;
}
public InputStream d() {
return this.c;
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public Result(InputStream inputStream, Picasso.LoadedFrom loadedFrom) {
this(null, inputStream, loadedFrom, 0);
Utils.a(inputStream, "stream == null");
}
Result(Bitmap bitmap, InputStream inputStream, Picasso.LoadedFrom loadedFrom, int i) {
if ((inputStream != null) ^ (bitmap != null)) {
this.b = bitmap;
this.c = inputStream;
Utils.a(loadedFrom, "loadedFrom == null");
this.a = loadedFrom;
this.d = i;
return;
}
throw new AssertionError();
}
}
static boolean a(BitmapFactory.Options options) {
return options != null && options.inJustDecodeBounds;
}
static BitmapFactory.Options b(Request request) {
boolean c = request.c();
boolean z = request.q != null;
BitmapFactory.Options options = null;
if (c || z) {
options = new BitmapFactory.Options();
options.inJustDecodeBounds = c;
if (z) {
options.inPreferredConfig = request.q;
}
}
return options;
}
int a() {
return 0;
}
public abstract Result a(Request request, int i) throws IOException;
public abstract boolean a(Request request);
boolean a(boolean z, NetworkInfo networkInfo) {
return false;
}
boolean b() {
return false;
}
static void a(int i, int i2, BitmapFactory.Options options, Request request) {
a(i, i2, options.outWidth, options.outHeight, options, request);
}
static void a(int i, int i2, int i3, int i4, BitmapFactory.Options options, Request request) {
int min;
double floor;
if (i4 > i2 || i3 > i) {
if (i2 == 0) {
floor = Math.floor(i3 / i);
} else if (i == 0) {
floor = Math.floor(i4 / i2);
} else {
int floor2 = (int) Math.floor(i4 / i2);
int floor3 = (int) Math.floor(i3 / i);
if (request.k) {
min = Math.max(floor2, floor3);
} else {
min = Math.min(floor2, floor3);
}
}
min = (int) floor;
} else {
min = 1;
}
options.inSampleSize = min;
options.inJustDecodeBounds = false;
}
}