186 lines
7.3 KiB
Java
186 lines
7.3 KiB
Java
package com.discord.widgets.channels;
|
|
|
|
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.R;
|
|
import com.discord.databinding.SimpleMemberListItemBinding;
|
|
import com.discord.models.member.GuildMember;
|
|
import com.discord.models.user.User;
|
|
import com.discord.utilities.mg_recycler.MGRecyclerAdapterSimple;
|
|
import com.discord.utilities.mg_recycler.MGRecyclerDataPayload;
|
|
import com.discord.utilities.mg_recycler.MGRecyclerViewHolder;
|
|
import com.discord.widgets.channels.permissions.ChannelSettingsPermissionsMemberView;
|
|
import d0.z.d.m;
|
|
import java.util.List;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
/* compiled from: SimpleMembersAdapter.kt */
|
|
public final class SimpleMembersAdapter extends MGRecyclerAdapterSimple<MemberItem> {
|
|
private Function1<? super User, Unit> onUserClickedListener;
|
|
|
|
/* compiled from: SimpleMembersAdapter.kt */
|
|
public static final class MemberAdapterItem extends MGRecyclerViewHolder<SimpleMembersAdapter, MemberItem> {
|
|
private final SimpleMemberListItemBinding binding;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public MemberAdapterItem(SimpleMembersAdapter simpleMembersAdapter) {
|
|
super((int) R.layout.simple_member_list_item, simpleMembersAdapter);
|
|
m.checkNotNullParameter(simpleMembersAdapter, "adapter");
|
|
View view = this.itemView;
|
|
ChannelSettingsPermissionsMemberView channelSettingsPermissionsMemberView = (ChannelSettingsPermissionsMemberView) view.findViewById(R.id.member_view);
|
|
if (channelSettingsPermissionsMemberView != null) {
|
|
SimpleMemberListItemBinding simpleMemberListItemBinding = new SimpleMemberListItemBinding((FrameLayout) view, channelSettingsPermissionsMemberView);
|
|
m.checkNotNullExpressionValue(simpleMemberListItemBinding, "SimpleMemberListItemBinding.bind(itemView)");
|
|
this.binding = simpleMemberListItemBinding;
|
|
return;
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(R.id.member_view)));
|
|
}
|
|
|
|
public static final /* synthetic */ SimpleMembersAdapter access$getAdapter$p(MemberAdapterItem memberAdapterItem) {
|
|
return (SimpleMembersAdapter) memberAdapterItem.adapter;
|
|
}
|
|
|
|
public void onConfigure(int i, MemberItem memberItem) {
|
|
m.checkNotNullParameter(memberItem, "data");
|
|
super.onConfigure(i, (int) memberItem);
|
|
User user = memberItem.getUser();
|
|
this.binding.b.configure(user, memberItem.getGuildMember());
|
|
this.binding.a.setOnClickListener(new SimpleMembersAdapter$MemberAdapterItem$onConfigure$1(this, user));
|
|
}
|
|
}
|
|
|
|
/* compiled from: SimpleMembersAdapter.kt */
|
|
public static final class MemberItem implements MGRecyclerDataPayload {
|
|
public static final Companion Companion = new Companion(null);
|
|
public static final int TYPE_MEMBER = 0;
|
|
private final GuildMember guildMember;
|
|
private final String key;
|
|
private final int type;
|
|
private final User user;
|
|
|
|
/* compiled from: SimpleMembersAdapter.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
public MemberItem(User user, GuildMember guildMember) {
|
|
m.checkNotNullParameter(user, "user");
|
|
this.user = user;
|
|
this.guildMember = guildMember;
|
|
this.key = String.valueOf(user.getId());
|
|
}
|
|
|
|
public static /* synthetic */ MemberItem copy$default(MemberItem memberItem, User user, GuildMember guildMember, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
user = memberItem.user;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
guildMember = memberItem.guildMember;
|
|
}
|
|
return memberItem.copy(user, guildMember);
|
|
}
|
|
|
|
public final User component1() {
|
|
return this.user;
|
|
}
|
|
|
|
public final GuildMember component2() {
|
|
return this.guildMember;
|
|
}
|
|
|
|
public final MemberItem copy(User user, GuildMember guildMember) {
|
|
m.checkNotNullParameter(user, "user");
|
|
return new MemberItem(user, guildMember);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof MemberItem)) {
|
|
return false;
|
|
}
|
|
MemberItem memberItem = (MemberItem) obj;
|
|
return m.areEqual(this.user, memberItem.user) && m.areEqual(this.guildMember, memberItem.guildMember);
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
@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 hashCode = (user != null ? user.hashCode() : 0) * 31;
|
|
GuildMember guildMember = this.guildMember;
|
|
if (guildMember != null) {
|
|
i = guildMember.hashCode();
|
|
}
|
|
return hashCode + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = a.L("MemberItem(user=");
|
|
L.append(this.user);
|
|
L.append(", guildMember=");
|
|
L.append(this.guildMember);
|
|
L.append(")");
|
|
return L.toString();
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public SimpleMembersAdapter(RecyclerView recyclerView) {
|
|
super(recyclerView, false, 2, null);
|
|
m.checkNotNullParameter(recyclerView, "recycler");
|
|
}
|
|
|
|
public static final /* synthetic */ Function1 access$getOnUserClickedListener$p(SimpleMembersAdapter simpleMembersAdapter) {
|
|
return simpleMembersAdapter.onUserClickedListener;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setOnUserClickedListener$p(SimpleMembersAdapter simpleMembersAdapter, Function1 function1) {
|
|
simpleMembersAdapter.onUserClickedListener = function1;
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public MemberAdapterItem onCreateViewHolder(ViewGroup viewGroup, int i) {
|
|
m.checkNotNullParameter(viewGroup, "parent");
|
|
if (i == 0) {
|
|
return new MemberAdapterItem(this);
|
|
}
|
|
throw invalidViewTypeException(i);
|
|
}
|
|
|
|
public final void setData(List<MemberItem> list, Function1<? super User, Unit> function1) {
|
|
m.checkNotNullParameter(list, "data");
|
|
m.checkNotNullParameter(function1, "onUserClickedListener");
|
|
super.setData(list);
|
|
this.onUserClickedListener = function1;
|
|
}
|
|
}
|