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

172 lines
10 KiB
Java

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.StickerCategoryItemGuildBinding;
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.emoji.GuildIcon;
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.GuildItem, Unit> onGuildClicked;
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$GuildItem, kotlin.Unit> */
/* JADX DEBUG: Multi-variable search result rejected for r3v0, 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 r5v0, resolved type: kotlin.jvm.functions.Function1<? super java.lang.Integer, kotlin.Unit> */
/* JADX WARN: Multi-variable type inference failed */
public StickerCategoryAdapter(Function1<? super StickerCategoryItem.GuildItem, Unit> function1, Function1<? super StickerCategoryItem.PackItem, Unit> function12, Function0<Unit> function0, Function1<? super Integer, Unit> function13, AppComponent appComponent, DiffCreator<List<StickerCategoryItem>, StickerCategoryViewHolder> diffCreator) {
m.checkNotNullParameter(function1, "onGuildClicked");
m.checkNotNullParameter(function12, "onPackClicked");
m.checkNotNullParameter(function0, "onRecentClicked");
m.checkNotNullParameter(function13, "onSelectedItemAdapterPositionUpdated");
m.checkNotNullParameter(appComponent, "appComponent");
m.checkNotNullParameter(diffCreator, "diffCreator");
this.onGuildClicked = function1;
this.onPackClicked = function12;
this.onRecentClicked = function0;
this.onSelectedItemAdapterPositionUpdated = function13;
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, Function1 function12, Function0 function0, Function1 function13, AppComponent appComponent, DiffCreator diffCreator, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(function1, function12, function0, function13, appComponent, (i & 32) != 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();
}
if (stickerCategoryItem instanceof StickerCategoryItem.GuildItem) {
return ((StickerCategoryItem.GuildItem) stickerCategoryItem).getGuild().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;
}
if (stickerCategoryItem instanceof StickerCategoryItem.GuildItem) {
return 2;
}
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);
} else if (stickerCategoryItem instanceof StickerCategoryItem.GuildItem) {
((StickerCategoryViewHolder.Guild) stickerCategoryViewHolder).configure((StickerCategoryItem.GuildItem) stickerCategoryItem, this.onGuildClicked);
}
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public StickerCategoryViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
m.checkNotNullParameter(viewGroup, "parent");
LayoutInflater from = LayoutInflater.from(viewGroup.getContext());
int i2 = 2131364224;
if (i == 0) {
View inflate = from.inflate(2131558673, viewGroup, false);
View findViewById = inflate.findViewById(2131364224);
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);
}
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(2131364224)));
} else if (i == 1) {
View inflate2 = from.inflate(2131558672, viewGroup, false);
View findViewById2 = inflate2.findViewById(2131364224);
if (findViewById2 != null) {
c.a.i.n nVar = new c.a.i.n(findViewById2, findViewById2);
StickerView stickerView = (StickerView) inflate2.findViewById(2131365191);
if (stickerView != null) {
StickerCategoryItemPackBinding stickerCategoryItemPackBinding = new StickerCategoryItemPackBinding((FrameLayout) inflate2, nVar, stickerView);
m.checkNotNullExpressionValue(stickerCategoryItemPackBinding, "StickerCategoryItemPackB…(inflater, parent, false)");
return new StickerCategoryViewHolder.Pack(stickerCategoryItemPackBinding);
}
i2 = 2131365191;
}
throw new NullPointerException("Missing required view with ID: ".concat(inflate2.getResources().getResourceName(i2)));
} else if (i == 2) {
View inflate3 = from.inflate(2131558671, viewGroup, false);
View findViewById3 = inflate3.findViewById(2131364224);
if (findViewById3 != null) {
c.a.i.n nVar2 = new c.a.i.n(findViewById3, findViewById3);
GuildIcon guildIcon = (GuildIcon) inflate3.findViewById(2131365190);
if (guildIcon != null) {
StickerCategoryItemGuildBinding stickerCategoryItemGuildBinding = new StickerCategoryItemGuildBinding((FrameLayout) inflate3, nVar2, guildIcon);
m.checkNotNullExpressionValue(stickerCategoryItemGuildBinding, "StickerCategoryItemGuild…(inflater, parent, false)");
return new StickerCategoryViewHolder.Guild(stickerCategoryItemGuildBinding);
}
i2 = 2131365190;
}
throw new NullPointerException("Missing required view with ID: ".concat(inflate3.getResources().getResourceName(i2)));
} else {
throw new IllegalStateException(a.j("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);
}
}