discord-jadx/app/src/main/java/com/discord/widgets/voice/sheet/CallParticipantsAdapter.java

1072 lines
54 KiB
Java

package com.discord.widgets.voice.sheet;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.StringRes;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import b.a.k.b;
import b.a.y.a0;
import b.d.b.a.a;
import com.discord.R;
import com.discord.api.guildscheduledevent.GuildScheduledEvent;
import com.discord.api.voice.state.VoiceState;
import com.discord.databinding.VoiceUserListItemEmbeddedActivityBinding;
import com.discord.databinding.VoiceUserListItemEventBinding;
import com.discord.databinding.VoiceUserListItemHeaderBinding;
import com.discord.databinding.VoiceUserListItemInviteBinding;
import com.discord.databinding.VoiceUserListItemUserBinding;
import com.discord.models.commands.Application;
import com.discord.models.embeddedactivities.EmbeddedActivity;
import com.discord.models.guild.UserGuildMember;
import com.discord.stores.StoreApplicationStreamPreviews;
import com.discord.stores.StoreVoiceParticipants;
import com.discord.utilities.color.ColorCompat;
import com.discord.utilities.colors.RepresentativeColorsKt;
import com.discord.utilities.dimen.DimenUtils;
import com.discord.utilities.icon.IconUtils;
import com.discord.utilities.images.MGImages;
import com.discord.utilities.mg_recycler.MGRecyclerAdapterSimple;
import com.discord.utilities.mg_recycler.MGRecyclerDataPayload;
import com.discord.utilities.mg_recycler.MGRecyclerViewHolder;
import com.discord.utilities.streams.StreamContext;
import com.discord.views.PileView;
import com.discord.views.StreamPreviewView;
import com.discord.views.VoiceUserView;
import com.discord.widgets.guildscheduledevent.GuildScheduledEventItemView;
import com.facebook.drawee.view.SimpleDraweeView;
import com.google.android.material.button.MaterialButton;
import d0.t.o;
import d0.z.d.m;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
/* compiled from: CallParticipantsAdapter.kt */
public final class CallParticipantsAdapter extends MGRecyclerAdapterSimple<MGRecyclerDataPayload> {
public static final Companion Companion = new Companion(null);
private static final int VIEW_TYPE_DIVIDER = 3;
private static final int VIEW_TYPE_EMBEDDED_ACTIVITY = 6;
private static final int VIEW_TYPE_EVENT = 5;
private static final int VIEW_TYPE_HEADER = 1;
private static final int VIEW_TYPE_INVITE = 4;
private static final int VIEW_TYPE_SPECTATORS_HEADER = 2;
private static final int VIEW_TYPE_VOICE_USER = 0;
private final boolean isCallPreview;
private Function0<Unit> onEmbeddedActivityClicked;
private Function1<? super GuildScheduledEvent, Unit> onEventClicked;
private Function1<? super View, Unit> onInviteFriendsClicked;
private Function1<? super GuildScheduledEvent, Unit> onStartEventClicked;
private Function1<? super StreamContext, Unit> onStreamPreviewClicked;
private Function1<? super StoreVoiceParticipants.VoiceUser, Unit> onToggleRingingClicked;
private Function1<? super StoreVoiceParticipants.VoiceUser, Unit> onVoiceUserClicked;
private final boolean quantizeUserAvatars;
/* compiled from: CallParticipantsAdapter.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
/* compiled from: CallParticipantsAdapter.kt */
public static abstract class ListItem implements MGRecyclerDataPayload {
/* compiled from: CallParticipantsAdapter.kt */
public static final class Divider extends ListItem {
public static final Divider INSTANCE = new Divider();
private static final String key = String.valueOf(3);
private static final int type = 3;
private Divider() {
super(null);
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
public String getKey() {
return key;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
public int getType() {
return type;
}
}
/* compiled from: CallParticipantsAdapter.kt */
public static final class EmbeddedActivityItem extends ListItem {
private final Application application;
private final EmbeddedActivity embeddedActivity;
private final String key;
private final List<UserGuildMember> participants;
private final int type = 6;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public EmbeddedActivityItem(EmbeddedActivity embeddedActivity, List<UserGuildMember> list, Application application) {
super(null);
m.checkNotNullParameter(embeddedActivity, "embeddedActivity");
m.checkNotNullParameter(list, "participants");
m.checkNotNullParameter(application, "application");
this.embeddedActivity = embeddedActivity;
this.participants = list;
this.application = application;
this.key = String.valueOf(embeddedActivity.getApplicationId());
}
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.voice.sheet.CallParticipantsAdapter$ListItem$EmbeddedActivityItem */
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ EmbeddedActivityItem copy$default(EmbeddedActivityItem embeddedActivityItem, EmbeddedActivity embeddedActivity, List list, Application application, int i, Object obj) {
if ((i & 1) != 0) {
embeddedActivity = embeddedActivityItem.embeddedActivity;
}
if ((i & 2) != 0) {
list = embeddedActivityItem.participants;
}
if ((i & 4) != 0) {
application = embeddedActivityItem.application;
}
return embeddedActivityItem.copy(embeddedActivity, list, application);
}
public final EmbeddedActivity component1() {
return this.embeddedActivity;
}
public final List<UserGuildMember> component2() {
return this.participants;
}
public final Application component3() {
return this.application;
}
public final EmbeddedActivityItem copy(EmbeddedActivity embeddedActivity, List<UserGuildMember> list, Application application) {
m.checkNotNullParameter(embeddedActivity, "embeddedActivity");
m.checkNotNullParameter(list, "participants");
m.checkNotNullParameter(application, "application");
return new EmbeddedActivityItem(embeddedActivity, list, application);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof EmbeddedActivityItem)) {
return false;
}
EmbeddedActivityItem embeddedActivityItem = (EmbeddedActivityItem) obj;
return m.areEqual(this.embeddedActivity, embeddedActivityItem.embeddedActivity) && m.areEqual(this.participants, embeddedActivityItem.participants) && m.areEqual(this.application, embeddedActivityItem.application);
}
public final Application getApplication() {
return this.application;
}
public final EmbeddedActivity getEmbeddedActivity() {
return this.embeddedActivity;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
public String getKey() {
return this.key;
}
public final List<UserGuildMember> getParticipants() {
return this.participants;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
public int getType() {
return this.type;
}
public int hashCode() {
EmbeddedActivity embeddedActivity = this.embeddedActivity;
int i = 0;
int hashCode = (embeddedActivity != null ? embeddedActivity.hashCode() : 0) * 31;
List<UserGuildMember> list = this.participants;
int hashCode2 = (hashCode + (list != null ? list.hashCode() : 0)) * 31;
Application application = this.application;
if (application != null) {
i = application.hashCode();
}
return hashCode2 + i;
}
public String toString() {
StringBuilder R = a.R("EmbeddedActivityItem(embeddedActivity=");
R.append(this.embeddedActivity);
R.append(", participants=");
R.append(this.participants);
R.append(", application=");
R.append(this.application);
R.append(")");
return R.toString();
}
}
/* compiled from: CallParticipantsAdapter.kt */
public static final class Event extends ListItem {
private final boolean canStartEvent;
private final GuildScheduledEvent event;
private final boolean isCurrentUserInCall;
private final String key = String.valueOf(5);
private final int type = 5;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public Event(GuildScheduledEvent guildScheduledEvent, boolean z2, boolean z3) {
super(null);
m.checkNotNullParameter(guildScheduledEvent, "event");
this.event = guildScheduledEvent;
this.canStartEvent = z2;
this.isCurrentUserInCall = z3;
}
public static /* synthetic */ Event copy$default(Event event, GuildScheduledEvent guildScheduledEvent, boolean z2, boolean z3, int i, Object obj) {
if ((i & 1) != 0) {
guildScheduledEvent = event.event;
}
if ((i & 2) != 0) {
z2 = event.canStartEvent;
}
if ((i & 4) != 0) {
z3 = event.isCurrentUserInCall;
}
return event.copy(guildScheduledEvent, z2, z3);
}
public final GuildScheduledEvent component1() {
return this.event;
}
public final boolean component2() {
return this.canStartEvent;
}
public final boolean component3() {
return this.isCurrentUserInCall;
}
public final Event copy(GuildScheduledEvent guildScheduledEvent, boolean z2, boolean z3) {
m.checkNotNullParameter(guildScheduledEvent, "event");
return new Event(guildScheduledEvent, z2, z3);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Event)) {
return false;
}
Event event = (Event) obj;
return m.areEqual(this.event, event.event) && this.canStartEvent == event.canStartEvent && this.isCurrentUserInCall == event.isCurrentUserInCall;
}
public final boolean getCanStartEvent() {
return this.canStartEvent;
}
public final GuildScheduledEvent getEvent() {
return this.event;
}
@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 int hashCode() {
GuildScheduledEvent guildScheduledEvent = this.event;
int hashCode = (guildScheduledEvent != null ? guildScheduledEvent.hashCode() : 0) * 31;
boolean z2 = this.canStartEvent;
int i = 1;
if (z2) {
z2 = true;
}
int i2 = z2 ? 1 : 0;
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = (hashCode + i2) * 31;
boolean z3 = this.isCurrentUserInCall;
if (!z3) {
i = z3 ? 1 : 0;
}
return i5 + i;
}
public final boolean isCurrentUserInCall() {
return this.isCurrentUserInCall;
}
public String toString() {
StringBuilder R = a.R("Event(event=");
R.append(this.event);
R.append(", canStartEvent=");
R.append(this.canStartEvent);
R.append(", isCurrentUserInCall=");
return a.M(R, this.isCurrentUserInCall, ")");
}
}
/* compiled from: CallParticipantsAdapter.kt */
public static final class Header extends ListItem {
private final String key;
private final int stringResId;
private final int type = 1;
public Header(@StringRes int i) {
super(null);
this.stringResId = i;
this.key = String.valueOf(i);
}
public static /* synthetic */ Header copy$default(Header header, int i, int i2, Object obj) {
if ((i2 & 1) != 0) {
i = header.stringResId;
}
return header.copy(i);
}
public final int component1() {
return this.stringResId;
}
public final Header copy(@StringRes int i) {
return new Header(i);
}
public boolean equals(Object obj) {
if (this != obj) {
return (obj instanceof Header) && this.stringResId == ((Header) obj).stringResId;
}
return true;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
public String getKey() {
return this.key;
}
public final int getStringResId() {
return this.stringResId;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
public int getType() {
return this.type;
}
public int hashCode() {
return this.stringResId;
}
public String toString() {
return a.A(a.R("Header(stringResId="), this.stringResId, ")");
}
}
/* compiled from: CallParticipantsAdapter.kt */
public static final class Invite extends ListItem {
public static final Invite INSTANCE = new Invite();
private static final String key = String.valueOf(4);
private static final int type = 4;
private Invite() {
super(null);
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
public String getKey() {
return key;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
public int getType() {
return type;
}
}
/* compiled from: CallParticipantsAdapter.kt */
public static final class SpectatorsHeader extends ListItem {
private final String key = "SpectatorsHeader";
private final String streamerName;
private final int type = 2;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public SpectatorsHeader(String str) {
super(null);
m.checkNotNullParameter(str, "streamerName");
this.streamerName = str;
}
public static /* synthetic */ SpectatorsHeader copy$default(SpectatorsHeader spectatorsHeader, String str, int i, Object obj) {
if ((i & 1) != 0) {
str = spectatorsHeader.streamerName;
}
return spectatorsHeader.copy(str);
}
public final String component1() {
return this.streamerName;
}
public final SpectatorsHeader copy(String str) {
m.checkNotNullParameter(str, "streamerName");
return new SpectatorsHeader(str);
}
public boolean equals(Object obj) {
if (this != obj) {
return (obj instanceof SpectatorsHeader) && m.areEqual(this.streamerName, ((SpectatorsHeader) obj).streamerName);
}
return true;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
public String getKey() {
return this.key;
}
public final String getStreamerName() {
return this.streamerName;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
public int getType() {
return this.type;
}
public int hashCode() {
String str = this.streamerName;
if (str != null) {
return str.hashCode();
}
return 0;
}
public String toString() {
return a.H(a.R("SpectatorsHeader(streamerName="), this.streamerName, ")");
}
}
/* compiled from: CallParticipantsAdapter.kt */
public static final class VoiceUser extends ListItem {
private final boolean canRing;
private final boolean isSpectatingSameStream;
private final String key;
private final StoreVoiceParticipants.VoiceUser participant;
private final int type;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public VoiceUser(StoreVoiceParticipants.VoiceUser voiceUser, boolean z2, boolean z3) {
super(null);
m.checkNotNullParameter(voiceUser, "participant");
this.participant = voiceUser;
this.canRing = z2;
this.isSpectatingSameStream = z3;
this.key = String.valueOf(voiceUser.getUser().getId());
}
public static /* synthetic */ VoiceUser copy$default(VoiceUser voiceUser, StoreVoiceParticipants.VoiceUser voiceUser2, boolean z2, boolean z3, int i, Object obj) {
if ((i & 1) != 0) {
voiceUser2 = voiceUser.participant;
}
if ((i & 2) != 0) {
z2 = voiceUser.canRing;
}
if ((i & 4) != 0) {
z3 = voiceUser.isSpectatingSameStream;
}
return voiceUser.copy(voiceUser2, z2, z3);
}
public final StoreVoiceParticipants.VoiceUser component1() {
return this.participant;
}
public final boolean component2() {
return this.canRing;
}
public final boolean component3() {
return this.isSpectatingSameStream;
}
public final VoiceUser copy(StoreVoiceParticipants.VoiceUser voiceUser, boolean z2, boolean z3) {
m.checkNotNullParameter(voiceUser, "participant");
return new VoiceUser(voiceUser, z2, z3);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof VoiceUser)) {
return false;
}
VoiceUser voiceUser = (VoiceUser) obj;
return m.areEqual(this.participant, voiceUser.participant) && this.canRing == voiceUser.canRing && this.isSpectatingSameStream == voiceUser.isSpectatingSameStream;
}
public final boolean getCanRing() {
return this.canRing;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
public String getKey() {
return this.key;
}
public final StoreVoiceParticipants.VoiceUser getParticipant() {
return this.participant;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
public int getType() {
return this.type;
}
public int hashCode() {
StoreVoiceParticipants.VoiceUser voiceUser = this.participant;
int hashCode = (voiceUser != null ? voiceUser.hashCode() : 0) * 31;
boolean z2 = this.canRing;
int i = 1;
if (z2) {
z2 = true;
}
int i2 = z2 ? 1 : 0;
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = (hashCode + i2) * 31;
boolean z3 = this.isSpectatingSameStream;
if (!z3) {
i = z3 ? 1 : 0;
}
return i5 + i;
}
public final boolean isSpectatingSameStream() {
return this.isSpectatingSameStream;
}
public String toString() {
StringBuilder R = a.R("VoiceUser(participant=");
R.append(this.participant);
R.append(", canRing=");
R.append(this.canRing);
R.append(", isSpectatingSameStream=");
return a.M(R, this.isSpectatingSameStream, ")");
}
}
private ListItem() {
}
public /* synthetic */ ListItem(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
/* compiled from: CallParticipantsAdapter.kt */
public static final class ViewHolderDivider extends MGRecyclerViewHolder<CallParticipantsAdapter, MGRecyclerDataPayload> {
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public ViewHolderDivider(CallParticipantsAdapter callParticipantsAdapter) {
super((int) R.layout.voice_user_list_item_divider, callParticipantsAdapter);
m.checkNotNullParameter(callParticipantsAdapter, "adapter");
}
}
/* compiled from: CallParticipantsAdapter.kt */
public static final class ViewHolderEmbeddedActivity extends MGRecyclerViewHolder<CallParticipantsAdapter, MGRecyclerDataPayload> {
private final VoiceUserListItemEmbeddedActivityBinding binding;
private final MGImages.DistinctChangeDetector distinctChangeDetector;
private final boolean isCallPreview;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public ViewHolderEmbeddedActivity(CallParticipantsAdapter callParticipantsAdapter, boolean z2) {
super((int) R.layout.voice_user_list_item_embedded_activity, callParticipantsAdapter);
m.checkNotNullParameter(callParticipantsAdapter, "adapter");
this.isCallPreview = z2;
View view = this.itemView;
int i = R.id.app_icon;
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.app_icon);
if (simpleDraweeView != null) {
i = R.id.app_name;
TextView textView = (TextView) view.findViewById(R.id.app_name);
if (textView != null) {
i = R.id.clickable_container;
ConstraintLayout constraintLayout = (ConstraintLayout) view.findViewById(R.id.clickable_container);
if (constraintLayout != null) {
i = R.id.participant_avatars;
PileView pileView = (PileView) view.findViewById(R.id.participant_avatars);
if (pileView != null) {
VoiceUserListItemEmbeddedActivityBinding voiceUserListItemEmbeddedActivityBinding = new VoiceUserListItemEmbeddedActivityBinding((FrameLayout) view, simpleDraweeView, textView, constraintLayout, pileView);
m.checkNotNullExpressionValue(voiceUserListItemEmbeddedActivityBinding, "VoiceUserListItemEmbedde…ityBinding.bind(itemView)");
this.binding = voiceUserListItemEmbeddedActivityBinding;
this.distinctChangeDetector = new MGImages.DistinctChangeDetector();
return;
}
}
}
}
throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(i)));
}
public static final /* synthetic */ CallParticipantsAdapter access$getAdapter$p(ViewHolderEmbeddedActivity viewHolderEmbeddedActivity) {
return (CallParticipantsAdapter) viewHolderEmbeddedActivity.adapter;
}
public void onConfigure(int i, MGRecyclerDataPayload mGRecyclerDataPayload) {
Drawable drawable;
m.checkNotNullParameter(mGRecyclerDataPayload, "data");
super.onConfigure(i, (int) mGRecyclerDataPayload);
ListItem.EmbeddedActivityItem embeddedActivityItem = (ListItem.EmbeddedActivityItem) mGRecyclerDataPayload;
Application application = embeddedActivityItem.getApplication();
if (!this.isCallPreview) {
FrameLayout frameLayout = this.binding.a;
m.checkNotNullExpressionValue(frameLayout, "binding.root");
this.binding.a.setBackgroundColor(ColorCompat.getThemedColor(frameLayout.getContext(), (int) R.attr.colorBackgroundPrimary));
}
TextView textView = this.binding.c;
m.checkNotNullExpressionValue(textView, "binding.appName");
textView.setText(application.getName());
boolean z2 = application.getIcon() != null;
SimpleDraweeView simpleDraweeView = this.binding.f2195b;
m.checkNotNullExpressionValue(simpleDraweeView, "binding.appIcon");
if (z2) {
drawable = null;
} else {
SimpleDraweeView simpleDraweeView2 = this.binding.f2195b;
m.checkNotNullExpressionValue(simpleDraweeView2, "binding.appIcon");
drawable = ContextCompat.getDrawable(simpleDraweeView2.getContext(), R.drawable.ic_activity_24dp);
}
simpleDraweeView.setBackground(drawable);
String applicationIcon = IconUtils.INSTANCE.getApplicationIcon(application, DimenUtils.dpToPixels(32));
SimpleDraweeView simpleDraweeView3 = this.binding.f2195b;
m.checkNotNullExpressionValue(simpleDraweeView3, "binding.appIcon");
MGImages.setImage$default(simpleDraweeView3, z2 ? applicationIcon : null, DimenUtils.dpToPixels(32), DimenUtils.dpToPixels(32), false, null, this.distinctChangeDetector, 48, null);
List<UserGuildMember> participants = embeddedActivityItem.getParticipants();
int dpToPixels = DimenUtils.dpToPixels(16);
m.checkNotNullParameter(participants, "userGuildMembers");
ArrayList<String> arrayList = new ArrayList(o.collectionSizeOrDefault(participants, 10));
for (UserGuildMember userGuildMember : participants) {
arrayList.add(IconUtils.INSTANCE.getForGuildMemberOrUser(userGuildMember.getUser(), userGuildMember.getGuildMember(), Integer.valueOf(dpToPixels), false));
}
ArrayList arrayList2 = new ArrayList(o.collectionSizeOrDefault(arrayList, 10));
for (String str : arrayList) {
arrayList2.add(new PileView.c(new a0(str), null));
}
this.binding.e.setItems(arrayList2);
this.binding.d.setOnClickListener(new CallParticipantsAdapter$ViewHolderEmbeddedActivity$onConfigure$1(this));
}
}
/* compiled from: CallParticipantsAdapter.kt */
public static final class ViewHolderEvent extends MGRecyclerViewHolder<CallParticipantsAdapter, MGRecyclerDataPayload> {
private final VoiceUserListItemEventBinding binding;
private final boolean isCallPreview;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public ViewHolderEvent(CallParticipantsAdapter callParticipantsAdapter, boolean z2) {
super((int) R.layout.voice_user_list_item_event, callParticipantsAdapter);
m.checkNotNullParameter(callParticipantsAdapter, "adapter");
this.isCallPreview = z2;
View view = this.itemView;
GuildScheduledEventItemView guildScheduledEventItemView = (GuildScheduledEventItemView) view.findViewById(R.id.event_card);
if (guildScheduledEventItemView != null) {
VoiceUserListItemEventBinding voiceUserListItemEventBinding = new VoiceUserListItemEventBinding((FrameLayout) view, guildScheduledEventItemView);
m.checkNotNullExpressionValue(voiceUserListItemEventBinding, "VoiceUserListItemEventBinding.bind(itemView)");
this.binding = voiceUserListItemEventBinding;
return;
}
throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(R.id.event_card)));
}
public static final /* synthetic */ CallParticipantsAdapter access$getAdapter$p(ViewHolderEvent viewHolderEvent) {
return (CallParticipantsAdapter) viewHolderEvent.adapter;
}
public void onConfigure(int i, MGRecyclerDataPayload mGRecyclerDataPayload) {
m.checkNotNullParameter(mGRecyclerDataPayload, "data");
super.onConfigure(i, (int) mGRecyclerDataPayload);
if (mGRecyclerDataPayload instanceof ListItem.Event) {
ListItem.Event event = (ListItem.Event) mGRecyclerDataPayload;
this.binding.f2196b.configureInVoiceChannel(event.getEvent(), null, event.getCanStartEvent() && event.isCurrentUserInCall(), event.isCurrentUserInCall(), event.isCurrentUserInCall(), this.isCallPreview, new CallParticipantsAdapter$ViewHolderEvent$onConfigure$1(this, mGRecyclerDataPayload), new CallParticipantsAdapter$ViewHolderEvent$onConfigure$2(this, mGRecyclerDataPayload));
}
}
}
/* compiled from: CallParticipantsAdapter.kt */
public static final class ViewHolderHeader extends MGRecyclerViewHolder<CallParticipantsAdapter, MGRecyclerDataPayload> {
private final VoiceUserListItemHeaderBinding binding;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public ViewHolderHeader(CallParticipantsAdapter callParticipantsAdapter) {
super((int) R.layout.voice_user_list_item_header, callParticipantsAdapter);
m.checkNotNullParameter(callParticipantsAdapter, "adapter");
View view = this.itemView;
Objects.requireNonNull(view, "rootView");
TextView textView = (TextView) view;
VoiceUserListItemHeaderBinding voiceUserListItemHeaderBinding = new VoiceUserListItemHeaderBinding(textView, textView);
m.checkNotNullExpressionValue(voiceUserListItemHeaderBinding, "VoiceUserListItemHeaderBinding.bind(itemView)");
this.binding = voiceUserListItemHeaderBinding;
}
public void onConfigure(int i, MGRecyclerDataPayload mGRecyclerDataPayload) {
m.checkNotNullParameter(mGRecyclerDataPayload, "data");
super.onConfigure(i, (int) mGRecyclerDataPayload);
if (mGRecyclerDataPayload instanceof ListItem.Header) {
this.binding.f2197b.setText(((ListItem.Header) mGRecyclerDataPayload).getStringResId());
} else if (mGRecyclerDataPayload instanceof ListItem.SpectatorsHeader) {
TextView textView = this.binding.f2197b;
m.checkNotNullExpressionValue(textView, "binding.voiceUserListItemHeaderLabel");
TextView textView2 = this.binding.f2197b;
m.checkNotNullExpressionValue(textView2, "binding.voiceUserListItemHeaderLabel");
textView.setText(b.j(textView2, R.string.go_live_watching_user, new Object[]{((ListItem.SpectatorsHeader) mGRecyclerDataPayload).getStreamerName()}, null, 4));
}
}
}
/* compiled from: CallParticipantsAdapter.kt */
public static final class ViewHolderInvite extends MGRecyclerViewHolder<CallParticipantsAdapter, MGRecyclerDataPayload> {
private final VoiceUserListItemInviteBinding binding;
private final boolean isCallPreview;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public ViewHolderInvite(CallParticipantsAdapter callParticipantsAdapter, boolean z2) {
super((int) R.layout.voice_user_list_item_invite, callParticipantsAdapter);
m.checkNotNullParameter(callParticipantsAdapter, "adapter");
this.isCallPreview = z2;
View view = this.itemView;
Objects.requireNonNull(view, "rootView");
VoiceUserListItemInviteBinding voiceUserListItemInviteBinding = new VoiceUserListItemInviteBinding((LinearLayout) view);
m.checkNotNullExpressionValue(voiceUserListItemInviteBinding, "VoiceUserListItemInviteBinding.bind(itemView)");
this.binding = voiceUserListItemInviteBinding;
}
public static final /* synthetic */ CallParticipantsAdapter access$getAdapter$p(ViewHolderInvite viewHolderInvite) {
return (CallParticipantsAdapter) viewHolderInvite.adapter;
}
public void onConfigure(int i, MGRecyclerDataPayload mGRecyclerDataPayload) {
m.checkNotNullParameter(mGRecyclerDataPayload, "data");
super.onConfigure(i, (int) mGRecyclerDataPayload);
if (mGRecyclerDataPayload instanceof ListItem.Invite) {
this.itemView.setOnClickListener(new CallParticipantsAdapter$ViewHolderInvite$onConfigure$1(this));
if (!this.isCallPreview) {
LinearLayout linearLayout = this.binding.a;
m.checkNotNullExpressionValue(linearLayout, "binding.root");
this.binding.a.setBackgroundColor(ColorCompat.getThemedColor(linearLayout.getContext(), (int) R.attr.colorBackgroundPrimary));
}
}
}
}
/* compiled from: CallParticipantsAdapter.kt */
public static final class ViewHolderUser extends MGRecyclerViewHolder<CallParticipantsAdapter, MGRecyclerDataPayload> {
private final VoiceUserListItemUserBinding binding;
private final boolean isCallPreview;
private final boolean quantizeUserAvatar;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public ViewHolderUser(CallParticipantsAdapter callParticipantsAdapter, boolean z2, boolean z3) {
super((int) R.layout.voice_user_list_item_user, callParticipantsAdapter);
m.checkNotNullParameter(callParticipantsAdapter, "adapter");
this.isCallPreview = z2;
this.quantizeUserAvatar = z3;
View view = this.itemView;
int i = R.id.voice_user_list_item_deafen_indicator;
ImageView imageView = (ImageView) view.findViewById(R.id.voice_user_list_item_deafen_indicator);
if (imageView != null) {
i = R.id.voice_user_list_item_live_indicator;
TextView textView = (TextView) view.findViewById(R.id.voice_user_list_item_live_indicator);
if (textView != null) {
i = R.id.voice_user_list_item_mute_indicator;
ImageView imageView2 = (ImageView) view.findViewById(R.id.voice_user_list_item_mute_indicator);
if (imageView2 != null) {
i = R.id.voice_user_list_item_spectating_indicator;
ImageView imageView3 = (ImageView) view.findViewById(R.id.voice_user_list_item_spectating_indicator);
if (imageView3 != null) {
i = R.id.voice_user_list_item_toggle_ringing;
MaterialButton materialButton = (MaterialButton) view.findViewById(R.id.voice_user_list_item_toggle_ringing);
if (materialButton != null) {
i = R.id.voice_user_list_item_user_avatar;
VoiceUserView voiceUserView = (VoiceUserView) view.findViewById(R.id.voice_user_list_item_user_avatar);
if (voiceUserView != null) {
i = R.id.voice_user_list_item_user_name;
TextView textView2 = (TextView) view.findViewById(R.id.voice_user_list_item_user_name);
if (textView2 != null) {
i = R.id.voice_user_list_item_user_stream_preview;
StreamPreviewView streamPreviewView = (StreamPreviewView) view.findViewById(R.id.voice_user_list_item_user_stream_preview);
if (streamPreviewView != null) {
i = R.id.voice_user_list_item_video_indicator;
ImageView imageView4 = (ImageView) view.findViewById(R.id.voice_user_list_item_video_indicator);
if (imageView4 != null) {
VoiceUserListItemUserBinding voiceUserListItemUserBinding = new VoiceUserListItemUserBinding((LinearLayout) view, imageView, textView, imageView2, imageView3, materialButton, voiceUserView, textView2, streamPreviewView, imageView4);
m.checkNotNullExpressionValue(voiceUserListItemUserBinding, "VoiceUserListItemUserBinding.bind(itemView)");
this.binding = voiceUserListItemUserBinding;
return;
}
}
}
}
}
}
}
}
}
throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(i)));
}
public static final /* synthetic */ CallParticipantsAdapter access$getAdapter$p(ViewHolderUser viewHolderUser) {
return (CallParticipantsAdapter) viewHolderUser.adapter;
}
public void onConfigure(int i, MGRecyclerDataPayload mGRecyclerDataPayload) {
CharSequence charSequence;
CharSequence charSequence2;
StreamContext.Joinability joinability;
m.checkNotNullParameter(mGRecyclerDataPayload, "data");
super.onConfigure(i, (int) mGRecyclerDataPayload);
ListItem.VoiceUser voiceUser = (ListItem.VoiceUser) mGRecyclerDataPayload;
StoreVoiceParticipants.VoiceUser participant = voiceUser.getParticipant();
String colorId = RepresentativeColorsKt.getColorId(participant.getUser());
if (this.quantizeUserAvatar) {
this.binding.g.setOnBitmapLoadedListener(new CallParticipantsAdapter$ViewHolderUser$onConfigure$1(colorId));
}
if (!this.isCallPreview) {
LinearLayout linearLayout = this.binding.a;
m.checkNotNullExpressionValue(linearLayout, "binding.root");
this.binding.a.setBackgroundColor(ColorCompat.getThemedColor(linearLayout.getContext(), (int) R.attr.colorBackgroundPrimary));
}
this.binding.g.a(participant, R.dimen.avatar_size_standard);
TextView textView = this.binding.h;
m.checkNotNullExpressionValue(textView, "binding.voiceUserListItemUserName");
textView.setText(participant.getDisplayName());
this.itemView.setOnClickListener(new CallParticipantsAdapter$ViewHolderUser$onConfigure$2(this, participant));
MaterialButton materialButton = this.binding.f;
m.checkNotNullExpressionValue(materialButton, "binding.voiceUserListItemToggleRinging");
boolean z2 = false;
materialButton.setVisibility(voiceUser.getCanRing() ? 0 : 8);
MaterialButton materialButton2 = this.binding.f;
m.checkNotNullExpressionValue(materialButton2, "binding.voiceUserListItemToggleRinging");
if (participant.isRinging()) {
MaterialButton materialButton3 = this.binding.f;
m.checkNotNullExpressionValue(materialButton3, "binding.voiceUserListItemToggleRinging");
charSequence = b.j(materialButton3, R.string.stop_ringing, new Object[0], null, 4);
} else {
MaterialButton materialButton4 = this.binding.f;
m.checkNotNullExpressionValue(materialButton4, "binding.voiceUserListItemToggleRinging");
charSequence = b.j(materialButton4, R.string.ring, new Object[0], null, 4);
}
materialButton2.setText(charSequence);
this.binding.f.setOnClickListener(new CallParticipantsAdapter$ViewHolderUser$onConfigure$3(this, participant));
MaterialButton materialButton5 = this.binding.f;
m.checkNotNullExpressionValue(materialButton5, "binding.voiceUserListItemToggleRinging");
if (participant.isRinging()) {
MaterialButton materialButton6 = this.binding.f;
m.checkNotNullExpressionValue(materialButton6, "binding.voiceUserListItemToggleRinging");
charSequence2 = b.j(materialButton6, R.string.stop_ringing_username_a11y_label, new Object[]{participant.getDisplayName()}, null, 4);
} else {
MaterialButton materialButton7 = this.binding.f;
m.checkNotNullExpressionValue(materialButton7, "binding.voiceUserListItemToggleRinging");
charSequence2 = b.j(materialButton7, R.string.ring_username_a11y_label, new Object[]{participant.getDisplayName()}, null, 4);
}
materialButton5.setContentDescription(charSequence2);
if (!participant.isConnected() || participant.getVoiceState() == null) {
ImageView imageView = this.binding.f2198b;
m.checkNotNullExpressionValue(imageView, "binding.voiceUserListItemDeafenIndicator");
imageView.setVisibility(8);
ImageView imageView2 = this.binding.d;
m.checkNotNullExpressionValue(imageView2, "binding.voiceUserListItemMuteIndicator");
imageView2.setVisibility(8);
StreamPreviewView streamPreviewView = this.binding.i;
m.checkNotNullExpressionValue(streamPreviewView, "binding.voiceUserListItemUserStreamPreview");
streamPreviewView.setVisibility(8);
ImageView imageView3 = this.binding.j;
m.checkNotNullExpressionValue(imageView3, "binding.voiceUserListItemVideoIndicator");
imageView3.setVisibility(8);
ImageView imageView4 = this.binding.e;
m.checkNotNullExpressionValue(imageView4, "binding.voiceUserListItemSpectatingIndicator");
imageView4.setVisibility(8);
TextView textView2 = this.binding.c;
m.checkNotNullExpressionValue(textView2, "binding.voiceUserListItemLiveIndicator");
textView2.setVisibility(8);
return;
}
ImageView imageView5 = this.binding.f2198b;
m.checkNotNullExpressionValue(imageView5, "binding.voiceUserListItemDeafenIndicator");
imageView5.setVisibility(0);
ImageView imageView6 = this.binding.d;
m.checkNotNullExpressionValue(imageView6, "binding.voiceUserListItemMuteIndicator");
imageView6.setVisibility(0);
VoiceState voiceState = participant.getVoiceState();
boolean z3 = voiceState.g() || voiceState.b();
boolean z4 = voiceState.h() || voiceState.e() || voiceState.l();
boolean j = voiceState.j();
ImageView imageView7 = this.binding.e;
m.checkNotNullExpressionValue(imageView7, "binding.voiceUserListItemSpectatingIndicator");
imageView7.setVisibility(voiceUser.isSpectatingSameStream() ? 0 : 8);
ImageView imageView8 = this.binding.f2198b;
m.checkNotNullExpressionValue(imageView8, "binding.voiceUserListItemDeafenIndicator");
imageView8.setVisibility(z3 ? 0 : 8);
ImageView imageView9 = this.binding.d;
m.checkNotNullExpressionValue(imageView9, "binding.voiceUserListItemMuteIndicator");
imageView9.setVisibility(z4 ? 0 : 8);
ImageView imageView10 = this.binding.j;
m.checkNotNullExpressionValue(imageView10, "binding.voiceUserListItemVideoIndicator");
imageView10.setVisibility(j ? 0 : 8);
StreamContext streamContext = participant.getStreamContext();
TextView textView3 = this.binding.c;
m.checkNotNullExpressionValue(textView3, "binding.voiceUserListItemLiveIndicator");
textView3.setVisibility(streamContext != null ? 0 : 8);
StoreApplicationStreamPreviews.StreamPreview preview = streamContext != null ? streamContext.getPreview() : null;
if (preview == null || streamContext.getJoinability() != (joinability = StreamContext.Joinability.CAN_CONNECT)) {
StreamPreviewView streamPreviewView2 = this.binding.i;
m.checkNotNullExpressionValue(streamPreviewView2, "binding.voiceUserListItemUserStreamPreview");
streamPreviewView2.setVisibility(8);
return;
}
StreamPreviewView streamPreviewView3 = this.binding.i;
m.checkNotNullExpressionValue(streamPreviewView3, "binding.voiceUserListItemUserStreamPreview");
streamPreviewView3.setVisibility(0);
this.binding.i.setOnClickListener(new CallParticipantsAdapter$ViewHolderUser$onConfigure$4(this, participant));
StreamContext streamContext2 = voiceUser.getParticipant().getStreamContext();
if (streamContext2 != null && streamContext2.isCurrentUserParticipating()) {
z2 = true;
}
this.binding.i.a(preview, joinability, z2);
}
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public CallParticipantsAdapter(RecyclerView recyclerView, boolean z2, boolean z3) {
super(recyclerView, false, 2, null);
m.checkNotNullParameter(recyclerView, "recycler");
this.isCallPreview = z2;
this.quantizeUserAvatars = z3;
this.onVoiceUserClicked = CallParticipantsAdapter$onVoiceUserClicked$1.INSTANCE;
this.onStreamPreviewClicked = CallParticipantsAdapter$onStreamPreviewClicked$1.INSTANCE;
this.onToggleRingingClicked = CallParticipantsAdapter$onToggleRingingClicked$1.INSTANCE;
this.onInviteFriendsClicked = CallParticipantsAdapter$onInviteFriendsClicked$1.INSTANCE;
this.onEventClicked = CallParticipantsAdapter$onEventClicked$1.INSTANCE;
this.onStartEventClicked = CallParticipantsAdapter$onStartEventClicked$1.INSTANCE;
this.onEmbeddedActivityClicked = CallParticipantsAdapter$onEmbeddedActivityClicked$1.INSTANCE;
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ CallParticipantsAdapter(RecyclerView recyclerView, boolean z2, boolean z3, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(recyclerView, (i & 2) != 0 ? false : z2, (i & 4) != 0 ? false : z3);
}
public final Function0<Unit> getOnEmbeddedActivityClicked() {
return this.onEmbeddedActivityClicked;
}
/* JADX DEBUG: Type inference failed for r0v0. Raw type applied. Possible types: kotlin.jvm.functions.Function1<? super com.discord.api.guildscheduledevent.GuildScheduledEvent, kotlin.Unit>, kotlin.jvm.functions.Function1<com.discord.api.guildscheduledevent.GuildScheduledEvent, kotlin.Unit> */
public final Function1<GuildScheduledEvent, Unit> getOnEventClicked() {
return this.onEventClicked;
}
/* JADX DEBUG: Type inference failed for r0v0. Raw type applied. Possible types: kotlin.jvm.functions.Function1<? super android.view.View, kotlin.Unit>, kotlin.jvm.functions.Function1<android.view.View, kotlin.Unit> */
public final Function1<View, Unit> getOnInviteFriendsClicked() {
return this.onInviteFriendsClicked;
}
/* JADX DEBUG: Type inference failed for r0v0. Raw type applied. Possible types: kotlin.jvm.functions.Function1<? super com.discord.api.guildscheduledevent.GuildScheduledEvent, kotlin.Unit>, kotlin.jvm.functions.Function1<com.discord.api.guildscheduledevent.GuildScheduledEvent, kotlin.Unit> */
public final Function1<GuildScheduledEvent, Unit> getOnStartEventClicked() {
return this.onStartEventClicked;
}
/* JADX DEBUG: Type inference failed for r0v0. Raw type applied. Possible types: kotlin.jvm.functions.Function1<? super com.discord.utilities.streams.StreamContext, kotlin.Unit>, kotlin.jvm.functions.Function1<com.discord.utilities.streams.StreamContext, kotlin.Unit> */
public final Function1<StreamContext, Unit> getOnStreamPreviewClicked() {
return this.onStreamPreviewClicked;
}
/* JADX DEBUG: Type inference failed for r0v0. Raw type applied. Possible types: kotlin.jvm.functions.Function1<? super com.discord.stores.StoreVoiceParticipants$VoiceUser, kotlin.Unit>, kotlin.jvm.functions.Function1<com.discord.stores.StoreVoiceParticipants$VoiceUser, kotlin.Unit> */
public final Function1<StoreVoiceParticipants.VoiceUser, Unit> getOnToggleRingingClicked() {
return this.onToggleRingingClicked;
}
/* JADX DEBUG: Type inference failed for r0v0. Raw type applied. Possible types: kotlin.jvm.functions.Function1<? super com.discord.stores.StoreVoiceParticipants$VoiceUser, kotlin.Unit>, kotlin.jvm.functions.Function1<com.discord.stores.StoreVoiceParticipants$VoiceUser, kotlin.Unit> */
public final Function1<StoreVoiceParticipants.VoiceUser, Unit> getOnVoiceUserClicked() {
return this.onVoiceUserClicked;
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public MGRecyclerViewHolder<?, MGRecyclerDataPayload> onCreateViewHolder(ViewGroup viewGroup, int i) {
m.checkNotNullParameter(viewGroup, "parent");
switch (i) {
case 0:
return new ViewHolderUser(this, this.isCallPreview, this.quantizeUserAvatars);
case 1:
return new ViewHolderHeader(this);
case 2:
return new ViewHolderHeader(this);
case 3:
return new ViewHolderDivider(this);
case 4:
return new ViewHolderInvite(this, this.isCallPreview);
case 5:
return new ViewHolderEvent(this, this.isCallPreview);
case 6:
return new ViewHolderEmbeddedActivity(this, this.isCallPreview);
default:
throw invalidViewTypeException(i);
}
}
public final void setOnEmbeddedActivityClicked(Function0<Unit> function0) {
m.checkNotNullParameter(function0, "<set-?>");
this.onEmbeddedActivityClicked = function0;
}
public final void setOnEventClicked(Function1<? super GuildScheduledEvent, Unit> function1) {
m.checkNotNullParameter(function1, "<set-?>");
this.onEventClicked = function1;
}
public final void setOnInviteFriendsClicked(Function1<? super View, Unit> function1) {
m.checkNotNullParameter(function1, "<set-?>");
this.onInviteFriendsClicked = function1;
}
public final void setOnStartEventClicked(Function1<? super GuildScheduledEvent, Unit> function1) {
m.checkNotNullParameter(function1, "<set-?>");
this.onStartEventClicked = function1;
}
public final void setOnStreamPreviewClicked(Function1<? super StreamContext, Unit> function1) {
m.checkNotNullParameter(function1, "<set-?>");
this.onStreamPreviewClicked = function1;
}
public final void setOnToggleRingingClicked(Function1<? super StoreVoiceParticipants.VoiceUser, Unit> function1) {
m.checkNotNullParameter(function1, "<set-?>");
this.onToggleRingingClicked = function1;
}
public final void setOnVoiceUserClicked(Function1<? super StoreVoiceParticipants.VoiceUser, Unit> function1) {
m.checkNotNullParameter(function1, "<set-?>");
this.onVoiceUserClicked = function1;
}
}