348 lines
15 KiB
Java
348 lines
15 KiB
Java
package com.discord.widgets.chat.managereactions;
|
|
|
|
import a0.a.a.b;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.ImageView;
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.TextView;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import c.d.b.a.a;
|
|
import com.discord.api.message.reaction.MessageReactionEmoji;
|
|
import com.discord.databinding.WidgetManageReactionsResultErrorBinding;
|
|
import com.discord.databinding.WidgetManageReactionsResultUserBinding;
|
|
import com.discord.models.member.GuildMember;
|
|
import com.discord.models.user.User;
|
|
import com.discord.utilities.icon.IconUtils;
|
|
import com.discord.utilities.mg_recycler.MGRecyclerAdapterSimple;
|
|
import com.discord.utilities.mg_recycler.MGRecyclerDataPayload;
|
|
import com.discord.utilities.mg_recycler.MGRecyclerViewHolder;
|
|
import com.facebook.drawee.view.SimpleDraweeView;
|
|
import d0.z.d.m;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
/* compiled from: ManageReactionsResultsAdapter.kt */
|
|
public final class ManageReactionsResultsAdapter extends MGRecyclerAdapterSimple<MGRecyclerDataPayload> {
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final int VIEW_TYPE_ERROR = 2;
|
|
private static final int VIEW_TYPE_LOADING = 1;
|
|
private static final int VIEW_TYPE_USER = 0;
|
|
|
|
/* compiled from: ManageReactionsResultsAdapter.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* compiled from: ManageReactionsResultsAdapter.kt */
|
|
public static final class ErrorItem implements MGRecyclerDataPayload {
|
|
private final long channelId;
|
|
private final MessageReactionEmoji emoji;
|
|
private final String key = String.valueOf(getType());
|
|
private final long messageId;
|
|
private final int type = 2;
|
|
|
|
public ErrorItem(long j, long j2, MessageReactionEmoji messageReactionEmoji) {
|
|
m.checkNotNullParameter(messageReactionEmoji, "emoji");
|
|
this.channelId = j;
|
|
this.messageId = j2;
|
|
this.emoji = messageReactionEmoji;
|
|
}
|
|
|
|
public final long getChannelId() {
|
|
return this.channelId;
|
|
}
|
|
|
|
public final MessageReactionEmoji getEmoji() {
|
|
return this.emoji;
|
|
}
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
|
|
public String getKey() {
|
|
return this.key;
|
|
}
|
|
|
|
public final long getMessageId() {
|
|
return this.messageId;
|
|
}
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
|
|
public int getType() {
|
|
return this.type;
|
|
}
|
|
}
|
|
|
|
/* compiled from: ManageReactionsResultsAdapter.kt */
|
|
public static final class ErrorViewHolder extends MGRecyclerViewHolder<ManageReactionsResultsAdapter, MGRecyclerDataPayload> {
|
|
private final WidgetManageReactionsResultErrorBinding binding;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public ErrorViewHolder(ManageReactionsResultsAdapter manageReactionsResultsAdapter) {
|
|
super(2131559101, manageReactionsResultsAdapter);
|
|
m.checkNotNullParameter(manageReactionsResultsAdapter, "adapter");
|
|
View view = this.itemView;
|
|
int i = 2131363876;
|
|
ImageView imageView = (ImageView) view.findViewById(2131363876);
|
|
if (imageView != null) {
|
|
i = 2131363877;
|
|
TextView textView = (TextView) view.findViewById(2131363877);
|
|
if (textView != null) {
|
|
WidgetManageReactionsResultErrorBinding widgetManageReactionsResultErrorBinding = new WidgetManageReactionsResultErrorBinding((RelativeLayout) view, imageView, textView);
|
|
m.checkNotNullExpressionValue(widgetManageReactionsResultErrorBinding, "WidgetManageReactionsRes…rorBinding.bind(itemView)");
|
|
this.binding = widgetManageReactionsResultErrorBinding;
|
|
return;
|
|
}
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(i)));
|
|
}
|
|
|
|
public void onConfigure(int i, MGRecyclerDataPayload mGRecyclerDataPayload) {
|
|
m.checkNotNullParameter(mGRecyclerDataPayload, "data");
|
|
super.onConfigure(i, (int) mGRecyclerDataPayload);
|
|
this.binding.b.setOnClickListener(new ManageReactionsResultsAdapter$ErrorViewHolder$onConfigure$1(mGRecyclerDataPayload));
|
|
}
|
|
}
|
|
|
|
/* compiled from: ManageReactionsResultsAdapter.kt */
|
|
public static final class LoadingItem implements MGRecyclerDataPayload {
|
|
private final String key = String.valueOf(getType());
|
|
private final int type = 1;
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
|
|
public String getKey() {
|
|
return this.key;
|
|
}
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
|
|
public int getType() {
|
|
return this.type;
|
|
}
|
|
}
|
|
|
|
/* compiled from: ManageReactionsResultsAdapter.kt */
|
|
public static final class LoadingViewHolder extends MGRecyclerViewHolder<ManageReactionsResultsAdapter, MGRecyclerDataPayload> {
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public LoadingViewHolder(ManageReactionsResultsAdapter manageReactionsResultsAdapter) {
|
|
super(2131559102, manageReactionsResultsAdapter);
|
|
m.checkNotNullParameter(manageReactionsResultsAdapter, "adapter");
|
|
}
|
|
}
|
|
|
|
/* compiled from: ManageReactionsResultsAdapter.kt */
|
|
public static final class ReactionUserItem implements MGRecyclerDataPayload {
|
|
private final boolean canDelete;
|
|
private final long channelId;
|
|
private final MessageReactionEmoji emoji;
|
|
private final GuildMember guildMember;
|
|
private final String key;
|
|
private final long messageId;
|
|
private final int type;
|
|
private final User user;
|
|
|
|
public ReactionUserItem(User user, long j, long j2, MessageReactionEmoji messageReactionEmoji, boolean z2, GuildMember guildMember) {
|
|
m.checkNotNullParameter(user, "user");
|
|
m.checkNotNullParameter(messageReactionEmoji, "emoji");
|
|
this.user = user;
|
|
this.channelId = j;
|
|
this.messageId = j2;
|
|
this.emoji = messageReactionEmoji;
|
|
this.canDelete = z2;
|
|
this.guildMember = guildMember;
|
|
this.key = String.valueOf(user.getId());
|
|
}
|
|
|
|
public static /* synthetic */ ReactionUserItem copy$default(ReactionUserItem reactionUserItem, User user, long j, long j2, MessageReactionEmoji messageReactionEmoji, boolean z2, GuildMember guildMember, int i, Object obj) {
|
|
return reactionUserItem.copy((i & 1) != 0 ? reactionUserItem.user : user, (i & 2) != 0 ? reactionUserItem.channelId : j, (i & 4) != 0 ? reactionUserItem.messageId : j2, (i & 8) != 0 ? reactionUserItem.emoji : messageReactionEmoji, (i & 16) != 0 ? reactionUserItem.canDelete : z2, (i & 32) != 0 ? reactionUserItem.guildMember : guildMember);
|
|
}
|
|
|
|
public final User component1() {
|
|
return this.user;
|
|
}
|
|
|
|
public final long component2() {
|
|
return this.channelId;
|
|
}
|
|
|
|
public final long component3() {
|
|
return this.messageId;
|
|
}
|
|
|
|
public final MessageReactionEmoji component4() {
|
|
return this.emoji;
|
|
}
|
|
|
|
public final boolean component5() {
|
|
return this.canDelete;
|
|
}
|
|
|
|
public final GuildMember component6() {
|
|
return this.guildMember;
|
|
}
|
|
|
|
public final ReactionUserItem copy(User user, long j, long j2, MessageReactionEmoji messageReactionEmoji, boolean z2, GuildMember guildMember) {
|
|
m.checkNotNullParameter(user, "user");
|
|
m.checkNotNullParameter(messageReactionEmoji, "emoji");
|
|
return new ReactionUserItem(user, j, j2, messageReactionEmoji, z2, guildMember);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof ReactionUserItem)) {
|
|
return false;
|
|
}
|
|
ReactionUserItem reactionUserItem = (ReactionUserItem) obj;
|
|
return m.areEqual(this.user, reactionUserItem.user) && this.channelId == reactionUserItem.channelId && this.messageId == reactionUserItem.messageId && m.areEqual(this.emoji, reactionUserItem.emoji) && this.canDelete == reactionUserItem.canDelete && m.areEqual(this.guildMember, reactionUserItem.guildMember);
|
|
}
|
|
|
|
public final boolean getCanDelete() {
|
|
return this.canDelete;
|
|
}
|
|
|
|
public final long getChannelId() {
|
|
return this.channelId;
|
|
}
|
|
|
|
public final MessageReactionEmoji getEmoji() {
|
|
return this.emoji;
|
|
}
|
|
|
|
public final GuildMember getGuildMember() {
|
|
return this.guildMember;
|
|
}
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
|
|
public String getKey() {
|
|
return this.key;
|
|
}
|
|
|
|
public final long getMessageId() {
|
|
return this.messageId;
|
|
}
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
|
|
public int getType() {
|
|
return this.type;
|
|
}
|
|
|
|
public final User getUser() {
|
|
return this.user;
|
|
}
|
|
|
|
public int hashCode() {
|
|
User user = this.user;
|
|
int i = 0;
|
|
int a = (b.a(this.messageId) + ((b.a(this.channelId) + ((user != null ? user.hashCode() : 0) * 31)) * 31)) * 31;
|
|
MessageReactionEmoji messageReactionEmoji = this.emoji;
|
|
int hashCode = (a + (messageReactionEmoji != null ? messageReactionEmoji.hashCode() : 0)) * 31;
|
|
boolean z2 = this.canDelete;
|
|
if (z2) {
|
|
z2 = true;
|
|
}
|
|
int i2 = z2 ? 1 : 0;
|
|
int i3 = z2 ? 1 : 0;
|
|
int i4 = z2 ? 1 : 0;
|
|
int i5 = (hashCode + i2) * 31;
|
|
GuildMember guildMember = this.guildMember;
|
|
if (guildMember != null) {
|
|
i = guildMember.hashCode();
|
|
}
|
|
return i5 + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("ReactionUserItem(user=");
|
|
K.append(this.user);
|
|
K.append(", channelId=");
|
|
K.append(this.channelId);
|
|
K.append(", messageId=");
|
|
K.append(this.messageId);
|
|
K.append(", emoji=");
|
|
K.append(this.emoji);
|
|
K.append(", canDelete=");
|
|
K.append(this.canDelete);
|
|
K.append(", guildMember=");
|
|
K.append(this.guildMember);
|
|
K.append(")");
|
|
return K.toString();
|
|
}
|
|
}
|
|
|
|
/* compiled from: ManageReactionsResultsAdapter.kt */
|
|
public static final class ReactionUserViewHolder extends MGRecyclerViewHolder<ManageReactionsResultsAdapter, MGRecyclerDataPayload> {
|
|
private final WidgetManageReactionsResultUserBinding binding;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public ReactionUserViewHolder(ManageReactionsResultsAdapter manageReactionsResultsAdapter) {
|
|
super(2131559103, manageReactionsResultsAdapter);
|
|
m.checkNotNullParameter(manageReactionsResultsAdapter, "adapter");
|
|
View view = this.itemView;
|
|
int i = 2131363878;
|
|
ImageView imageView = (ImageView) view.findViewById(2131363878);
|
|
if (imageView != null) {
|
|
i = 2131363879;
|
|
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(2131363879);
|
|
if (simpleDraweeView != null) {
|
|
i = 2131363880;
|
|
TextView textView = (TextView) view.findViewById(2131363880);
|
|
if (textView != null) {
|
|
WidgetManageReactionsResultUserBinding widgetManageReactionsResultUserBinding = new WidgetManageReactionsResultUserBinding((RelativeLayout) view, imageView, simpleDraweeView, textView);
|
|
m.checkNotNullExpressionValue(widgetManageReactionsResultUserBinding, "WidgetManageReactionsRes…serBinding.bind(itemView)");
|
|
this.binding = widgetManageReactionsResultUserBinding;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(i)));
|
|
}
|
|
|
|
public void onConfigure(int i, MGRecyclerDataPayload mGRecyclerDataPayload) {
|
|
String str;
|
|
m.checkNotNullParameter(mGRecyclerDataPayload, "data");
|
|
super.onConfigure(i, (int) mGRecyclerDataPayload);
|
|
if (mGRecyclerDataPayload instanceof ReactionUserItem) {
|
|
TextView textView = this.binding.d;
|
|
m.checkNotNullExpressionValue(textView, "binding.manageReactionsResultUserName");
|
|
ReactionUserItem reactionUserItem = (ReactionUserItem) mGRecyclerDataPayload;
|
|
GuildMember guildMember = reactionUserItem.getGuildMember();
|
|
if (guildMember == null || (str = guildMember.getNick()) == null) {
|
|
str = reactionUserItem.getUser().getUsername();
|
|
}
|
|
textView.setText(str);
|
|
SimpleDraweeView simpleDraweeView = this.binding.f1845c;
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.manageReactionsResultUserAvatar");
|
|
IconUtils.setIcon$default(simpleDraweeView, reactionUserItem.getUser(), 2131165296, null, null, reactionUserItem.getGuildMember(), 24, null);
|
|
ImageView imageView = this.binding.b;
|
|
m.checkNotNullExpressionValue(imageView, "binding.manageReactionsResultRemoveReaction");
|
|
imageView.setVisibility(reactionUserItem.getCanDelete() ? 0 : 8);
|
|
this.binding.b.setOnClickListener(new ManageReactionsResultsAdapter$ReactionUserViewHolder$onConfigure$1(mGRecyclerDataPayload));
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public ManageReactionsResultsAdapter(RecyclerView recyclerView) {
|
|
super(recyclerView, false, 2, null);
|
|
m.checkNotNullParameter(recyclerView, "recycler");
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public MGRecyclerViewHolder<ManageReactionsResultsAdapter, MGRecyclerDataPayload> onCreateViewHolder(ViewGroup viewGroup, int i) {
|
|
m.checkNotNullParameter(viewGroup, "parent");
|
|
if (i == 0) {
|
|
return new ReactionUserViewHolder(this);
|
|
}
|
|
if (i == 1) {
|
|
return new LoadingViewHolder(this);
|
|
}
|
|
if (i == 2) {
|
|
return new ErrorViewHolder(this);
|
|
}
|
|
throw invalidViewTypeException(i);
|
|
}
|
|
}
|