2021-07-24 02:37:17 +00:00
|
|
|
package androidx.core.graphics;
|
|
|
|
|
|
|
|
import android.graphics.Rect;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.RequiresApi;
|
|
|
|
import androidx.annotation.RestrictTo;
|
|
|
|
import c.d.b.a.a;
|
|
|
|
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;
|
|
|
|
|
|
|
|
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
|
|
|
|
@RequiresApi(api = 29)
|
|
|
|
public static Insets toCompatInsets(@NonNull android.graphics.Insets insets) {
|
|
|
|
return of(insets.left, insets.top, insets.right, insets.bottom);
|
|
|
|
}
|
|
|
|
|
|
|
|
@NonNull
|
|
|
|
@Deprecated
|
|
|
|
@RequiresApi(api = 29)
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
|
|
public static Insets wrap(@NonNull android.graphics.Insets insets) {
|
|
|
|
return toCompatInsets(insets);
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
return (((((this.left * 31) + this.top) * 31) + this.right) * 31) + this.bottom;
|
|
|
|
}
|
|
|
|
|
|
|
|
@NonNull
|
|
|
|
@RequiresApi(api = 29)
|
|
|
|
public android.graphics.Insets toPlatformInsets() {
|
|
|
|
return android.graphics.Insets.of(this.left, this.top, this.right, this.bottom);
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
2021-08-28 06:29:07 +00:00
|
|
|
StringBuilder P = a.P("Insets{left=");
|
|
|
|
P.append(this.left);
|
|
|
|
P.append(", top=");
|
|
|
|
P.append(this.top);
|
|
|
|
P.append(", right=");
|
|
|
|
P.append(this.right);
|
|
|
|
P.append(", bottom=");
|
|
|
|
return a.y(P, this.bottom, '}');
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|