- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
113 lines
3.5 KiB
Java
113 lines
3.5 KiB
Java
package androidx.core.graphics;
|
|
|
|
import android.graphics.Rect;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.RequiresApi;
|
|
import androidx.annotation.RestrictTo;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class Insets {
|
|
|
|
@NonNull
|
|
public static final Insets NONE = new Insets(0, 0, 0, 0);
|
|
public final int bottom;
|
|
public final int left;
|
|
public final int right;
|
|
public final int top;
|
|
|
|
public int hashCode() {
|
|
return (((((this.left * 31) + this.top) * 31) + this.right) * 31) + this.bottom;
|
|
}
|
|
|
|
private Insets(int i, int i2, int i3, int i4) {
|
|
this.left = i;
|
|
this.top = i2;
|
|
this.right = i3;
|
|
this.bottom = i4;
|
|
}
|
|
|
|
@NonNull
|
|
public static Insets of(int i, int i2, int i3, int i4) {
|
|
return (i == 0 && i2 == 0 && i3 == 0 && i4 == 0) ? NONE : new Insets(i, i2, i3, i4);
|
|
}
|
|
|
|
@NonNull
|
|
public static Insets of(@NonNull Rect rect) {
|
|
return of(rect.left, rect.top, rect.right, rect.bottom);
|
|
}
|
|
|
|
@NonNull
|
|
public static Insets add(@NonNull Insets insets, @NonNull Insets insets2) {
|
|
return of(insets.left + insets2.left, insets.top + insets2.top, insets.right + insets2.right, insets.bottom + insets2.bottom);
|
|
}
|
|
|
|
@NonNull
|
|
public static Insets subtract(@NonNull Insets insets, @NonNull Insets insets2) {
|
|
return of(insets.left - insets2.left, insets.top - insets2.top, insets.right - insets2.right, insets.bottom - insets2.bottom);
|
|
}
|
|
|
|
@NonNull
|
|
public static Insets max(@NonNull Insets insets, @NonNull Insets insets2) {
|
|
return of(Math.max(insets.left, insets2.left), Math.max(insets.top, insets2.top), Math.max(insets.right, insets2.right), Math.max(insets.bottom, insets2.bottom));
|
|
}
|
|
|
|
@NonNull
|
|
public static Insets min(@NonNull Insets insets, @NonNull Insets insets2) {
|
|
return of(Math.min(insets.left, insets2.left), Math.min(insets.top, insets2.top), Math.min(insets.right, insets2.right), Math.min(insets.bottom, insets2.bottom));
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (obj == null || Insets.class != obj.getClass()) {
|
|
return false;
|
|
}
|
|
Insets insets = (Insets) obj;
|
|
return this.bottom == insets.bottom && this.left == insets.left && this.right == insets.right && this.top == insets.top;
|
|
}
|
|
|
|
@NonNull
|
|
public String toString() {
|
|
return "Insets{left=" + this.left + ", top=" + this.top + ", right=" + this.right + ", bottom=" + this.bottom + '}';
|
|
}
|
|
|
|
@NonNull
|
|
@Deprecated
|
|
@RequiresApi(api = 29)
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
public static Insets wrap(@NonNull android.graphics.Insets insets) {
|
|
return toCompatInsets(insets);
|
|
}
|
|
|
|
@NonNull
|
|
@RequiresApi(api = 29)
|
|
public static Insets toCompatInsets(@NonNull android.graphics.Insets insets) {
|
|
int i;
|
|
int i2;
|
|
int i3;
|
|
int i4;
|
|
i = insets.left;
|
|
i2 = insets.top;
|
|
i3 = insets.right;
|
|
i4 = insets.bottom;
|
|
return of(i, i2, i3, i4);
|
|
}
|
|
|
|
@NonNull
|
|
@RequiresApi(29)
|
|
public android.graphics.Insets toPlatformInsets() {
|
|
return Api29Impl.of(this.left, this.top, this.right, this.bottom);
|
|
}
|
|
|
|
@RequiresApi(29)
|
|
public static class Api29Impl {
|
|
private Api29Impl() {
|
|
}
|
|
|
|
public static android.graphics.Insets of(int i, int i2, int i3, int i4) {
|
|
return android.graphics.Insets.of(i, i2, i3, i4);
|
|
}
|
|
}
|
|
}
|