124 lines
6.9 KiB
Java
124 lines
6.9 KiB
Java
|
package com.discord.widgets.guildscheduledevent;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.os.Bundle;
|
||
|
import android.view.View;
|
||
|
import android.widget.TextView;
|
||
|
import androidx.fragment.app.Fragment;
|
||
|
import androidx.fragment.app.FragmentManager;
|
||
|
import androidx.fragment.app.FragmentViewModelLazyKt;
|
||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||
|
import androidx.recyclerview.widget.RecyclerView;
|
||
|
import c.a.d.h0;
|
||
|
import c.a.d.j0;
|
||
|
import c.d.b.a.a;
|
||
|
import com.discord.app.AppBottomSheet;
|
||
|
import com.discord.databinding.WidgetGuildScheduledEventListBottomSheetBinding;
|
||
|
import com.discord.utilities.resources.StringResourceUtilsKt;
|
||
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
||
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
||
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
||
|
import com.discord.widgets.guildscheduledevent.GuildScheduledEventListViewModel;
|
||
|
import com.discord.widgets.stage.start.StartStageEventGuildsFeatureFlag;
|
||
|
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: WidgetGuildScheduledEventListBottomSheet.kt */
|
||
|
public final class WidgetGuildScheduledEventListBottomSheet extends AppBottomSheet {
|
||
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.W(WidgetGuildScheduledEventListBottomSheet.class, "binding", "getBinding()Lcom/discord/databinding/WidgetGuildScheduledEventListBottomSheetBinding;", 0)};
|
||
|
public static final Companion Companion = new Companion(null);
|
||
|
private GuildScheduledEventListAdapter adapter;
|
||
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetGuildScheduledEventListBottomSheet$binding$2.INSTANCE, null, 2, null);
|
||
|
private final Lazy viewModel$delegate;
|
||
|
|
||
|
/* compiled from: WidgetGuildScheduledEventListBottomSheet.kt */
|
||
|
public static final class Companion {
|
||
|
private Companion() {
|
||
|
}
|
||
|
|
||
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
||
|
this();
|
||
|
}
|
||
|
|
||
|
public final void show(FragmentManager fragmentManager, long j) {
|
||
|
m.checkNotNullParameter(fragmentManager, "fragmentManager");
|
||
|
if (StartStageEventGuildsFeatureFlag.Companion.getINSTANCE().canGuildAccessStartStageEvent(j)) {
|
||
|
WidgetGuildScheduledEventListBottomSheet widgetGuildScheduledEventListBottomSheet = new WidgetGuildScheduledEventListBottomSheet();
|
||
|
Bundle bundle = new Bundle();
|
||
|
bundle.putLong("com.discord.intent.extra.EXTRA_GUILD_ID", j);
|
||
|
widgetGuildScheduledEventListBottomSheet.setArguments(bundle);
|
||
|
widgetGuildScheduledEventListBottomSheet.show(fragmentManager, WidgetGuildScheduledEventListBottomSheet.class.getName());
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public WidgetGuildScheduledEventListBottomSheet() {
|
||
|
super(false, 1, null);
|
||
|
WidgetGuildScheduledEventListBottomSheet$viewModel$2 widgetGuildScheduledEventListBottomSheet$viewModel$2 = new WidgetGuildScheduledEventListBottomSheet$viewModel$2(this);
|
||
|
h0 h0Var = new h0(this);
|
||
|
this.viewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(GuildScheduledEventListViewModel.class), new WidgetGuildScheduledEventListBottomSheet$appViewModels$$inlined$viewModels$1(h0Var), new j0(widgetGuildScheduledEventListBottomSheet$viewModel$2));
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ void access$configureUi(WidgetGuildScheduledEventListBottomSheet widgetGuildScheduledEventListBottomSheet, GuildScheduledEventListViewModel.ViewState viewState) {
|
||
|
widgetGuildScheduledEventListBottomSheet.configureUi(viewState);
|
||
|
}
|
||
|
|
||
|
private final void configureUi(GuildScheduledEventListViewModel.ViewState viewState) {
|
||
|
if (!(viewState instanceof GuildScheduledEventListViewModel.ViewState.Loaded)) {
|
||
|
viewState = null;
|
||
|
}
|
||
|
GuildScheduledEventListViewModel.ViewState.Loaded loaded = (GuildScheduledEventListViewModel.ViewState.Loaded) viewState;
|
||
|
if (loaded != null) {
|
||
|
TextView textView = getBinding().f1821c;
|
||
|
m.checkNotNullExpressionValue(textView, "binding.guildScheduledEventListToolbarTitle");
|
||
|
Context requireContext = requireContext();
|
||
|
m.checkNotNullExpressionValue(requireContext, "requireContext()");
|
||
|
textView.setText(StringResourceUtilsKt.getI18nPluralString(requireContext, 2131755135, loaded.getGuildScheduledEvents().size(), Integer.valueOf(loaded.getGuildScheduledEvents().size())));
|
||
|
GuildScheduledEventListAdapter guildScheduledEventListAdapter = this.adapter;
|
||
|
if (guildScheduledEventListAdapter == null) {
|
||
|
m.throwUninitializedPropertyAccessException("adapter");
|
||
|
}
|
||
|
guildScheduledEventListAdapter.setData(loaded.getGuildScheduledEvents());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private final WidgetGuildScheduledEventListBottomSheetBinding getBinding() {
|
||
|
return (WidgetGuildScheduledEventListBottomSheetBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
||
|
}
|
||
|
|
||
|
private final GuildScheduledEventListViewModel getViewModel() {
|
||
|
return (GuildScheduledEventListViewModel) this.viewModel$delegate.getValue();
|
||
|
}
|
||
|
|
||
|
@Override // com.discord.app.AppBottomSheet
|
||
|
public int getContentViewResId() {
|
||
|
return 2131559063;
|
||
|
}
|
||
|
|
||
|
@Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment
|
||
|
public void onResume() {
|
||
|
super.onResume();
|
||
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle(getViewModel().observeViewState(), this), WidgetGuildScheduledEventListBottomSheet.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetGuildScheduledEventListBottomSheet$onResume$1(this), 62, (Object) null);
|
||
|
}
|
||
|
|
||
|
@Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment
|
||
|
public void onViewCreated(View view, Bundle bundle) {
|
||
|
m.checkNotNullParameter(view, "view");
|
||
|
super.onViewCreated(view, bundle);
|
||
|
RecyclerView recyclerView = getBinding().b;
|
||
|
m.checkNotNullExpressionValue(recyclerView, "binding.guildScheduledEventListRecyclerView");
|
||
|
this.adapter = new GuildScheduledEventListAdapter(recyclerView);
|
||
|
RecyclerView recyclerView2 = getBinding().b;
|
||
|
GuildScheduledEventListAdapter guildScheduledEventListAdapter = this.adapter;
|
||
|
if (guildScheduledEventListAdapter == null) {
|
||
|
m.throwUninitializedPropertyAccessException("adapter");
|
||
|
}
|
||
|
recyclerView2.setAdapter(guildScheduledEventListAdapter);
|
||
|
recyclerView2.setLayoutManager(new LinearLayoutManager(recyclerView2.getContext()));
|
||
|
}
|
||
|
}
|