80 lines
3.2 KiB
Java
80 lines
3.2 KiB
Java
|
package com.discord.widgets.chat.list.actions;
|
||
|
|
||
|
import android.view.ViewGroup;
|
||
|
import androidx.recyclerview.widget.RecyclerView;
|
||
|
import com.discord.models.domain.emoji.Emoji;
|
||
|
import com.discord.utilities.mg_recycler.MGRecyclerAdapterSimple;
|
||
|
import com.discord.utilities.mg_recycler.MGRecyclerViewHolder;
|
||
|
import com.discord.widgets.chat.list.actions.EmojiItem;
|
||
|
import d0.t.n;
|
||
|
import d0.t.o;
|
||
|
import d0.t.u;
|
||
|
import d0.z.d.m;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.Collection;
|
||
|
import java.util.List;
|
||
|
import kotlin.Unit;
|
||
|
import kotlin.jvm.functions.Function0;
|
||
|
import kotlin.jvm.functions.Function1;
|
||
|
/* compiled from: WidgetChatListActionsEmojisAdapter.kt */
|
||
|
public final class WidgetChatListActionsEmojisAdapter extends MGRecyclerAdapterSimple<EmojiItem> {
|
||
|
private Function1<? super Emoji, Unit> onClickEmoji = WidgetChatListActionsEmojisAdapter$onClickEmoji$1.INSTANCE;
|
||
|
private Function0<Unit> onClickMoreEmojis = WidgetChatListActionsEmojisAdapter$onClickMoreEmojis$1.INSTANCE;
|
||
|
|
||
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
||
|
public WidgetChatListActionsEmojisAdapter(RecyclerView recyclerView) {
|
||
|
super(recyclerView, false, 2, null);
|
||
|
m.checkNotNullParameter(recyclerView, "recycler");
|
||
|
}
|
||
|
|
||
|
private final List<EmojiItem> getEmojiItems(List<? extends Emoji> list, int i) {
|
||
|
if (list.isEmpty() || i <= 0) {
|
||
|
return n.emptyList();
|
||
|
}
|
||
|
List<Emoji> take = u.take(list, i - 1);
|
||
|
ArrayList arrayList = new ArrayList(o.collectionSizeOrDefault(take, 10));
|
||
|
for (Emoji emoji : take) {
|
||
|
arrayList.add(new EmojiItem.EmojiData(emoji));
|
||
|
}
|
||
|
List<EmojiItem> mutableList = u.toMutableList((Collection) arrayList);
|
||
|
mutableList.add(EmojiItem.MoreEmoji.INSTANCE);
|
||
|
return mutableList;
|
||
|
}
|
||
|
|
||
|
/* JADX DEBUG: Type inference failed for r0v0. Raw type applied. Possible types: kotlin.jvm.functions.Function1<? super com.discord.models.domain.emoji.Emoji, kotlin.Unit>, kotlin.jvm.functions.Function1<com.discord.models.domain.emoji.Emoji, kotlin.Unit> */
|
||
|
public final Function1<Emoji, Unit> getOnClickEmoji() {
|
||
|
return this.onClickEmoji;
|
||
|
}
|
||
|
|
||
|
public final Function0<Unit> getOnClickMoreEmojis() {
|
||
|
return this.onClickMoreEmojis;
|
||
|
}
|
||
|
|
||
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||
|
public MGRecyclerViewHolder<?, EmojiItem> onCreateViewHolder(ViewGroup viewGroup, int i) {
|
||
|
m.checkNotNullParameter(viewGroup, "parent");
|
||
|
if (i == 0) {
|
||
|
return new EmojiViewHolder(this);
|
||
|
}
|
||
|
if (i == 1) {
|
||
|
return new MoreEmojisViewHolder(this);
|
||
|
}
|
||
|
throw invalidViewTypeException(i);
|
||
|
}
|
||
|
|
||
|
public final void setData(List<? extends Emoji> list, int i) {
|
||
|
m.checkNotNullParameter(list, "emojis");
|
||
|
setData(getEmojiItems(list, i));
|
||
|
}
|
||
|
|
||
|
public final void setOnClickEmoji(Function1<? super Emoji, Unit> function1) {
|
||
|
m.checkNotNullParameter(function1, "<set-?>");
|
||
|
this.onClickEmoji = function1;
|
||
|
}
|
||
|
|
||
|
public final void setOnClickMoreEmojis(Function0<Unit> function0) {
|
||
|
m.checkNotNullParameter(function0, "<set-?>");
|
||
|
this.onClickMoreEmojis = function0;
|
||
|
}
|
||
|
}
|