144 lines
7.8 KiB
Java
144 lines
7.8 KiB
Java
package com.discord.widgets.channels.threads.browser;
|
|
|
|
import android.content.Context;
|
|
import android.os.Bundle;
|
|
import android.view.View;
|
|
import android.widget.TextView;
|
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
import androidx.fragment.app.Fragment;
|
|
import androidx.fragment.app.FragmentViewModelLazyKt;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import c.a.d.g0;
|
|
import c.d.b.a.a;
|
|
import com.discord.app.AppFragment;
|
|
import com.discord.databinding.WidgetThreadBrowserArchivedBinding;
|
|
import com.discord.utilities.mg_recycler.MGRecyclerAdapter;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
import com.discord.widgets.channels.threads.browser.WidgetThreadBrowserArchivedViewModel;
|
|
import com.google.android.material.button.MaterialButton;
|
|
import d0.g;
|
|
import d0.z.d.a0;
|
|
import d0.z.d.m;
|
|
import kotlin.Lazy;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.reflect.KProperty;
|
|
/* compiled from: WidgetThreadBrowserArchived.kt */
|
|
public final class WidgetThreadBrowserArchived extends AppFragment {
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.V(WidgetThreadBrowserArchived.class, "binding", "getBinding()Lcom/discord/databinding/WidgetThreadBrowserArchivedBinding;", 0)};
|
|
public static final Companion Companion = new Companion(null);
|
|
private WidgetThreadBrowserAdapter adapter;
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetThreadBrowserArchived$binding$2.INSTANCE, null, 2, null);
|
|
private final Lazy browserViewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(WidgetThreadBrowserViewModel.class), new WidgetThreadBrowserArchived$appActivityViewModels$$inlined$activityViewModels$3(this), new g0(new WidgetThreadBrowserArchived$browserViewModel$2(this)));
|
|
private final Lazy channelId$delegate = g.lazy(new WidgetThreadBrowserArchived$channelId$2(this));
|
|
private WidgetThreadBrowserArchivedViewModel.ViewState currentViewState;
|
|
private final Lazy guildId$delegate = g.lazy(new WidgetThreadBrowserArchived$guildId$2(this));
|
|
private final Lazy viewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(WidgetThreadBrowserArchivedViewModel.class), new WidgetThreadBrowserArchived$appActivityViewModels$$inlined$activityViewModels$1(this), new g0(new WidgetThreadBrowserArchived$viewModel$2(this)));
|
|
|
|
/* compiled from: WidgetThreadBrowserArchived.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public final WidgetThreadBrowserArchived create(long j, long j2) {
|
|
WidgetThreadBrowserArchived widgetThreadBrowserArchived = new WidgetThreadBrowserArchived();
|
|
Bundle bundle = new Bundle();
|
|
bundle.putLong("com.discord.intent.extra.EXTRA_GUILD_ID", j);
|
|
bundle.putLong("com.discord.intent.extra.EXTRA_CHANNEL_ID", j2);
|
|
widgetThreadBrowserArchived.setArguments(bundle);
|
|
return widgetThreadBrowserArchived;
|
|
}
|
|
}
|
|
|
|
public WidgetThreadBrowserArchived() {
|
|
super(2131559277);
|
|
}
|
|
|
|
public static final /* synthetic */ long access$getChannelId$p(WidgetThreadBrowserArchived widgetThreadBrowserArchived) {
|
|
return widgetThreadBrowserArchived.getChannelId();
|
|
}
|
|
|
|
public static final /* synthetic */ long access$getGuildId$p(WidgetThreadBrowserArchived widgetThreadBrowserArchived) {
|
|
return widgetThreadBrowserArchived.getGuildId();
|
|
}
|
|
|
|
public static final /* synthetic */ WidgetThreadBrowserArchivedViewModel access$getViewModel$p(WidgetThreadBrowserArchived widgetThreadBrowserArchived) {
|
|
return widgetThreadBrowserArchived.getViewModel();
|
|
}
|
|
|
|
public static final /* synthetic */ void access$updateView(WidgetThreadBrowserArchived widgetThreadBrowserArchived, WidgetThreadBrowserArchivedViewModel.ViewState viewState) {
|
|
widgetThreadBrowserArchived.updateView(viewState);
|
|
}
|
|
|
|
private final WidgetThreadBrowserArchivedBinding getBinding() {
|
|
return (WidgetThreadBrowserArchivedBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
}
|
|
|
|
private final WidgetThreadBrowserViewModel getBrowserViewModel() {
|
|
return (WidgetThreadBrowserViewModel) this.browserViewModel$delegate.getValue();
|
|
}
|
|
|
|
private final long getChannelId() {
|
|
return ((Number) this.channelId$delegate.getValue()).longValue();
|
|
}
|
|
|
|
private final long getGuildId() {
|
|
return ((Number) this.guildId$delegate.getValue()).longValue();
|
|
}
|
|
|
|
private final WidgetThreadBrowserArchivedViewModel getViewModel() {
|
|
return (WidgetThreadBrowserArchivedViewModel) this.viewModel$delegate.getValue();
|
|
}
|
|
|
|
private final void updateView(WidgetThreadBrowserArchivedViewModel.ViewState viewState) {
|
|
ConstraintLayout constraintLayout = getBinding().d;
|
|
m.checkNotNullExpressionValue(constraintLayout, "binding.threadBrowserErrorOverlay");
|
|
int i = 0;
|
|
constraintLayout.setVisibility(viewState.isError() ? 0 : 8);
|
|
this.currentViewState = viewState;
|
|
WidgetThreadBrowserAdapter widgetThreadBrowserAdapter = this.adapter;
|
|
if (widgetThreadBrowserAdapter == null) {
|
|
m.throwUninitializedPropertyAccessException("adapter");
|
|
}
|
|
widgetThreadBrowserAdapter.setData(viewState.getListItems());
|
|
TextView textView = getBinding().b.d;
|
|
m.checkNotNullExpressionValue(textView, "binding.emptyView.threadBrowserEmptyHeading");
|
|
textView.setText(requireContext().getString(2131894074));
|
|
ConstraintLayout constraintLayout2 = getBinding().b.b;
|
|
m.checkNotNullExpressionValue(constraintLayout2, "binding.emptyView.threadBrowserEmpty");
|
|
constraintLayout2.setVisibility(viewState.getListItems().isEmpty() ? 0 : 8);
|
|
MaterialButton materialButton = getBinding().b.f109c;
|
|
m.checkNotNullExpressionValue(materialButton, "binding.emptyView.threadBrowserEmptyCreateButton");
|
|
if (!viewState.getCanCreateThread()) {
|
|
i = 8;
|
|
}
|
|
materialButton.setVisibility(i);
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment, androidx.fragment.app.Fragment
|
|
public void onResume() {
|
|
super.onResume();
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle(getViewModel().observeViewState(), this), WidgetThreadBrowserArchived.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetThreadBrowserArchived$onResume$1(this), 62, (Object) null);
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
public void onViewBound(View view) {
|
|
m.checkNotNullParameter(view, "view");
|
|
super.onViewBound(view);
|
|
MGRecyclerAdapter.Companion companion = MGRecyclerAdapter.Companion;
|
|
RecyclerView recyclerView = getBinding().f1989c;
|
|
m.checkNotNullExpressionValue(recyclerView, "binding.recyclerView");
|
|
this.adapter = (WidgetThreadBrowserAdapter) companion.configure(new WidgetThreadBrowserAdapter(recyclerView, new WidgetThreadBrowserArchived$onViewBound$1(getBrowserViewModel()), new WidgetThreadBrowserArchived$onViewBound$2(this)));
|
|
getBinding().f1989c.addOnScrollListener(new WidgetThreadBrowserArchived$onViewBound$3(this));
|
|
getBinding().b.f109c.setOnClickListener(new WidgetThreadBrowserArchived$onViewBound$4(this));
|
|
getBinding().e.setOnClickListener(new WidgetThreadBrowserArchived$onViewBound$5(this));
|
|
}
|
|
}
|