148 lines
8.2 KiB
Java
148 lines
8.2 KiB
Java
package com.discord.widgets.chat.input.emoji;
|
|
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.ImageView;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import c.d.b.a.a;
|
|
import com.discord.app.AppComponent;
|
|
import com.discord.databinding.EmojiCategoryItemGuildBinding;
|
|
import com.discord.databinding.EmojiCategoryItemStandardBinding;
|
|
import com.discord.utilities.recycler.DiffCreator;
|
|
import com.discord.widgets.chat.input.emoji.EmojiCategoryItem;
|
|
import com.discord.widgets.chat.input.emoji.EmojiCategoryViewHolder;
|
|
import d0.t.n;
|
|
import d0.z.d.m;
|
|
import java.util.List;
|
|
import java.util.Objects;
|
|
import kotlin.NoWhenBranchMatchedException;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
/* compiled from: EmojiCategoryAdapter.kt */
|
|
public final class EmojiCategoryAdapter extends RecyclerView.Adapter<EmojiCategoryViewHolder> {
|
|
private final DiffCreator<List<EmojiCategoryItem>, EmojiCategoryViewHolder> diffCreator;
|
|
private List<? extends EmojiCategoryItem> items;
|
|
private final Function1<EmojiCategoryItem, Unit> onCategoryClicked;
|
|
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.emoji.EmojiCategoryItem, kotlin.Unit> */
|
|
/* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: kotlin.jvm.functions.Function1<? super java.lang.Integer, kotlin.Unit> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public EmojiCategoryAdapter(Function1<? super EmojiCategoryItem, Unit> function1, Function1<? super Integer, Unit> function12, AppComponent appComponent, DiffCreator<List<EmojiCategoryItem>, EmojiCategoryViewHolder> diffCreator) {
|
|
m.checkNotNullParameter(function1, "onCategoryClicked");
|
|
m.checkNotNullParameter(function12, "onSelectedItemAdapterPositionUpdated");
|
|
m.checkNotNullParameter(appComponent, "appComponent");
|
|
m.checkNotNullParameter(diffCreator, "diffCreator");
|
|
this.onCategoryClicked = function1;
|
|
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 */ EmojiCategoryAdapter(Function1 function1, Function1 function12, AppComponent appComponent, DiffCreator diffCreator, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(function1, function12, appComponent, (i & 8) != 0 ? new DiffCreator(appComponent) : diffCreator);
|
|
}
|
|
|
|
public static final /* synthetic */ List access$getItems$p(EmojiCategoryAdapter emojiCategoryAdapter) {
|
|
return emojiCategoryAdapter.items;
|
|
}
|
|
|
|
public static final /* synthetic */ Function1 access$getOnSelectedItemAdapterPositionUpdated$p(EmojiCategoryAdapter emojiCategoryAdapter) {
|
|
return emojiCategoryAdapter.onSelectedItemAdapterPositionUpdated;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setItems$p(EmojiCategoryAdapter emojiCategoryAdapter, List list) {
|
|
emojiCategoryAdapter.items = list;
|
|
}
|
|
|
|
public final EmojiCategoryItem getItemAtPosition(int i) {
|
|
return (EmojiCategoryItem) this.items.get(i);
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public int getItemCount() {
|
|
return this.items.size();
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public long getItemId(int i) {
|
|
return ((EmojiCategoryItem) this.items.get(i)).getStableId();
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public int getItemViewType(int i) {
|
|
EmojiCategoryItem emojiCategoryItem = (EmojiCategoryItem) this.items.get(i);
|
|
if (emojiCategoryItem instanceof EmojiCategoryItem.StandardItem) {
|
|
return 0;
|
|
}
|
|
if (emojiCategoryItem instanceof EmojiCategoryItem.GuildItem) {
|
|
return 1;
|
|
}
|
|
throw new NoWhenBranchMatchedException();
|
|
}
|
|
|
|
public void onBindViewHolder(EmojiCategoryViewHolder emojiCategoryViewHolder, int i) {
|
|
m.checkNotNullParameter(emojiCategoryViewHolder, "holder");
|
|
if (emojiCategoryViewHolder instanceof EmojiCategoryViewHolder.Standard) {
|
|
Object obj = this.items.get(i);
|
|
Objects.requireNonNull(obj, "null cannot be cast to non-null type com.discord.widgets.chat.input.emoji.EmojiCategoryItem.StandardItem");
|
|
((EmojiCategoryViewHolder.Standard) emojiCategoryViewHolder).configure((EmojiCategoryItem.StandardItem) obj, this.onCategoryClicked);
|
|
} else if (emojiCategoryViewHolder instanceof EmojiCategoryViewHolder.Guild) {
|
|
Object obj2 = this.items.get(i);
|
|
Objects.requireNonNull(obj2, "null cannot be cast to non-null type com.discord.widgets.chat.input.emoji.EmojiCategoryItem.GuildItem");
|
|
((EmojiCategoryViewHolder.Guild) emojiCategoryViewHolder).configure((EmojiCategoryItem.GuildItem) obj2, this.onCategoryClicked);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public EmojiCategoryViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
|
m.checkNotNullParameter(viewGroup, "parent");
|
|
LayoutInflater from = LayoutInflater.from(viewGroup.getContext());
|
|
int i2 = 2131364168;
|
|
if (i == 0) {
|
|
View inflate = from.inflate(2131558482, viewGroup, false);
|
|
ImageView imageView = (ImageView) inflate.findViewById(2131363032);
|
|
if (imageView != null) {
|
|
View findViewById = inflate.findViewById(2131364168);
|
|
if (findViewById != null) {
|
|
EmojiCategoryItemStandardBinding emojiCategoryItemStandardBinding = new EmojiCategoryItemStandardBinding((FrameLayout) inflate, imageView, new c.a.i.n(findViewById, findViewById));
|
|
m.checkNotNullExpressionValue(emojiCategoryItemStandardBinding, "EmojiCategoryItemStandar…(inflater, parent, false)");
|
|
return new EmojiCategoryViewHolder.Standard(emojiCategoryItemStandardBinding);
|
|
}
|
|
} else {
|
|
i2 = 2131363032;
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i2)));
|
|
} else if (i == 1) {
|
|
View inflate2 = from.inflate(2131558481, viewGroup, false);
|
|
GuildIcon guildIcon = (GuildIcon) inflate2.findViewById(2131363031);
|
|
if (guildIcon != null) {
|
|
View findViewById2 = inflate2.findViewById(2131364168);
|
|
if (findViewById2 != null) {
|
|
EmojiCategoryItemGuildBinding emojiCategoryItemGuildBinding = new EmojiCategoryItemGuildBinding((FrameLayout) inflate2, guildIcon, new c.a.i.n(findViewById2, findViewById2));
|
|
m.checkNotNullExpressionValue(emojiCategoryItemGuildBinding, "EmojiCategoryItemGuildBi…(inflater, parent, false)");
|
|
return new EmojiCategoryViewHolder.Guild(emojiCategoryItemGuildBinding);
|
|
}
|
|
} else {
|
|
i2 = 2131363031;
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(inflate2.getResources().getResourceName(i2)));
|
|
} else {
|
|
StringBuilder M = a.M("invalid viewType ", i, " for ");
|
|
M.append(EmojiCategoryAdapter.class.getSimpleName());
|
|
throw new IllegalArgumentException(M.toString());
|
|
}
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v1, resolved type: com.discord.utilities.recycler.DiffCreator<java.util.List<com.discord.widgets.chat.input.emoji.EmojiCategoryItem>, com.discord.widgets.chat.input.emoji.EmojiCategoryViewHolder> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public final void setItems(List<? extends EmojiCategoryItem> list) {
|
|
m.checkNotNullParameter(list, "newItems");
|
|
this.diffCreator.dispatchDiffUpdatesAsync(this, new EmojiCategoryAdapter$setItems$1(this), this.items, list);
|
|
}
|
|
}
|