53 lines
2.5 KiB
Java
53 lines
2.5 KiB
Java
package com.discord.utilities.recycler;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.Paint;
|
|
import android.graphics.Rect;
|
|
import android.graphics.drawable.ShapeDrawable;
|
|
import android.view.View;
|
|
import androidx.annotation.ColorRes;
|
|
import androidx.core.content.ContextCompat;
|
|
import androidx.recyclerview.widget.DividerItemDecoration;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import com.discord.utilities.dimen.DimenUtils;
|
|
import d0.z.d.m;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
/* compiled from: SpaceBetweenItemDecoration.kt */
|
|
public final class SpaceBetweenItemDecoration extends DividerItemDecoration {
|
|
private final RecyclerView.Adapter<?> adapter;
|
|
private final int color;
|
|
private final int sizePx;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public SpaceBetweenItemDecoration(Context context, int i, RecyclerView.Adapter<?> adapter, int i2, @ColorRes int i3) {
|
|
super(context, i);
|
|
m.checkNotNullParameter(context, "context");
|
|
m.checkNotNullParameter(adapter, "adapter");
|
|
this.adapter = adapter;
|
|
this.sizePx = i2;
|
|
this.color = i3;
|
|
ShapeDrawable shapeDrawable = new ShapeDrawable();
|
|
shapeDrawable.setIntrinsicWidth(i2);
|
|
shapeDrawable.setIntrinsicHeight(i2);
|
|
Paint paint = shapeDrawable.getPaint();
|
|
m.checkNotNullExpressionValue(paint, "paint");
|
|
paint.setColor(ContextCompat.getColor(context, i3));
|
|
setDrawable(shapeDrawable);
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ SpaceBetweenItemDecoration(Context context, int i, RecyclerView.Adapter adapter, int i2, int i3, int i4, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(context, i, adapter, (i4 & 8) != 0 ? DimenUtils.dpToPixels(16) : i2, (i4 & 16) != 0 ? 17170445 : i3);
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.DividerItemDecoration, 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");
|
|
if (recyclerView.getChildAdapterPosition(view) != this.adapter.getItemCount() - 1) {
|
|
super.getItemOffsets(rect, view, recyclerView, state);
|
|
}
|
|
}
|
|
}
|