discord-jadx/app/src/main/java/com/discord/widgets/chat/input/sticker/StickerCategoryAdapter.java

144 lines
8.2 KiB
Java
Raw Normal View History

2021-06-27 20:44:35 +00:00
package com.discord.widgets.chat.input.sticker;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.recyclerview.widget.RecyclerView;
import c.d.b.a.a;
import com.discord.app.AppComponent;
import com.discord.databinding.StickerCategoryItemPackBinding;
import com.discord.databinding.StickerCategoryItemRecentBinding;
import com.discord.utilities.recycler.DiffCreator;
import com.discord.views.sticker.StickerView;
import com.discord.widgets.chat.input.sticker.StickerCategoryItem;
import com.discord.widgets.chat.input.sticker.StickerCategoryViewHolder;
import d0.t.n;
import d0.z.d.m;
import java.util.List;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
/* compiled from: StickerCategoryAdapter.kt */
public final class StickerCategoryAdapter extends RecyclerView.Adapter<StickerCategoryViewHolder> {
private final DiffCreator<List<StickerCategoryItem>, StickerCategoryViewHolder> diffCreator;
private List<? extends StickerCategoryItem> items;
private final Function1<StickerCategoryItem.PackItem, Unit> onPackClicked;
private final Function0<Unit> onRecentClicked;
private final Function1<Integer, Unit> onSelectedItemAdapterPositionUpdated;
/* JADX DEBUG: Multi-variable search result rejected for r2v0, resolved type: kotlin.jvm.functions.Function1<? super com.discord.widgets.chat.input.sticker.StickerCategoryItem$PackItem, kotlin.Unit> */
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: kotlin.jvm.functions.Function1<? super java.lang.Integer, kotlin.Unit> */
/* JADX WARN: Multi-variable type inference failed */
public StickerCategoryAdapter(Function1<? super StickerCategoryItem.PackItem, Unit> function1, Function0<Unit> function0, Function1<? super Integer, Unit> function12, AppComponent appComponent, DiffCreator<List<StickerCategoryItem>, StickerCategoryViewHolder> diffCreator) {
m.checkNotNullParameter(function1, "onPackClicked");
m.checkNotNullParameter(function0, "onRecentClicked");
m.checkNotNullParameter(function12, "onSelectedItemAdapterPositionUpdated");
m.checkNotNullParameter(appComponent, "appComponent");
m.checkNotNullParameter(diffCreator, "diffCreator");
this.onPackClicked = function1;
this.onRecentClicked = function0;
this.onSelectedItemAdapterPositionUpdated = function12;
this.diffCreator = diffCreator;
this.items = n.emptyList();
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ StickerCategoryAdapter(Function1 function1, Function0 function0, Function1 function12, AppComponent appComponent, DiffCreator diffCreator, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(function1, function0, function12, appComponent, (i & 16) != 0 ? new DiffCreator(appComponent) : diffCreator);
}
public static final /* synthetic */ List access$getItems$p(StickerCategoryAdapter stickerCategoryAdapter) {
return stickerCategoryAdapter.items;
}
public static final /* synthetic */ Function1 access$getOnSelectedItemAdapterPositionUpdated$p(StickerCategoryAdapter stickerCategoryAdapter) {
return stickerCategoryAdapter.onSelectedItemAdapterPositionUpdated;
}
public static final /* synthetic */ void access$setItems$p(StickerCategoryAdapter stickerCategoryAdapter, List list) {
stickerCategoryAdapter.items = list;
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public int getItemCount() {
return this.items.size();
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public long getItemId(int i) {
StickerCategoryItem stickerCategoryItem = (StickerCategoryItem) this.items.get(i);
if (stickerCategoryItem instanceof StickerCategoryItem.RecentItem) {
return -1;
}
if (stickerCategoryItem instanceof StickerCategoryItem.PackItem) {
return ((StickerCategoryItem.PackItem) stickerCategoryItem).getPack().getId();
}
throw new NoWhenBranchMatchedException();
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public int getItemViewType(int i) {
StickerCategoryItem stickerCategoryItem = (StickerCategoryItem) this.items.get(i);
if (stickerCategoryItem instanceof StickerCategoryItem.RecentItem) {
return 0;
}
if (stickerCategoryItem instanceof StickerCategoryItem.PackItem) {
return 1;
}
throw new NoWhenBranchMatchedException();
}
public void onBindViewHolder(StickerCategoryViewHolder stickerCategoryViewHolder, int i) {
m.checkNotNullParameter(stickerCategoryViewHolder, "holder");
StickerCategoryItem stickerCategoryItem = (StickerCategoryItem) this.items.get(i);
if (stickerCategoryItem instanceof StickerCategoryItem.RecentItem) {
((StickerCategoryViewHolder.Recent) stickerCategoryViewHolder).configure((StickerCategoryItem.RecentItem) stickerCategoryItem, this.onRecentClicked);
} else if (stickerCategoryItem instanceof StickerCategoryItem.PackItem) {
((StickerCategoryViewHolder.Pack) stickerCategoryViewHolder).configure((StickerCategoryItem.PackItem) stickerCategoryItem, this.onPackClicked);
}
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public StickerCategoryViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
m.checkNotNullParameter(viewGroup, "parent");
LayoutInflater from = LayoutInflater.from(viewGroup.getContext());
2021-06-27 20:53:42 +00:00
int i2 = 2131364125;
2021-06-27 20:44:35 +00:00
if (i == 0) {
View inflate = from.inflate(2131558667, viewGroup, false);
2021-06-27 20:53:42 +00:00
View findViewById = inflate.findViewById(2131364125);
2021-06-27 20:44:35 +00:00
if (findViewById != null) {
StickerCategoryItemRecentBinding stickerCategoryItemRecentBinding = new StickerCategoryItemRecentBinding((FrameLayout) inflate, new c.a.i.n(findViewById, findViewById));
m.checkNotNullExpressionValue(stickerCategoryItemRecentBinding, "StickerCategoryItemRecen…(inflater, parent, false)");
return new StickerCategoryViewHolder.Recent(stickerCategoryItemRecentBinding);
}
2021-06-27 20:53:42 +00:00
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(2131364125)));
2021-06-27 20:44:35 +00:00
} else if (i == 1) {
View inflate2 = from.inflate(2131558666, viewGroup, false);
2021-06-27 20:53:42 +00:00
View findViewById2 = inflate2.findViewById(2131364125);
2021-06-27 20:44:35 +00:00
if (findViewById2 != null) {
c.a.i.n nVar = new c.a.i.n(findViewById2, findViewById2);
2021-06-27 20:53:42 +00:00
StickerView stickerView = (StickerView) inflate2.findViewById(2131365073);
2021-06-27 20:44:35 +00:00
if (stickerView != null) {
StickerCategoryItemPackBinding stickerCategoryItemPackBinding = new StickerCategoryItemPackBinding((FrameLayout) inflate2, nVar, stickerView);
m.checkNotNullExpressionValue(stickerCategoryItemPackBinding, "StickerCategoryItemPackB…(inflater, parent, false)");
return new StickerCategoryViewHolder.Pack(stickerCategoryItemPackBinding);
}
2021-06-27 20:53:42 +00:00
i2 = 2131365073;
2021-06-27 20:44:35 +00:00
}
throw new NullPointerException("Missing required view with ID: ".concat(inflate2.getResources().getResourceName(i2)));
} else {
throw new IllegalStateException(a.l("Invalid Sticker Category Type: ", i));
}
}
/* JADX DEBUG: Multi-variable search result rejected for r0v1, resolved type: com.discord.utilities.recycler.DiffCreator<java.util.List<com.discord.widgets.chat.input.sticker.StickerCategoryItem>, com.discord.widgets.chat.input.sticker.StickerCategoryViewHolder> */
/* JADX WARN: Multi-variable type inference failed */
public final void setItems(List<? extends StickerCategoryItem> list) {
m.checkNotNullParameter(list, "newItems");
this.diffCreator.dispatchDiffUpdatesAsync(this, new StickerCategoryAdapter$setItems$1(this), this.items, list);
}
}