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

225 lines
6.5 KiB
Java

package com.squareup.picasso;
import android.graphics.Bitmap;
import android.net.Uri;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
/* loaded from: classes.dex */
public final class Request {
private static final long s = TimeUnit.SECONDS.toNanos(5);
int a;
long b;
int c;
public final Uri d;
public final int e;
public final String f;
public final List<Transformation> g;
public final int h;
public final int i;
public final boolean j;
public final boolean k;
public final boolean l;
public final float m;
public final float n;
public final float o;
public final boolean p;
public final Bitmap.Config q;
public final Picasso.Priority r;
String a() {
Uri uri = this.d;
return uri != null ? String.valueOf(uri.getPath()) : Integer.toHexString(this.e);
}
boolean b() {
return this.g != null;
}
public boolean c() {
return (this.h == 0 && this.i == 0) ? false : true;
}
String d() {
long nanoTime = System.nanoTime() - this.b;
if (nanoTime > s) {
return g() + '+' + TimeUnit.NANOSECONDS.toSeconds(nanoTime) + 's';
}
return g() + '+' + TimeUnit.NANOSECONDS.toMillis(nanoTime) + "ms";
}
boolean e() {
return c() || this.m != 0.0f;
}
boolean f() {
return e() || b();
}
String g() {
return "[R" + this.a + ']';
}
public String toString() {
StringBuilder sb = new StringBuilder("Request{");
int i = this.e;
if (i > 0) {
sb.append(i);
} else {
sb.append(this.d);
}
List<Transformation> list = this.g;
if (list != null && !list.isEmpty()) {
for (Transformation transformation : this.g) {
sb.append(' ');
sb.append(transformation.a());
}
}
if (this.f != null) {
sb.append(" stableKey(");
sb.append(this.f);
sb.append(')');
}
if (this.h > 0) {
sb.append(" resize(");
sb.append(this.h);
sb.append(',');
sb.append(this.i);
sb.append(')');
}
if (this.j) {
sb.append(" centerCrop");
}
if (this.k) {
sb.append(" centerInside");
}
if (this.m != 0.0f) {
sb.append(" rotation(");
sb.append(this.m);
if (this.p) {
sb.append(" @ ");
sb.append(this.n);
sb.append(',');
sb.append(this.o);
}
sb.append(')');
}
if (this.q != null) {
sb.append(' ');
sb.append(this.q);
}
sb.append('}');
return sb.toString();
}
private Request(Uri uri, int i, String str, List<Transformation> list, int i2, int i3, boolean z, boolean z2, boolean z3, float f, float f2, float f3, boolean z4, Bitmap.Config config, Picasso.Priority priority) {
this.d = uri;
this.e = i;
this.f = str;
if (list == null) {
this.g = null;
} else {
this.g = Collections.unmodifiableList(list);
}
this.h = i2;
this.i = i3;
this.j = z;
this.k = z2;
this.l = z3;
this.m = f;
this.n = f2;
this.o = f3;
this.p = z4;
this.q = config;
this.r = priority;
}
public static final class Builder {
private Uri a;
private int b;
private String c;
private int d;
private int e;
private boolean f;
private boolean g;
private boolean h;
private float i;
private float j;
private float k;
private boolean l;
private List<Transformation> m;
private Bitmap.Config n;
private Picasso.Priority o;
Builder(Uri uri, int i, Bitmap.Config config) {
this.a = uri;
this.b = i;
this.n = config;
}
public Builder a(int i, int i2) {
if (i < 0) {
throw new IllegalArgumentException("Width must be positive number or 0.");
}
if (i2 < 0) {
throw new IllegalArgumentException("Height must be positive number or 0.");
}
if (i2 == 0 && i == 0) {
throw new IllegalArgumentException("At least one dimension has to be positive number.");
}
this.d = i;
this.e = i2;
return this;
}
public Builder b() {
if (this.g) {
throw new IllegalStateException("Center crop can not be used after calling centerInside");
}
this.f = true;
return this;
}
boolean c() {
return (this.a == null && this.b == 0) ? false : true;
}
boolean d() {
return (this.d == 0 && this.e == 0) ? false : true;
}
public Builder a(Transformation transformation) {
if (transformation != null) {
if (transformation.a() != null) {
if (this.m == null) {
this.m = new ArrayList(2);
}
this.m.add(transformation);
return this;
}
throw new IllegalArgumentException("Transformation key must not be null.");
}
throw new IllegalArgumentException("Transformation must not be null.");
}
public Request a() {
if (this.g && this.f) {
throw new IllegalStateException("Center crop and center inside can not be used together.");
}
if (this.f && this.d == 0 && this.e == 0) {
throw new IllegalStateException("Center crop requires calling resize with positive width and height.");
}
if (this.g && this.d == 0 && this.e == 0) {
throw new IllegalStateException("Center inside requires calling resize with positive width and height.");
}
if (this.o == null) {
this.o = Picasso.Priority.NORMAL;
}
return new Request(this.a, this.b, this.c, this.m, this.d, this.e, this.f, this.g, this.h, this.i, this.j, this.k, this.l, this.n, this.o);
}
}
}