2021-06-27 20:44:35 +00:00
|
|
|
package com.discord.widgets.channels;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
import c.d.b.a.a;
|
|
|
|
import com.discord.api.role.GuildRole;
|
|
|
|
import com.discord.databinding.SimpleRoleListItemBinding;
|
|
|
|
import com.discord.utilities.guilds.RoleUtils;
|
|
|
|
import com.discord.utilities.mg_recycler.MGRecyclerAdapterSimple;
|
|
|
|
import com.discord.utilities.mg_recycler.MGRecyclerDataPayload;
|
|
|
|
import com.discord.utilities.mg_recycler.MGRecyclerViewHolder;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Objects;
|
|
|
|
import kotlin.Unit;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
/* compiled from: SimpleRolesAdapter.kt */
|
|
|
|
public final class SimpleRolesAdapter extends MGRecyclerAdapterSimple<RoleItem> {
|
|
|
|
private Function1<? super GuildRole, Unit> onRoleClickedListener;
|
|
|
|
|
|
|
|
/* compiled from: SimpleRolesAdapter.kt */
|
|
|
|
public static final class RoleAdapterItem extends MGRecyclerViewHolder<SimpleRolesAdapter, RoleItem> {
|
|
|
|
private final SimpleRoleListItemBinding binding;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public RoleAdapterItem(SimpleRolesAdapter simpleRolesAdapter) {
|
2021-07-13 20:23:20 +00:00
|
|
|
super(2131558660, simpleRolesAdapter);
|
2021-06-27 20:44:35 +00:00
|
|
|
m.checkNotNullParameter(simpleRolesAdapter, "adapter");
|
|
|
|
View view = this.itemView;
|
|
|
|
Objects.requireNonNull(view, "rootView");
|
|
|
|
TextView textView = (TextView) view;
|
|
|
|
SimpleRoleListItemBinding simpleRoleListItemBinding = new SimpleRoleListItemBinding(textView, textView);
|
|
|
|
m.checkNotNullExpressionValue(simpleRoleListItemBinding, "SimpleRoleListItemBinding.bind(itemView)");
|
|
|
|
this.binding = simpleRoleListItemBinding;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ SimpleRolesAdapter access$getAdapter$p(RoleAdapterItem roleAdapterItem) {
|
|
|
|
return (SimpleRolesAdapter) roleAdapterItem.adapter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void onConfigure(int i, RoleItem roleItem) {
|
|
|
|
m.checkNotNullParameter(roleItem, "data");
|
|
|
|
super.onConfigure(i, (int) roleItem);
|
|
|
|
TextView textView = this.binding.b;
|
|
|
|
m.checkNotNullExpressionValue(textView, "binding.serverSettingsRoleItemName");
|
|
|
|
textView.setText(roleItem.getRole().f());
|
|
|
|
this.binding.a.setOnClickListener(new SimpleRolesAdapter$RoleAdapterItem$onConfigure$1(this, roleItem));
|
|
|
|
TextView textView2 = this.binding.b;
|
|
|
|
GuildRole role = roleItem.getRole();
|
|
|
|
TextView textView3 = this.binding.b;
|
|
|
|
m.checkNotNullExpressionValue(textView3, "binding.serverSettingsRoleItemName");
|
|
|
|
Context context = textView3.getContext();
|
|
|
|
m.checkNotNullExpressionValue(context, "binding.serverSettingsRoleItemName.context");
|
|
|
|
textView2.setTextColor(RoleUtils.getRoleColor$default(role, context, null, 2, null));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: SimpleRolesAdapter.kt */
|
|
|
|
public static final class RoleItem implements MGRecyclerDataPayload, Comparable<RoleItem> {
|
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
public static final int TYPE_ROLE = 0;
|
|
|
|
private final String key;
|
|
|
|
private final GuildRole role;
|
|
|
|
private final int type;
|
|
|
|
|
|
|
|
/* compiled from: SimpleRolesAdapter.kt */
|
|
|
|
public static final class Companion {
|
|
|
|
private Companion() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public RoleItem(GuildRole guildRole) {
|
|
|
|
m.checkNotNullParameter(guildRole, "role");
|
|
|
|
this.role = guildRole;
|
|
|
|
this.key = String.valueOf(guildRole.getId());
|
|
|
|
}
|
|
|
|
|
|
|
|
public static /* synthetic */ RoleItem copy$default(RoleItem roleItem, GuildRole guildRole, int i, Object obj) {
|
|
|
|
if ((i & 1) != 0) {
|
|
|
|
guildRole = roleItem.role;
|
|
|
|
}
|
|
|
|
return roleItem.copy(guildRole);
|
|
|
|
}
|
|
|
|
|
|
|
|
public int compareTo(RoleItem roleItem) {
|
|
|
|
m.checkNotNullParameter(roleItem, "other");
|
|
|
|
return RoleUtils.getROLE_COMPARATOR().compare(this.role, roleItem.role);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final GuildRole component1() {
|
|
|
|
return this.role;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final RoleItem copy(GuildRole guildRole) {
|
|
|
|
m.checkNotNullParameter(guildRole, "role");
|
|
|
|
return new RoleItem(guildRole);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // java.lang.Object
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
if (this != obj) {
|
|
|
|
return (obj instanceof RoleItem) && m.areEqual(this.role, ((RoleItem) obj).role);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
|
|
|
|
public String getKey() {
|
|
|
|
return this.key;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final GuildRole getRole() {
|
|
|
|
return this.role;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
|
|
|
|
public int getType() {
|
|
|
|
return this.type;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // java.lang.Object
|
|
|
|
public int hashCode() {
|
|
|
|
GuildRole guildRole = this.role;
|
|
|
|
if (guildRole != null) {
|
|
|
|
return guildRole.hashCode();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // java.lang.Object
|
|
|
|
public String toString() {
|
|
|
|
StringBuilder L = a.L("RoleItem(role=");
|
|
|
|
L.append(this.role);
|
|
|
|
L.append(")");
|
|
|
|
return L.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public SimpleRolesAdapter(RecyclerView recyclerView) {
|
|
|
|
super(recyclerView, false, 2, null);
|
|
|
|
m.checkNotNullParameter(recyclerView, "recycler");
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ Function1 access$getOnRoleClickedListener$p(SimpleRolesAdapter simpleRolesAdapter) {
|
|
|
|
return simpleRolesAdapter.onRoleClickedListener;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$setOnRoleClickedListener$p(SimpleRolesAdapter simpleRolesAdapter, Function1 function1) {
|
|
|
|
simpleRolesAdapter.onRoleClickedListener = function1;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
|
|
public RoleAdapterItem onCreateViewHolder(ViewGroup viewGroup, int i) {
|
|
|
|
m.checkNotNullParameter(viewGroup, "parent");
|
|
|
|
if (i == 0) {
|
|
|
|
return new RoleAdapterItem(this);
|
|
|
|
}
|
|
|
|
throw invalidViewTypeException(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void setData(List<RoleItem> list, Function1<? super GuildRole, Unit> function1) {
|
|
|
|
m.checkNotNullParameter(list, "data");
|
|
|
|
m.checkNotNullParameter(function1, "onRoleClickedListener");
|
|
|
|
super.setData(list);
|
|
|
|
this.onRoleClickedListener = function1;
|
|
|
|
}
|
|
|
|
}
|