discord-jadx/app/src/main/java/b/a/y/f.java

68 lines
3.0 KiB
Java
Raw Normal View History

2021-12-17 22:01:24 +00:00
package b.a.y;
2021-08-10 10:47:20 +00:00
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.view.View;
2021-08-10 10:47:20 +00:00
import android.view.ViewGroup;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.RecyclerView;
import com.discord.R;
import com.discord.utilities.color.ColorCompat;
2021-11-01 07:19:03 +00:00
import d0.z.d.m;
2021-08-10 10:47:20 +00:00
import java.util.Objects;
/* compiled from: DividerDecoration.kt */
public final class f extends DividerItemDecoration {
public final int a;
2021-12-17 22:01:24 +00:00
/* renamed from: b reason: collision with root package name */
2022-01-24 08:17:14 +00:00
public final int f305b;
2021-12-17 22:01:24 +00:00
public final int c;
2021-08-10 10:47:20 +00:00
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public f(Context context, int i, int i2, int i3, int i4, int i5) {
super(context, i);
i2 = (i5 & 4) != 0 ? ColorCompat.getThemedColor(context, (int) R.attr.colorPrimaryDivider) : i2;
i3 = (i5 & 8) != 0 ? 0 : i3;
i4 = (i5 & 16) != 0 ? 0 : i4;
m.checkNotNullParameter(context, "context");
this.a = i2;
2022-01-24 08:17:14 +00:00
this.f305b = i3;
2021-12-17 22:01:24 +00:00
this.c = i4;
2021-08-10 10:47:20 +00:00
Drawable drawable = ContextCompat.getDrawable(context, R.drawable.drawable_divider);
if (drawable != null) {
Drawable wrap = DrawableCompat.wrap(drawable);
DrawableCompat.setTint(wrap, i2);
setDrawable(wrap);
}
}
2021-08-10 10:47:20 +00:00
@Override // androidx.recyclerview.widget.DividerItemDecoration, androidx.recyclerview.widget.RecyclerView.ItemDecoration
public void onDraw(Canvas canvas, RecyclerView recyclerView, RecyclerView.State state) {
m.checkNotNullParameter(canvas, "c");
m.checkNotNullParameter(recyclerView, "parent");
m.checkNotNullParameter(state, "state");
2022-01-24 08:17:14 +00:00
int paddingLeft = recyclerView.getPaddingLeft() + this.f305b;
2021-12-17 22:01:24 +00:00
int width = (recyclerView.getWidth() - recyclerView.getPaddingRight()) - this.c;
2021-08-10 10:47:20 +00:00
Drawable drawable = getDrawable();
int childCount = recyclerView.getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = recyclerView.getChildAt(i);
m.checkNotNullExpressionValue(childAt, "parent.getChildAt(i)");
int bottom = childAt.getBottom();
ViewGroup.LayoutParams layoutParams = childAt.getLayoutParams();
Objects.requireNonNull(layoutParams, "null cannot be cast to non-null type androidx.recyclerview.widget.RecyclerView.LayoutParams");
int i2 = bottom + ((ViewGroup.MarginLayoutParams) ((RecyclerView.LayoutParams) layoutParams)).bottomMargin;
int intrinsicHeight = (drawable != null ? drawable.getIntrinsicHeight() : 0) + i2;
if (drawable != null) {
drawable.setBounds(paddingLeft, i2, width, intrinsicHeight);
}
if (drawable != null) {
drawable.draw(canvas);
}
}
}
}