2021-08-03 07:33:18 +00:00
|
|
|
package com.discord.widgets.friends;
|
|
|
|
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.LinearLayout;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import androidx.appcompat.widget.AppCompatImageView;
|
|
|
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
import c.d.b.a.a;
|
|
|
|
import com.discord.databinding.WidgetAddFriendUserListItemBinding;
|
|
|
|
import com.discord.models.presence.Presence;
|
|
|
|
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.discord.utilities.user.UserUtils;
|
|
|
|
import com.discord.views.StatusView;
|
|
|
|
import com.discord.widgets.user.search.WidgetGlobalSearchModel;
|
|
|
|
import com.facebook.drawee.view.SimpleDraweeView;
|
|
|
|
import d0.t.u;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.List;
|
|
|
|
import kotlin.Unit;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
|
|
|
import kotlin.jvm.functions.Function2;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
/* compiled from: WidgetFriendsAddUserAdapter.kt */
|
|
|
|
public final class WidgetFriendsAddUserAdapter extends MGRecyclerAdapterSimple<ItemUser> {
|
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
private static final int TYPE_USER = 1;
|
|
|
|
private Function1<? super Long, Unit> acceptHandler;
|
|
|
|
private Function2<? super Long, ? super Boolean, Unit> declineHandler;
|
|
|
|
private final HashSet<Long> incomingRequestUserIds = new HashSet<>();
|
|
|
|
private Function1<? super Long, Unit> onItemClick = WidgetFriendsAddUserAdapter$onItemClick$1.INSTANCE;
|
|
|
|
private final HashSet<Long> outgoingRequestUserIds = new HashSet<>();
|
|
|
|
private Function2<? super String, ? super Integer, Unit> sendHandler;
|
|
|
|
|
|
|
|
/* compiled from: WidgetFriendsAddUserAdapter.kt */
|
|
|
|
public static final class Companion {
|
|
|
|
private Companion() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: WidgetFriendsAddUserAdapter.kt */
|
|
|
|
public static final class ItemUser implements MGRecyclerDataPayload {
|
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
private final List<CharSequence> aliases;
|
|
|
|
private final boolean isFriend;
|
|
|
|
private final String key;
|
|
|
|
private final Presence presence;
|
|
|
|
private final int type;
|
|
|
|
private final User user;
|
|
|
|
|
|
|
|
/* compiled from: WidgetFriendsAddUserAdapter.kt */
|
|
|
|
public static final class Companion {
|
|
|
|
private Companion() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
|
|
|
|
public final ItemUser create(WidgetGlobalSearchModel.ItemUser itemUser) {
|
|
|
|
m.checkNotNullParameter(itemUser, "item");
|
|
|
|
return new ItemUser(itemUser.getUser(), itemUser.getAliases(), itemUser.getPresence(), itemUser.isFriend());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: java.util.List<? extends java.lang.CharSequence> */
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
|
|
public ItemUser(User user, List<? extends CharSequence> list, Presence presence, boolean z2) {
|
|
|
|
m.checkNotNullParameter(user, "user");
|
|
|
|
m.checkNotNullParameter(list, "aliases");
|
|
|
|
this.user = user;
|
|
|
|
this.aliases = list;
|
|
|
|
this.presence = presence;
|
|
|
|
this.isFriend = z2;
|
|
|
|
this.type = 1;
|
|
|
|
this.key = String.valueOf(user.getId());
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
|
|
public /* synthetic */ ItemUser(User user, List list, Presence presence, boolean z2, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this(user, list, (i & 4) != 0 ? null : presence, z2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.friends.WidgetFriendsAddUserAdapter$ItemUser */
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
|
|
public static /* synthetic */ ItemUser copy$default(ItemUser itemUser, User user, List list, Presence presence, boolean z2, int i, Object obj) {
|
|
|
|
if ((i & 1) != 0) {
|
|
|
|
user = itemUser.user;
|
|
|
|
}
|
|
|
|
if ((i & 2) != 0) {
|
|
|
|
list = itemUser.aliases;
|
|
|
|
}
|
|
|
|
if ((i & 4) != 0) {
|
|
|
|
presence = itemUser.presence;
|
|
|
|
}
|
|
|
|
if ((i & 8) != 0) {
|
|
|
|
z2 = itemUser.isFriend;
|
|
|
|
}
|
|
|
|
return itemUser.copy(user, list, presence, z2);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final User component1() {
|
|
|
|
return this.user;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final List<CharSequence> component2() {
|
|
|
|
return this.aliases;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Presence component3() {
|
|
|
|
return this.presence;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean component4() {
|
|
|
|
return this.isFriend;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final ItemUser copy(User user, List<? extends CharSequence> list, Presence presence, boolean z2) {
|
|
|
|
m.checkNotNullParameter(user, "user");
|
|
|
|
m.checkNotNullParameter(list, "aliases");
|
|
|
|
return new ItemUser(user, list, presence, z2);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
if (this == obj) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!(obj instanceof ItemUser)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
ItemUser itemUser = (ItemUser) obj;
|
|
|
|
return m.areEqual(this.user, itemUser.user) && m.areEqual(this.aliases, itemUser.aliases) && m.areEqual(this.presence, itemUser.presence) && this.isFriend == itemUser.isFriend;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final List<CharSequence> getAliases() {
|
|
|
|
return this.aliases;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
|
|
|
|
public String getKey() {
|
|
|
|
return this.key;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Presence getPresence() {
|
|
|
|
return this.presence;
|
|
|
|
}
|
|
|
|
|
|
|
|
@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;
|
|
|
|
List<CharSequence> list = this.aliases;
|
|
|
|
int hashCode2 = (hashCode + (list != null ? list.hashCode() : 0)) * 31;
|
|
|
|
Presence presence = this.presence;
|
|
|
|
if (presence != null) {
|
|
|
|
i = presence.hashCode();
|
|
|
|
}
|
|
|
|
int i2 = (hashCode2 + i) * 31;
|
|
|
|
boolean z2 = this.isFriend;
|
|
|
|
if (z2) {
|
|
|
|
z2 = true;
|
|
|
|
}
|
|
|
|
int i3 = z2 ? 1 : 0;
|
|
|
|
int i4 = z2 ? 1 : 0;
|
|
|
|
int i5 = z2 ? 1 : 0;
|
|
|
|
return i2 + i3;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean isFriend() {
|
|
|
|
return this.isFriend;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
StringBuilder K = a.K("ItemUser(user=");
|
|
|
|
K.append(this.user);
|
|
|
|
K.append(", aliases=");
|
|
|
|
K.append(this.aliases);
|
|
|
|
K.append(", presence=");
|
|
|
|
K.append(this.presence);
|
|
|
|
K.append(", isFriend=");
|
|
|
|
return a.F(K, this.isFriend, ")");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: WidgetFriendsAddUserAdapter.kt */
|
|
|
|
public static final class UserViewHolder extends MGRecyclerViewHolder<WidgetFriendsAddUserAdapter, ItemUser> {
|
|
|
|
private final WidgetAddFriendUserListItemBinding binding;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public UserViewHolder(WidgetFriendsAddUserAdapter widgetFriendsAddUserAdapter) {
|
2021-08-04 23:47:20 +00:00
|
|
|
super(2131558862, widgetFriendsAddUserAdapter);
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullParameter(widgetFriendsAddUserAdapter, "adapter");
|
|
|
|
View view = this.itemView;
|
|
|
|
int i = 2131361910;
|
|
|
|
AppCompatImageView appCompatImageView = (AppCompatImageView) view.findViewById(2131361910);
|
|
|
|
if (appCompatImageView != null) {
|
|
|
|
i = 2131361911;
|
|
|
|
AppCompatImageView appCompatImageView2 = (AppCompatImageView) view.findViewById(2131361911);
|
|
|
|
if (appCompatImageView2 != null) {
|
|
|
|
i = 2131361912;
|
|
|
|
AppCompatImageView appCompatImageView3 = (AppCompatImageView) view.findViewById(2131361912);
|
|
|
|
if (appCompatImageView3 != null) {
|
|
|
|
i = 2131361913;
|
|
|
|
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(2131361913);
|
|
|
|
if (simpleDraweeView != null) {
|
|
|
|
i = 2131361914;
|
|
|
|
LinearLayout linearLayout = (LinearLayout) view.findViewById(2131361914);
|
|
|
|
if (linearLayout != null) {
|
|
|
|
i = 2131361915;
|
|
|
|
TextView textView = (TextView) view.findViewById(2131361915);
|
|
|
|
if (textView != null) {
|
|
|
|
i = 2131361916;
|
|
|
|
TextView textView2 = (TextView) view.findViewById(2131361916);
|
|
|
|
if (textView2 != null) {
|
|
|
|
i = 2131361917;
|
|
|
|
StatusView statusView = (StatusView) view.findViewById(2131361917);
|
|
|
|
if (statusView != null) {
|
|
|
|
i = 2131361918;
|
|
|
|
LinearLayout linearLayout2 = (LinearLayout) view.findViewById(2131361918);
|
|
|
|
if (linearLayout2 != null) {
|
|
|
|
i = 2131361919;
|
|
|
|
AppCompatImageView appCompatImageView4 = (AppCompatImageView) view.findViewById(2131361919);
|
|
|
|
if (appCompatImageView4 != null) {
|
|
|
|
WidgetAddFriendUserListItemBinding widgetAddFriendUserListItemBinding = new WidgetAddFriendUserListItemBinding((ConstraintLayout) view, appCompatImageView, appCompatImageView2, appCompatImageView3, simpleDraweeView, linearLayout, textView, textView2, statusView, linearLayout2, appCompatImageView4);
|
|
|
|
m.checkNotNullExpressionValue(widgetAddFriendUserListItemBinding, "WidgetAddFriendUserListItemBinding.bind(itemView)");
|
|
|
|
this.binding = widgetAddFriendUserListItemBinding;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(i)));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ WidgetFriendsAddUserAdapter access$getAdapter$p(UserViewHolder userViewHolder) {
|
|
|
|
return (WidgetFriendsAddUserAdapter) userViewHolder.adapter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void onConfigure(int i, ItemUser itemUser) {
|
|
|
|
m.checkNotNullParameter(itemUser, "data");
|
|
|
|
super.onConfigure(i, (int) itemUser);
|
|
|
|
User user = itemUser.getUser();
|
|
|
|
SimpleDraweeView simpleDraweeView = this.binding.e;
|
|
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.addFriendUserItemAvatar");
|
|
|
|
IconUtils.setIcon$default(simpleDraweeView, user, 0, null, null, null, 60, null);
|
|
|
|
TextView textView = this.binding.f;
|
|
|
|
m.checkNotNullExpressionValue(textView, "binding.addFriendUserItemName");
|
|
|
|
CharSequence charSequence = (CharSequence) u.lastOrNull((List<? extends Object>) itemUser.getAliases());
|
|
|
|
if (charSequence == null) {
|
|
|
|
charSequence = user.getUsername();
|
|
|
|
}
|
|
|
|
textView.setText(charSequence);
|
|
|
|
TextView textView2 = this.binding.g;
|
|
|
|
m.checkNotNullExpressionValue(textView2, "binding.addFriendUserItemNameSecondary");
|
|
|
|
textView2.setText(UserUtils.INSTANCE.getDiscriminatorWithPadding(user));
|
|
|
|
this.binding.h.setPresence(itemUser.getPresence());
|
|
|
|
StatusView statusView = this.binding.h;
|
|
|
|
m.checkNotNullExpressionValue(statusView, "binding.addFriendUserItemStatus");
|
|
|
|
boolean z2 = true;
|
|
|
|
int i2 = 0;
|
|
|
|
statusView.setVisibility(itemUser.getPresence() != null ? 0 : 8);
|
|
|
|
long id2 = itemUser.getUser().getId();
|
|
|
|
boolean contains = WidgetFriendsAddUserAdapter.access$getOutgoingRequestUserIds$p((WidgetFriendsAddUserAdapter) this.adapter).contains(Long.valueOf(id2));
|
|
|
|
boolean contains2 = WidgetFriendsAddUserAdapter.access$getIncomingRequestUserIds$p((WidgetFriendsAddUserAdapter) this.adapter).contains(Long.valueOf(id2));
|
|
|
|
this.binding.b.setOnClickListener(new WidgetFriendsAddUserAdapter$UserViewHolder$onConfigure$1(this, id2));
|
|
|
|
this.binding.d.setOnClickListener(new WidgetFriendsAddUserAdapter$UserViewHolder$onConfigure$2(this, id2, contains2));
|
|
|
|
this.binding.i.setOnClickListener(new WidgetFriendsAddUserAdapter$UserViewHolder$onConfigure$3(this, user));
|
|
|
|
this.binding.a.setOnClickListener(new WidgetFriendsAddUserAdapter$UserViewHolder$onConfigure$4(this, id2));
|
2021-08-06 20:07:13 +00:00
|
|
|
AppCompatImageView appCompatImageView = this.binding.f1679c;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(appCompatImageView, "binding.addFriendUserCheckImage");
|
|
|
|
appCompatImageView.setVisibility(itemUser.isFriend() ? 0 : 8);
|
|
|
|
AppCompatImageView appCompatImageView2 = this.binding.i;
|
|
|
|
m.checkNotNullExpressionValue(appCompatImageView2, "binding.addFriendUserSendButton");
|
|
|
|
appCompatImageView2.setVisibility(!itemUser.isFriend() && !contains && !contains2 ? 0 : 8);
|
|
|
|
AppCompatImageView appCompatImageView3 = this.binding.b;
|
|
|
|
m.checkNotNullExpressionValue(appCompatImageView3, "binding.addFriendUserAcceptButton");
|
|
|
|
appCompatImageView3.setVisibility(!itemUser.isFriend() && contains2 ? 0 : 8);
|
|
|
|
AppCompatImageView appCompatImageView4 = this.binding.d;
|
|
|
|
m.checkNotNullExpressionValue(appCompatImageView4, "binding.addFriendUserDeclineButton");
|
|
|
|
if (itemUser.isFriend() || (!contains && !contains2)) {
|
|
|
|
z2 = false;
|
|
|
|
}
|
|
|
|
if (!z2) {
|
|
|
|
i2 = 8;
|
|
|
|
}
|
|
|
|
appCompatImageView4.setVisibility(i2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public WidgetFriendsAddUserAdapter(RecyclerView recyclerView) {
|
|
|
|
super(recyclerView, false, 2, null);
|
|
|
|
m.checkNotNullParameter(recyclerView, "recycler");
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ Function1 access$getAcceptHandler$p(WidgetFriendsAddUserAdapter widgetFriendsAddUserAdapter) {
|
|
|
|
return widgetFriendsAddUserAdapter.acceptHandler;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ Function2 access$getDeclineHandler$p(WidgetFriendsAddUserAdapter widgetFriendsAddUserAdapter) {
|
|
|
|
return widgetFriendsAddUserAdapter.declineHandler;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ HashSet access$getIncomingRequestUserIds$p(WidgetFriendsAddUserAdapter widgetFriendsAddUserAdapter) {
|
|
|
|
return widgetFriendsAddUserAdapter.incomingRequestUserIds;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ Function1 access$getOnItemClick$p(WidgetFriendsAddUserAdapter widgetFriendsAddUserAdapter) {
|
|
|
|
return widgetFriendsAddUserAdapter.onItemClick;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ HashSet access$getOutgoingRequestUserIds$p(WidgetFriendsAddUserAdapter widgetFriendsAddUserAdapter) {
|
|
|
|
return widgetFriendsAddUserAdapter.outgoingRequestUserIds;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ Function2 access$getSendHandler$p(WidgetFriendsAddUserAdapter widgetFriendsAddUserAdapter) {
|
|
|
|
return widgetFriendsAddUserAdapter.sendHandler;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$setAcceptHandler$p(WidgetFriendsAddUserAdapter widgetFriendsAddUserAdapter, Function1 function1) {
|
|
|
|
widgetFriendsAddUserAdapter.acceptHandler = function1;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$setDeclineHandler$p(WidgetFriendsAddUserAdapter widgetFriendsAddUserAdapter, Function2 function2) {
|
|
|
|
widgetFriendsAddUserAdapter.declineHandler = function2;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$setOnItemClick$p(WidgetFriendsAddUserAdapter widgetFriendsAddUserAdapter, Function1 function1) {
|
|
|
|
widgetFriendsAddUserAdapter.onItemClick = function1;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$setSendHandler$p(WidgetFriendsAddUserAdapter widgetFriendsAddUserAdapter, Function2 function2) {
|
|
|
|
widgetFriendsAddUserAdapter.sendHandler = function2;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void addFriendRequestUserIds(Collection<Long> collection, Collection<Long> collection2) {
|
|
|
|
m.checkNotNullParameter(collection, "outgoingIds");
|
|
|
|
m.checkNotNullParameter(collection2, "incomingIds");
|
|
|
|
this.outgoingRequestUserIds.clear();
|
|
|
|
this.outgoingRequestUserIds.addAll(collection);
|
|
|
|
this.incomingRequestUserIds.clear();
|
|
|
|
this.incomingRequestUserIds.addAll(collection2);
|
|
|
|
notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
|
|
public UserViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
|
|
|
m.checkNotNullParameter(viewGroup, "parent");
|
|
|
|
if (i == 1) {
|
|
|
|
return new UserViewHolder(this);
|
|
|
|
}
|
|
|
|
throw invalidViewTypeException(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void setAcceptHandler(Function1<? super Long, Unit> function1) {
|
|
|
|
m.checkNotNullParameter(function1, "handler");
|
|
|
|
this.acceptHandler = function1;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void setDeclineHandler(Function2<? super Long, ? super Boolean, Unit> function2) {
|
|
|
|
m.checkNotNullParameter(function2, "handler");
|
|
|
|
this.declineHandler = function2;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void setOnItemClick(Function1<? super Long, Unit> function1) {
|
|
|
|
m.checkNotNullParameter(function1, "onItemClick");
|
|
|
|
this.onItemClick = function1;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void setSendHandler(Function2<? super String, ? super Integer, Unit> function2) {
|
|
|
|
m.checkNotNullParameter(function2, "handler");
|
|
|
|
this.sendHandler = function2;
|
|
|
|
}
|
|
|
|
}
|