discord-jadx/app/src/main/java/com/discord/utilities/view/recycler/PaddedItemDecorator.java
2021-07-19 21:45:22 +02:00

80 lines
2.9 KiB
Java

package com.discord.utilities.view.recycler;
import android.graphics.Rect;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
import c.d.b.a.a;
import d0.j;
import d0.z.d.m;
import kotlin.jvm.internal.DefaultConstructorMarker;
/* compiled from: PaddedItemDecorator.kt */
public final class PaddedItemDecorator extends RecyclerView.ItemDecoration {
private final int orientation;
private final boolean spaceBetweenItemsOnly;
private final int spaceHorz;
private final int spaceVert;
public PaddedItemDecorator(int i, int i2, int i3, boolean z2) {
this.orientation = i;
this.spaceHorz = i2;
this.spaceVert = i3;
this.spaceBetweenItemsOnly = z2;
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ PaddedItemDecorator(int i, int i2, int i3, boolean z2, int i4, DefaultConstructorMarker defaultConstructorMarker) {
this(i, i2, i3, (i4 & 8) != 0 ? false : z2);
}
@Override // androidx.recyclerview.widget.RecyclerView.ItemDecoration
public void getItemOffsets(Rect rect, View view, RecyclerView recyclerView, RecyclerView.State state) {
m.checkNotNullParameter(rect, "outRect");
m.checkNotNullParameter(view, "view");
m.checkNotNullParameter(recyclerView, "parent");
m.checkNotNullParameter(state, "state");
super.getItemOffsets(rect, view, recyclerView, state);
int childAdapterPosition = recyclerView.getChildAdapterPosition(view);
int i = 0;
boolean z2 = childAdapterPosition == 0;
boolean z3 = childAdapterPosition == state.getItemCount() - 1;
int i2 = this.orientation;
if (i2 == 0) {
int i3 = this.spaceVert;
rect.top = i3;
rect.bottom = i3;
rect.left = (!z2 || this.spaceBetweenItemsOnly) ? 0 : this.spaceHorz;
if (!z3 || !this.spaceBetweenItemsOnly) {
i = this.spaceHorz;
}
rect.right = i;
} else if (i2 == 1) {
rect.top = (!z2 || this.spaceBetweenItemsOnly) ? 0 : this.spaceVert;
if (!z3 || !this.spaceBetweenItemsOnly) {
i = this.spaceVert;
}
rect.bottom = i;
int i4 = this.spaceHorz;
rect.left = i4;
rect.right = i4;
} else {
throw new j(a.s("An operation is not implemented: ", a.w(a.K("Other("), this.orientation, ") orientation padding for items not supported yet.")));
}
}
public final int getOrientation() {
return this.orientation;
}
public final boolean getSpaceBetweenItemsOnly() {
return this.spaceBetweenItemsOnly;
}
public final int getSpaceHorz() {
return this.spaceHorz;
}
public final int getSpaceVert() {
return this.spaceVert;
}
}