415 lines
16 KiB
Java
415 lines
16 KiB
Java
package com.discord.widgets.channels.threads.browser;
|
|
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.TextView;
|
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import c.a.k.b;
|
|
import c.d.b.a.a;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.databinding.ThreadBrowserItemHeaderBinding;
|
|
import com.discord.databinding.ThreadBrowserItemThreadBinding;
|
|
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.threads.browser.ThreadBrowserThreadView;
|
|
import d0.z.d.m;
|
|
import java.util.Objects;
|
|
import kotlin.NoWhenBranchMatchedException;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
/* compiled from: WidgetThreadBrowserAdapter.kt */
|
|
public final class WidgetThreadBrowserAdapter extends MGRecyclerAdapterSimple<Item> {
|
|
private final Function1<Channel, Unit> onOpenThread;
|
|
private final Function1<Channel, Unit> onThreadSettings;
|
|
|
|
/* compiled from: WidgetThreadBrowserAdapter.kt */
|
|
public static final class HeaderItem extends MGRecyclerViewHolder<WidgetThreadBrowserAdapter, Item> {
|
|
private final ThreadBrowserItemHeaderBinding binding;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public HeaderItem(WidgetThreadBrowserAdapter widgetThreadBrowserAdapter) {
|
|
super(2131558700, widgetThreadBrowserAdapter);
|
|
m.checkNotNullParameter(widgetThreadBrowserAdapter, "adapter");
|
|
View view = this.itemView;
|
|
TextView textView = (TextView) view.findViewById(2131363596);
|
|
if (textView != null) {
|
|
ThreadBrowserItemHeaderBinding threadBrowserItemHeaderBinding = new ThreadBrowserItemHeaderBinding((ConstraintLayout) view, textView);
|
|
m.checkNotNullExpressionValue(threadBrowserItemHeaderBinding, "ThreadBrowserItemHeaderBinding.bind(itemView)");
|
|
this.binding = threadBrowserItemHeaderBinding;
|
|
return;
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(2131363596)));
|
|
}
|
|
|
|
public void onConfigure(int i, Item item) {
|
|
m.checkNotNullParameter(item, "data");
|
|
super.onConfigure(i, (int) item);
|
|
Item.Header header = (Item.Header) item;
|
|
TextView textView = this.binding.b;
|
|
m.checkNotNullExpressionValue(textView, "binding.headerName");
|
|
textView.setText(b.g(((WidgetThreadBrowserAdapter) this.adapter).getContext(), header.getStringResId(), new Object[]{Integer.valueOf(header.getCount())}, null, 4).toString());
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetThreadBrowserAdapter.kt */
|
|
public static abstract class Item implements MGRecyclerDataPayload {
|
|
|
|
/* compiled from: WidgetThreadBrowserAdapter.kt */
|
|
public static final class Header extends Item {
|
|
private final int count;
|
|
private final String key;
|
|
private final int stringResId;
|
|
private final int type = ItemType.HEADER.ordinal();
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public Header(String str, int i, int i2) {
|
|
super(null);
|
|
m.checkNotNullParameter(str, "key");
|
|
this.key = str;
|
|
this.stringResId = i;
|
|
this.count = i2;
|
|
}
|
|
|
|
public static /* synthetic */ Header copy$default(Header header, String str, int i, int i2, int i3, Object obj) {
|
|
if ((i3 & 1) != 0) {
|
|
str = header.getKey();
|
|
}
|
|
if ((i3 & 2) != 0) {
|
|
i = header.stringResId;
|
|
}
|
|
if ((i3 & 4) != 0) {
|
|
i2 = header.count;
|
|
}
|
|
return header.copy(str, i, i2);
|
|
}
|
|
|
|
public final String component1() {
|
|
return getKey();
|
|
}
|
|
|
|
public final int component2() {
|
|
return this.stringResId;
|
|
}
|
|
|
|
public final int component3() {
|
|
return this.count;
|
|
}
|
|
|
|
public final Header copy(String str, int i, int i2) {
|
|
m.checkNotNullParameter(str, "key");
|
|
return new Header(str, i, i2);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof Header)) {
|
|
return false;
|
|
}
|
|
Header header = (Header) obj;
|
|
return m.areEqual(getKey(), header.getKey()) && this.stringResId == header.stringResId && this.count == header.count;
|
|
}
|
|
|
|
public final int getCount() {
|
|
return this.count;
|
|
}
|
|
|
|
@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() {
|
|
String key = getKey();
|
|
return ((((key != null ? key.hashCode() : 0) * 31) + this.stringResId) * 31) + this.count;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("Header(key=");
|
|
K.append(getKey());
|
|
K.append(", stringResId=");
|
|
K.append(this.stringResId);
|
|
K.append(", count=");
|
|
return a.w(K, this.count, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetThreadBrowserAdapter.kt */
|
|
public static final class Loading extends Item {
|
|
private final String key;
|
|
private final int type;
|
|
|
|
public Loading() {
|
|
this(null, 1, null);
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public Loading(String str) {
|
|
super(null);
|
|
m.checkNotNullParameter(str, "key");
|
|
this.key = str;
|
|
this.type = ItemType.LOADING.ordinal();
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ Loading(String str, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this((i & 1) != 0 ? "loading" : str);
|
|
}
|
|
|
|
public static /* synthetic */ Loading copy$default(Loading loading, String str, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
str = loading.getKey();
|
|
}
|
|
return loading.copy(str);
|
|
}
|
|
|
|
public final String component1() {
|
|
return getKey();
|
|
}
|
|
|
|
public final Loading copy(String str) {
|
|
m.checkNotNullParameter(str, "key");
|
|
return new Loading(str);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this != obj) {
|
|
return (obj instanceof Loading) && m.areEqual(getKey(), ((Loading) obj).getKey());
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@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() {
|
|
String key = getKey();
|
|
if (key != null) {
|
|
return key.hashCode();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("Loading(key=");
|
|
K.append(getKey());
|
|
K.append(")");
|
|
return K.toString();
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetThreadBrowserAdapter.kt */
|
|
public static final class Thread extends Item {
|
|
private final String key;
|
|
private final ThreadBrowserThreadView.ThreadData threadData;
|
|
private final int type = ItemType.THREAD.ordinal();
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public Thread(ThreadBrowserThreadView.ThreadData threadData) {
|
|
super(null);
|
|
m.checkNotNullParameter(threadData, "threadData");
|
|
this.threadData = threadData;
|
|
this.key = String.valueOf(threadData.getChannel().h());
|
|
}
|
|
|
|
public static /* synthetic */ Thread copy$default(Thread thread, ThreadBrowserThreadView.ThreadData threadData, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
threadData = thread.threadData;
|
|
}
|
|
return thread.copy(threadData);
|
|
}
|
|
|
|
public final ThreadBrowserThreadView.ThreadData component1() {
|
|
return this.threadData;
|
|
}
|
|
|
|
public final Thread copy(ThreadBrowserThreadView.ThreadData threadData) {
|
|
m.checkNotNullParameter(threadData, "threadData");
|
|
return new Thread(threadData);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this != obj) {
|
|
return (obj instanceof Thread) && m.areEqual(this.threadData, ((Thread) obj).threadData);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
|
|
public String getKey() {
|
|
return this.key;
|
|
}
|
|
|
|
public final ThreadBrowserThreadView.ThreadData getThreadData() {
|
|
return this.threadData;
|
|
}
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
|
|
public int getType() {
|
|
return this.type;
|
|
}
|
|
|
|
public int hashCode() {
|
|
ThreadBrowserThreadView.ThreadData threadData = this.threadData;
|
|
if (threadData != null) {
|
|
return threadData.hashCode();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("Thread(threadData=");
|
|
K.append(this.threadData);
|
|
K.append(")");
|
|
return K.toString();
|
|
}
|
|
}
|
|
|
|
private Item() {
|
|
}
|
|
|
|
public /* synthetic */ Item(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetThreadBrowserAdapter.kt */
|
|
public enum ItemType {
|
|
THREAD,
|
|
HEADER,
|
|
LOADING;
|
|
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final ItemType[] cachedValues = values();
|
|
|
|
/* compiled from: WidgetThreadBrowserAdapter.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public final ItemType fromOrdinal(int i) {
|
|
return ItemType.access$getCachedValues$cp()[i];
|
|
}
|
|
}
|
|
|
|
public static final /* synthetic */ ItemType[] access$getCachedValues$cp() {
|
|
return cachedValues;
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetThreadBrowserAdapter.kt */
|
|
public static final class LoadingItem extends MGRecyclerViewHolder<WidgetThreadBrowserAdapter, Item> {
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public LoadingItem(WidgetThreadBrowserAdapter widgetThreadBrowserAdapter) {
|
|
super(2131558701, widgetThreadBrowserAdapter);
|
|
m.checkNotNullParameter(widgetThreadBrowserAdapter, "adapter");
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetThreadBrowserAdapter.kt */
|
|
public static final class ThreadItem extends MGRecyclerViewHolder<WidgetThreadBrowserAdapter, Item> {
|
|
private final ThreadBrowserItemThreadBinding binding;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public ThreadItem(WidgetThreadBrowserAdapter widgetThreadBrowserAdapter) {
|
|
super(2131558702, widgetThreadBrowserAdapter);
|
|
m.checkNotNullParameter(widgetThreadBrowserAdapter, "adapter");
|
|
View view = this.itemView;
|
|
Objects.requireNonNull(view, "rootView");
|
|
ThreadBrowserThreadView threadBrowserThreadView = (ThreadBrowserThreadView) view;
|
|
ThreadBrowserItemThreadBinding threadBrowserItemThreadBinding = new ThreadBrowserItemThreadBinding(threadBrowserThreadView, threadBrowserThreadView);
|
|
m.checkNotNullExpressionValue(threadBrowserItemThreadBinding, "ThreadBrowserItemThreadBinding.bind(itemView)");
|
|
this.binding = threadBrowserItemThreadBinding;
|
|
}
|
|
|
|
public static final /* synthetic */ WidgetThreadBrowserAdapter access$getAdapter$p(ThreadItem threadItem) {
|
|
return (WidgetThreadBrowserAdapter) threadItem.adapter;
|
|
}
|
|
|
|
public void onConfigure(int i, Item item) {
|
|
m.checkNotNullParameter(item, "data");
|
|
super.onConfigure(i, (int) item);
|
|
Item.Thread thread = (Item.Thread) item;
|
|
this.binding.b.setThreadData(thread.getThreadData());
|
|
this.binding.b.setOnClickListener(new WidgetThreadBrowserAdapter$ThreadItem$onConfigure$1(this, thread));
|
|
this.binding.b.setOnLongClickListener(new WidgetThreadBrowserAdapter$ThreadItem$onConfigure$2(this, thread));
|
|
}
|
|
}
|
|
|
|
public final /* synthetic */ class WhenMappings {
|
|
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
|
|
|
|
static {
|
|
ItemType.values();
|
|
int[] iArr = new int[3];
|
|
$EnumSwitchMapping$0 = iArr;
|
|
iArr[ItemType.THREAD.ordinal()] = 1;
|
|
iArr[ItemType.HEADER.ordinal()] = 2;
|
|
iArr[ItemType.LOADING.ordinal()] = 3;
|
|
}
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r5v0, resolved type: kotlin.jvm.functions.Function1<? super com.discord.api.channel.Channel, kotlin.Unit> */
|
|
/* JADX DEBUG: Multi-variable search result rejected for r6v0, resolved type: kotlin.jvm.functions.Function1<? super com.discord.api.channel.Channel, kotlin.Unit> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public WidgetThreadBrowserAdapter(RecyclerView recyclerView, Function1<? super Channel, Unit> function1, Function1<? super Channel, Unit> function12) {
|
|
super(recyclerView, false, 2, null);
|
|
m.checkNotNullParameter(recyclerView, "recycler");
|
|
m.checkNotNullParameter(function1, "onOpenThread");
|
|
m.checkNotNullParameter(function12, "onThreadSettings");
|
|
this.onOpenThread = function1;
|
|
this.onThreadSettings = function12;
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public MGRecyclerViewHolder<?, Item> onCreateViewHolder(ViewGroup viewGroup, int i) {
|
|
m.checkNotNullParameter(viewGroup, "parent");
|
|
int ordinal = ItemType.Companion.fromOrdinal(i).ordinal();
|
|
if (ordinal == 0) {
|
|
return new ThreadItem(this);
|
|
}
|
|
if (ordinal == 1) {
|
|
return new HeaderItem(this);
|
|
}
|
|
if (ordinal == 2) {
|
|
return new LoadingItem(this);
|
|
}
|
|
throw new NoWhenBranchMatchedException();
|
|
}
|
|
|
|
public final void onThreadClicked(Channel channel) {
|
|
m.checkNotNullParameter(channel, "channel");
|
|
this.onOpenThread.invoke(channel);
|
|
}
|
|
|
|
public final void onThreadLongClicked(Channel channel) {
|
|
m.checkNotNullParameter(channel, "channel");
|
|
this.onThreadSettings.invoke(channel);
|
|
}
|
|
}
|