Initial commit
This commit is contained in:
110
sources/com/google/android/gms/common/images/WebImage.java
Normal file
110
sources/com/google/android/gms/common/images/WebImage.java
Normal file
@@ -0,0 +1,110 @@
|
||||
package com.google.android.gms.common.images;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import com.baidu.cloud.media.player.misc.IMediaFormat;
|
||||
import com.google.android.gms.common.internal.Objects;
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelWriter;
|
||||
import java.util.Locale;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class WebImage extends AbstractSafeParcelable {
|
||||
public static final Parcelable.Creator<WebImage> CREATOR = new zae();
|
||||
private final int zale;
|
||||
private final int zand;
|
||||
private final int zane;
|
||||
private final Uri zanf;
|
||||
|
||||
WebImage(int i, Uri uri, int i2, int i3) {
|
||||
this.zale = i;
|
||||
this.zanf = uri;
|
||||
this.zand = i2;
|
||||
this.zane = i3;
|
||||
}
|
||||
|
||||
private static Uri zaa(JSONObject jSONObject) {
|
||||
if (jSONObject.has("url")) {
|
||||
try {
|
||||
return Uri.parse(jSONObject.getString("url"));
|
||||
} catch (JSONException unused) {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public final boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj != null && (obj instanceof WebImage)) {
|
||||
WebImage webImage = (WebImage) obj;
|
||||
if (Objects.a(this.zanf, webImage.zanf) && this.zand == webImage.zand && this.zane == webImage.zane) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public final int getHeight() {
|
||||
return this.zane;
|
||||
}
|
||||
|
||||
public final Uri getUrl() {
|
||||
return this.zanf;
|
||||
}
|
||||
|
||||
public final int getWidth() {
|
||||
return this.zand;
|
||||
}
|
||||
|
||||
public final int hashCode() {
|
||||
return Objects.a(this.zanf, Integer.valueOf(this.zand), Integer.valueOf(this.zane));
|
||||
}
|
||||
|
||||
public final JSONObject toJson() {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
try {
|
||||
jSONObject.put("url", this.zanf.toString());
|
||||
jSONObject.put(IMediaFormat.KEY_WIDTH, this.zand);
|
||||
jSONObject.put(IMediaFormat.KEY_HEIGHT, this.zane);
|
||||
} catch (JSONException unused) {
|
||||
}
|
||||
return jSONObject;
|
||||
}
|
||||
|
||||
public final String toString() {
|
||||
return String.format(Locale.US, "Image %dx%d %s", Integer.valueOf(this.zand), Integer.valueOf(this.zane), this.zanf.toString());
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public final void writeToParcel(Parcel parcel, int i) {
|
||||
int a = SafeParcelWriter.a(parcel);
|
||||
SafeParcelWriter.a(parcel, 1, this.zale);
|
||||
SafeParcelWriter.a(parcel, 2, (Parcelable) getUrl(), i, false);
|
||||
SafeParcelWriter.a(parcel, 3, getWidth());
|
||||
SafeParcelWriter.a(parcel, 4, getHeight());
|
||||
SafeParcelWriter.a(parcel, a);
|
||||
}
|
||||
|
||||
public WebImage(Uri uri, int i, int i2) throws IllegalArgumentException {
|
||||
this(1, uri, i, i2);
|
||||
if (uri == null) {
|
||||
throw new IllegalArgumentException("url cannot be null");
|
||||
}
|
||||
if (i < 0 || i2 < 0) {
|
||||
throw new IllegalArgumentException("width and height must not be negative");
|
||||
}
|
||||
}
|
||||
|
||||
public WebImage(Uri uri) throws IllegalArgumentException {
|
||||
this(uri, 0, 0);
|
||||
}
|
||||
|
||||
public WebImage(JSONObject jSONObject) throws IllegalArgumentException {
|
||||
this(zaa(jSONObject), jSONObject.optInt(IMediaFormat.KEY_WIDTH, 0), jSONObject.optInt(IMediaFormat.KEY_HEIGHT, 0));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user