forked from Juby210/discord-jadx
513 lines
27 KiB
Java
513 lines
27 KiB
Java
package com.discord.widgets.guilds.list;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.Resources;
|
|
import android.graphics.PointF;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.view.View;
|
|
import android.view.ViewStub;
|
|
import androidx.core.content.ContextCompat;
|
|
import androidx.fragment.app.Fragment;
|
|
import androidx.fragment.app.FragmentActivity;
|
|
import androidx.fragment.app.FragmentManager;
|
|
import androidx.fragment.app.FragmentViewModelLazyKt;
|
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import b.a.d.f0;
|
|
import b.a.d.h0;
|
|
import b.a.d.j;
|
|
import b.a.k.b;
|
|
import b.d.b.a.a;
|
|
import com.discord.R;
|
|
import com.discord.app.AppFragment;
|
|
import com.discord.databinding.WidgetGuildsListBinding;
|
|
import com.discord.stores.StoreConnectionOpen;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.utilities.accessibility.AccessibilityUtils;
|
|
import com.discord.utilities.analytics.AnalyticsTracker;
|
|
import com.discord.utilities.dimen.DimenUtils;
|
|
import com.discord.utilities.drawable.DrawableCompat;
|
|
import com.discord.utilities.resources.StringResourceUtilsKt;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.view.extensions.ViewExtensions;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
import com.discord.widgets.channels.list.WidgetChannelListUnreads;
|
|
import com.discord.widgets.channels.list.WidgetChannelsListItemChannelActions;
|
|
import com.discord.widgets.guilds.contextmenu.WidgetFolderContextMenu;
|
|
import com.discord.widgets.guilds.contextmenu.WidgetGuildContextMenu;
|
|
import com.discord.widgets.guilds.create.CreateGuildTrigger;
|
|
import com.discord.widgets.guilds.list.GuildListItem;
|
|
import com.discord.widgets.guilds.list.WidgetGuildListAdapter;
|
|
import com.discord.widgets.guilds.list.WidgetGuildsListViewModel;
|
|
import com.discord.widgets.home.WidgetHome;
|
|
import com.discord.widgets.hubs.HubEmailArgs;
|
|
import com.discord.widgets.hubs.WidgetHubEmailFlow;
|
|
import com.discord.widgets.nux.WidgetGuildTemplates;
|
|
import com.discord.widgets.nux.WidgetNavigationHelp;
|
|
import com.discord.widgets.tabs.BottomNavViewObserver;
|
|
import d0.z.d.a0;
|
|
import d0.z.d.m;
|
|
import kotlin.Lazy;
|
|
import kotlin.NoWhenBranchMatchedException;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.reflect.KProperty;
|
|
import rx.Observable;
|
|
/* compiled from: WidgetGuildsList.kt */
|
|
public final class WidgetGuildsList extends AppFragment implements WidgetGuildListAdapter.InteractionListener {
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.b0(WidgetGuildsList.class, "binding", "getBinding()Lcom/discord/databinding/WidgetGuildsListBinding;", 0)};
|
|
private WidgetGuildListAdapter adapter;
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetGuildsList$binding$2.INSTANCE, null, 2, null);
|
|
private final BottomNavViewObserver bottomNavViewObserver = BottomNavViewObserver.Companion.getINSTANCE();
|
|
private View guildListAddHint;
|
|
private WidgetChannelListUnreads guildListUnreads;
|
|
private final Lazy viewModel$delegate;
|
|
|
|
/* compiled from: WidgetGuildsList.kt */
|
|
public static final class AddGuildHint {
|
|
public static final Companion Companion = new Companion(null);
|
|
private final boolean isAddGuildHint;
|
|
private final boolean isEligible;
|
|
|
|
/* compiled from: WidgetGuildsList.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public final Observable<AddGuildHint> get() {
|
|
StoreStream.Companion companion = StoreStream.Companion;
|
|
Observable x2 = Observable.i(companion.getNux().getNuxState(), StoreConnectionOpen.observeConnectionOpen$default(companion.getConnectionOpen(), false, 1, null), companion.getChannels().observeGuildAndPrivateChannels(), WidgetGuildsList$AddGuildHint$Companion$get$1.INSTANCE).x(WidgetGuildsList$AddGuildHint$Companion$get$2.INSTANCE);
|
|
m.checkNotNullExpressionValue(x2, "Observable\n ….filter { it.isEligible }");
|
|
Observable<AddGuildHint> L = ObservableExtensionsKt.takeSingleUntilTimeout$default(x2, 0, false, 3, null).L(WidgetGuildsList$AddGuildHint$Companion$get$3.INSTANCE);
|
|
m.checkNotNullExpressionValue(L, "Observable\n … = false)\n }");
|
|
return L;
|
|
}
|
|
|
|
public final Observable<Boolean> getDismissAction() {
|
|
Observable<R> F = StoreStream.Companion.getNavigation().observeLeftPanelState().F(WidgetGuildsList$AddGuildHint$Companion$getDismissAction$1.INSTANCE);
|
|
m.checkNotNullExpressionValue(F, "StoreStream\n …te == PanelState.Closed }");
|
|
return F;
|
|
}
|
|
}
|
|
|
|
public AddGuildHint(boolean z2, boolean z3) {
|
|
this.isEligible = z2;
|
|
this.isAddGuildHint = z3;
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ AddGuildHint(boolean z2, boolean z3, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(z2, (i & 2) != 0 ? false : z3);
|
|
}
|
|
|
|
public static /* synthetic */ AddGuildHint copy$default(AddGuildHint addGuildHint, boolean z2, boolean z3, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
z2 = addGuildHint.isEligible;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
z3 = addGuildHint.isAddGuildHint;
|
|
}
|
|
return addGuildHint.copy(z2, z3);
|
|
}
|
|
|
|
public final boolean component1() {
|
|
return this.isEligible;
|
|
}
|
|
|
|
public final boolean component2() {
|
|
return this.isAddGuildHint;
|
|
}
|
|
|
|
public final AddGuildHint copy(boolean z2, boolean z3) {
|
|
return new AddGuildHint(z2, z3);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof AddGuildHint)) {
|
|
return false;
|
|
}
|
|
AddGuildHint addGuildHint = (AddGuildHint) obj;
|
|
return this.isEligible == addGuildHint.isEligible && this.isAddGuildHint == addGuildHint.isAddGuildHint;
|
|
}
|
|
|
|
public int hashCode() {
|
|
boolean z2 = this.isEligible;
|
|
int i = 1;
|
|
if (z2) {
|
|
z2 = true;
|
|
}
|
|
int i2 = z2 ? 1 : 0;
|
|
int i3 = z2 ? 1 : 0;
|
|
int i4 = z2 ? 1 : 0;
|
|
int i5 = i2 * 31;
|
|
boolean z3 = this.isAddGuildHint;
|
|
if (!z3) {
|
|
i = z3 ? 1 : 0;
|
|
}
|
|
return i5 + i;
|
|
}
|
|
|
|
public final boolean isAddGuildHint() {
|
|
return this.isAddGuildHint;
|
|
}
|
|
|
|
public final boolean isEligible() {
|
|
return this.isEligible;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder R = a.R("AddGuildHint(isEligible=");
|
|
R.append(this.isEligible);
|
|
R.append(", isAddGuildHint=");
|
|
return a.L(R, this.isAddGuildHint, ")");
|
|
}
|
|
}
|
|
|
|
public WidgetGuildsList() {
|
|
super(R.layout.widget_guilds_list);
|
|
WidgetGuildsList$viewModel$2 widgetGuildsList$viewModel$2 = WidgetGuildsList$viewModel$2.INSTANCE;
|
|
f0 f0Var = new f0(this);
|
|
this.viewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(WidgetGuildsListViewModel.class), new WidgetGuildsList$appViewModels$$inlined$viewModels$1(f0Var), new h0(widgetGuildsList$viewModel$2));
|
|
}
|
|
|
|
public static final /* synthetic */ void access$configureAddGuildHint(WidgetGuildsList widgetGuildsList, AddGuildHint addGuildHint) {
|
|
widgetGuildsList.configureAddGuildHint(addGuildHint);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$configureUI(WidgetGuildsList widgetGuildsList, WidgetGuildsListViewModel.ViewState viewState) {
|
|
widgetGuildsList.configureUI(viewState);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$dismissAddGuildHint(WidgetGuildsList widgetGuildsList, boolean z2) {
|
|
widgetGuildsList.dismissAddGuildHint(z2);
|
|
}
|
|
|
|
public static final /* synthetic */ WidgetGuildListAdapter access$getAdapter$p(WidgetGuildsList widgetGuildsList) {
|
|
WidgetGuildListAdapter widgetGuildListAdapter = widgetGuildsList.adapter;
|
|
if (widgetGuildListAdapter == null) {
|
|
m.throwUninitializedPropertyAccessException("adapter");
|
|
}
|
|
return widgetGuildListAdapter;
|
|
}
|
|
|
|
public static final /* synthetic */ WidgetGuildsListBinding access$getBinding$p(WidgetGuildsList widgetGuildsList) {
|
|
return widgetGuildsList.getBinding();
|
|
}
|
|
|
|
public static final /* synthetic */ View access$getGuildListAddHint$p(WidgetGuildsList widgetGuildsList) {
|
|
return widgetGuildsList.guildListAddHint;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleEvent(WidgetGuildsList widgetGuildsList, WidgetGuildsListViewModel.Event event) {
|
|
widgetGuildsList.handleEvent(event);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setAdapter$p(WidgetGuildsList widgetGuildsList, WidgetGuildListAdapter widgetGuildListAdapter) {
|
|
widgetGuildsList.adapter = widgetGuildListAdapter;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setGuildListAddHint$p(WidgetGuildsList widgetGuildsList, View view) {
|
|
widgetGuildsList.guildListAddHint = view;
|
|
}
|
|
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0019: APUT
|
|
(r1v0 java.lang.Object[])
|
|
(0 ??[int, short, byte, char])
|
|
(wrap: java.lang.CharSequence : 0x0015: INVOKE (r2v2 java.lang.CharSequence) =
|
|
(r7v0 'this' com.discord.widgets.guilds.list.WidgetGuildsList A[IMMUTABLE_TYPE, THIS])
|
|
(r2v1 int)
|
|
(wrap: java.lang.Object[] : 0x0011: NEW_ARRAY (r4v0 java.lang.Object[]) = (0 int) type: java.lang.Object[])
|
|
(null kotlin.jvm.functions.Function1)
|
|
(4 int)
|
|
type: STATIC call: b.a.k.b.k(androidx.fragment.app.Fragment, int, java.lang.Object[], kotlin.jvm.functions.Function1, int):java.lang.CharSequence)
|
|
*/
|
|
private final void announceFolderToggle(GuildListItem.FolderItem folderItem) {
|
|
Object[] objArr = new Object[2];
|
|
objArr[0] = b.k(this, folderItem.isOpen() ? R.string.collapsed : R.string.expanded, new Object[0], null, 4);
|
|
String name = folderItem.getName();
|
|
if (name == null) {
|
|
name = "";
|
|
}
|
|
objArr[1] = name;
|
|
AccessibilityUtils.INSTANCE.sendAnnouncement(requireContext(), a.M(objArr, 2, "%s, %s", "java.lang.String.format(this, *args)"));
|
|
}
|
|
|
|
private final void configureAddGuildHint(AddGuildHint addGuildHint) {
|
|
if (addGuildHint.isAddGuildHint()) {
|
|
StoreStream.Companion.getNux().updateNux(WidgetGuildsList$configureAddGuildHint$1.INSTANCE);
|
|
}
|
|
if (addGuildHint.isEligible()) {
|
|
AnalyticsTracker.INSTANCE.showFirstServerTipTutorial();
|
|
View view = this.guildListAddHint;
|
|
if (view != null) {
|
|
ViewExtensions.fadeIn$default(view, 0, null, null, null, 15, null);
|
|
}
|
|
}
|
|
}
|
|
|
|
private final void configureBottomNavSpace() {
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(this.bottomNavViewObserver.observeHeight(), this, null, 2, null), WidgetGuildsList.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetGuildsList$configureBottomNavSpace$1(this), 62, (Object) null);
|
|
}
|
|
|
|
private final void configureUI(WidgetGuildsListViewModel.ViewState viewState) {
|
|
View view;
|
|
if (viewState instanceof WidgetGuildsListViewModel.ViewState.Loaded) {
|
|
WidgetGuildListAdapter widgetGuildListAdapter = this.adapter;
|
|
if (widgetGuildListAdapter == null) {
|
|
m.throwUninitializedPropertyAccessException("adapter");
|
|
}
|
|
WidgetGuildsListViewModel.ViewState.Loaded loaded = (WidgetGuildsListViewModel.ViewState.Loaded) viewState;
|
|
widgetGuildListAdapter.setItems(loaded.getItems(), !loaded.getWasDragResult());
|
|
WidgetChannelListUnreads widgetChannelListUnreads = this.guildListUnreads;
|
|
if (widgetChannelListUnreads != null) {
|
|
widgetChannelListUnreads.onDatasetChanged(loaded.getItems());
|
|
}
|
|
if (loaded.getHasChannels() && (view = this.guildListAddHint) != null && view.getVisibility() == 0) {
|
|
dismissAddGuildHint(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
private final void dismissAddGuildHint(boolean z2) {
|
|
if (z2) {
|
|
View view = this.guildListAddHint;
|
|
if (view != null) {
|
|
ViewExtensions.fadeOut$default(view, 0, null, null, 7, null);
|
|
}
|
|
AnalyticsTracker.INSTANCE.closeFirstServerTipTutorial(true);
|
|
return;
|
|
}
|
|
View view2 = this.guildListAddHint;
|
|
if (view2 != null && view2.getVisibility() == 0) {
|
|
View view3 = this.guildListAddHint;
|
|
if (view3 != null) {
|
|
view3.setVisibility(8);
|
|
}
|
|
AnalyticsTracker.INSTANCE.closeFirstServerTipTutorial(false);
|
|
}
|
|
}
|
|
|
|
private final void focusFirstElement() {
|
|
View childAt = getBinding().f2423b.getChildAt(0);
|
|
if (childAt != null) {
|
|
childAt.sendAccessibilityEvent(8);
|
|
}
|
|
}
|
|
|
|
private final WidgetGuildsListBinding getBinding() {
|
|
return (WidgetGuildsListBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
}
|
|
|
|
private final WidgetGuildsListViewModel getViewModel() {
|
|
return (WidgetGuildsListViewModel) this.viewModel$delegate.getValue();
|
|
}
|
|
|
|
private final void handleEvent(WidgetGuildsListViewModel.Event event) {
|
|
if (event instanceof WidgetGuildsListViewModel.Event.ShowChannelActions) {
|
|
showChannelActions(((WidgetGuildsListViewModel.Event.ShowChannelActions) event).getChannelId());
|
|
} else if (event instanceof WidgetGuildsListViewModel.Event.ShowUnavailableGuilds) {
|
|
showUnavailableGuildsToast(((WidgetGuildsListViewModel.Event.ShowUnavailableGuilds) event).getUnavailableGuildCount());
|
|
} else if (event instanceof WidgetGuildsListViewModel.Event.AnnounceFolderToggleForAccessibility) {
|
|
announceFolderToggle(((WidgetGuildsListViewModel.Event.AnnounceFolderToggleForAccessibility) event).getItem());
|
|
} else if (m.areEqual(event, WidgetGuildsListViewModel.Event.ShowCreateGuild.INSTANCE)) {
|
|
showCreateGuild();
|
|
} else if (m.areEqual(event, WidgetGuildsListViewModel.Event.ShowHubVerification.INSTANCE)) {
|
|
showHubVerification();
|
|
} else if (m.areEqual(event, WidgetGuildsListViewModel.Event.ShowHelp.INSTANCE)) {
|
|
showHelp();
|
|
} else if (m.areEqual(event, WidgetGuildsListViewModel.Event.FocusFirstElement.INSTANCE)) {
|
|
focusFirstElement();
|
|
} else {
|
|
throw new NoWhenBranchMatchedException();
|
|
}
|
|
}
|
|
|
|
private final void setupRecycler() {
|
|
RecyclerView recyclerView = getBinding().f2423b;
|
|
m.checkNotNullExpressionValue(recyclerView, "binding.guildList");
|
|
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(recyclerView.getContext(), 1, false);
|
|
WidgetGuildListAdapter widgetGuildListAdapter = new WidgetGuildListAdapter(linearLayoutManager, this);
|
|
this.adapter = widgetGuildListAdapter;
|
|
if (widgetGuildListAdapter == null) {
|
|
m.throwUninitializedPropertyAccessException("adapter");
|
|
}
|
|
widgetGuildListAdapter.setHasStableIds(true);
|
|
RecyclerView recyclerView2 = getBinding().f2423b;
|
|
m.checkNotNullExpressionValue(recyclerView2, "binding.guildList");
|
|
recyclerView2.setItemAnimator(null);
|
|
RecyclerView recyclerView3 = getBinding().f2423b;
|
|
m.checkNotNullExpressionValue(recyclerView3, "binding.guildList");
|
|
recyclerView3.setLayoutManager(linearLayoutManager);
|
|
RecyclerView recyclerView4 = getBinding().f2423b;
|
|
m.checkNotNullExpressionValue(recyclerView4, "binding.guildList");
|
|
WidgetGuildListAdapter widgetGuildListAdapter2 = this.adapter;
|
|
if (widgetGuildListAdapter2 == null) {
|
|
m.throwUninitializedPropertyAccessException("adapter");
|
|
}
|
|
recyclerView4.setAdapter(widgetGuildListAdapter2);
|
|
WidgetGuildListAdapter widgetGuildListAdapter3 = this.adapter;
|
|
if (widgetGuildListAdapter3 == null) {
|
|
m.throwUninitializedPropertyAccessException("adapter");
|
|
}
|
|
new ItemTouchHelper(new GuildsDragAndDropCallback(widgetGuildListAdapter3)).attachToRecyclerView(getBinding().f2423b);
|
|
RecyclerView recyclerView5 = getBinding().f2423b;
|
|
Drawable drawable = ContextCompat.getDrawable(requireContext(), DrawableCompat.getThemedDrawableRes$default(requireContext(), (int) R.attr.bg_folder_no_children, 0, 2, (Object) null));
|
|
m.checkNotNull(drawable);
|
|
m.checkNotNullExpressionValue(drawable, "ContextCompat.getDrawabl…children)\n )!!");
|
|
Drawable drawable2 = ContextCompat.getDrawable(requireContext(), DrawableCompat.getThemedDrawableRes$default(requireContext(), (int) R.attr.bg_folder_tintable_no_children, 0, 2, (Object) null));
|
|
m.checkNotNull(drawable2);
|
|
m.checkNotNullExpressionValue(drawable2, "ContextCompat.getDrawabl…children)\n )!!");
|
|
Drawable drawable3 = ContextCompat.getDrawable(requireContext(), DrawableCompat.getThemedDrawableRes$default(requireContext(), (int) R.attr.bg_folder_with_children, 0, 2, (Object) null));
|
|
m.checkNotNull(drawable3);
|
|
m.checkNotNullExpressionValue(drawable3, "ContextCompat.getDrawabl…children)\n )!!");
|
|
recyclerView5.addItemDecoration(new FolderItemDecoration(drawable, drawable2, drawable3, requireContext().getResources().getDimensionPixelSize(R.dimen.avatar_size_large)));
|
|
}
|
|
|
|
private final void showChannelActions(long j) {
|
|
WidgetChannelsListItemChannelActions.Companion companion = WidgetChannelsListItemChannelActions.Companion;
|
|
FragmentManager parentFragmentManager = getParentFragmentManager();
|
|
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
|
|
companion.show(parentFragmentManager, j);
|
|
}
|
|
|
|
private final void showCreateGuild() {
|
|
dismissAddGuildHint(true);
|
|
WidgetGuildTemplates.Companion.launch(requireContext(), CreateGuildTrigger.IN_APP, false);
|
|
}
|
|
|
|
private final void showHelp() {
|
|
dismissAddGuildHint(true);
|
|
WidgetNavigationHelp.Companion companion = WidgetNavigationHelp.Companion;
|
|
FragmentManager parentFragmentManager = getParentFragmentManager();
|
|
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
|
|
companion.show(parentFragmentManager);
|
|
}
|
|
|
|
private final void showHubVerification() {
|
|
j.d(requireContext(), WidgetHubEmailFlow.class, new HubEmailArgs(null, 0, null, 7, null));
|
|
}
|
|
|
|
private final void showUnavailableGuildsToast(int i) {
|
|
Resources resources = getResources();
|
|
m.checkNotNullExpressionValue(resources, "resources");
|
|
b.a.d.m.h(getContext(), b.l(StringResourceUtilsKt.getQuantityString(resources, requireContext(), (int) R.plurals.partial_outage_count, i, Integer.valueOf(i)), new Object[0], null, 2), 0, null, 12);
|
|
}
|
|
|
|
@Override // com.discord.widgets.guilds.list.WidgetGuildListAdapter.InteractionListener
|
|
public boolean onDrop() {
|
|
return getViewModel().onDrop();
|
|
}
|
|
|
|
@Override // com.discord.widgets.guilds.list.WidgetGuildListAdapter.InteractionListener
|
|
public void onItemClicked(View view, GuildListItem guildListItem) {
|
|
m.checkNotNullParameter(view, "view");
|
|
m.checkNotNullParameter(guildListItem, "item");
|
|
WidgetGuildsListViewModel viewModel = getViewModel();
|
|
Context requireContext = requireContext();
|
|
FragmentManager parentFragmentManager = getParentFragmentManager();
|
|
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
|
|
viewModel.onItemClicked(guildListItem, requireContext, parentFragmentManager);
|
|
}
|
|
|
|
@Override // com.discord.widgets.guilds.list.WidgetGuildListAdapter.InteractionListener
|
|
public void onItemLongPressed(View view, GuildListItem guildListItem) {
|
|
m.checkNotNullParameter(view, "view");
|
|
m.checkNotNullParameter(guildListItem, "item");
|
|
boolean z2 = guildListItem instanceof GuildListItem.GuildItem;
|
|
if (z2 || (guildListItem instanceof GuildListItem.FolderItem)) {
|
|
int[] iArr = new int[2];
|
|
view.getLocationInWindow(iArr);
|
|
PointF pointF = new PointF(((float) iArr[0]) + ((float) DimenUtils.dpToPixels(64)), (float) iArr[1]);
|
|
if (z2) {
|
|
WidgetGuildContextMenu.Companion companion = WidgetGuildContextMenu.Companion;
|
|
FragmentActivity requireActivity = requireActivity();
|
|
m.checkNotNullExpressionValue(requireActivity, "requireActivity()");
|
|
companion.show(requireActivity, pointF, ((GuildListItem.GuildItem) guildListItem).getGuild().getId());
|
|
} else if (guildListItem instanceof GuildListItem.FolderItem) {
|
|
WidgetFolderContextMenu.Companion companion2 = WidgetFolderContextMenu.Companion;
|
|
FragmentActivity requireActivity2 = requireActivity();
|
|
m.checkNotNullExpressionValue(requireActivity2, "requireActivity()");
|
|
companion2.show(requireActivity2, pointF, ((GuildListItem.FolderItem) guildListItem).getFolderId());
|
|
}
|
|
} else {
|
|
getViewModel().onItemLongPressed(guildListItem);
|
|
}
|
|
}
|
|
|
|
@Override // com.discord.widgets.guilds.list.WidgetGuildListAdapter.InteractionListener
|
|
public void onItemMoved() {
|
|
WidgetGuildContextMenu.Companion companion = WidgetGuildContextMenu.Companion;
|
|
FragmentActivity requireActivity = requireActivity();
|
|
m.checkNotNullExpressionValue(requireActivity, "requireActivity()");
|
|
companion.hide(requireActivity, true);
|
|
WidgetFolderContextMenu.Companion companion2 = WidgetFolderContextMenu.Companion;
|
|
FragmentActivity requireActivity2 = requireActivity();
|
|
m.checkNotNullExpressionValue(requireActivity2, "requireActivity()");
|
|
companion2.hide(requireActivity2, true);
|
|
}
|
|
|
|
@Override // com.discord.widgets.guilds.list.WidgetGuildListAdapter.InteractionListener
|
|
public void onOperation(WidgetGuildListAdapter.Operation operation) {
|
|
m.checkNotNullParameter(operation, "operation");
|
|
if (operation instanceof WidgetGuildListAdapter.Operation.MoveAbove) {
|
|
WidgetGuildListAdapter.Operation.MoveAbove moveAbove = (WidgetGuildListAdapter.Operation.MoveAbove) operation;
|
|
getViewModel().moveAbove(moveAbove.getFromPosition(), moveAbove.getTargetPosition());
|
|
} else if (operation instanceof WidgetGuildListAdapter.Operation.MoveBelow) {
|
|
WidgetGuildListAdapter.Operation.MoveBelow moveBelow = (WidgetGuildListAdapter.Operation.MoveBelow) operation;
|
|
getViewModel().moveBelow(moveBelow.getFromPosition(), moveBelow.getTargetPosition());
|
|
} else if (operation instanceof WidgetGuildListAdapter.Operation.TargetOperation) {
|
|
WidgetGuildListAdapter.Operation.TargetOperation targetOperation = (WidgetGuildListAdapter.Operation.TargetOperation) operation;
|
|
getViewModel().target(targetOperation.getFromPosition(), targetOperation.getTargetPosition());
|
|
}
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment, androidx.fragment.app.Fragment
|
|
public void onResume() {
|
|
super.onResume();
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle$default(getViewModel().observeViewState(), this, null, 2, null), WidgetGuildsList.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetGuildsList$onResume$1(this), 62, (Object) null);
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle$default(getViewModel().listenForEvents(), this, null, 2, null), WidgetGuildsList.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetGuildsList$onResume$2(this), 62, (Object) null);
|
|
AddGuildHint.Companion companion = AddGuildHint.Companion;
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(companion.get(), this, null, 2, null), WidgetGuildsList.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetGuildsList$onResume$3(this), 62, (Object) null);
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(companion.getDismissAction(), this, null, 2, null), WidgetGuildsList.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetGuildsList$onResume$4(this), 62, (Object) null);
|
|
configureBottomNavSpace();
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
public void onViewBound(View view) {
|
|
m.checkNotNullParameter(view, "view");
|
|
super.onViewBound(view);
|
|
setupRecycler();
|
|
ViewStub viewStub = getBinding().c;
|
|
m.checkNotNullExpressionValue(viewStub, "binding.guildListUnreadsStub");
|
|
RecyclerView recyclerView = getBinding().f2423b;
|
|
m.checkNotNullExpressionValue(recyclerView, "binding.guildList");
|
|
WidgetChannelListUnreads widgetChannelListUnreads = new WidgetChannelListUnreads(viewStub, recyclerView, null, new WidgetGuildsList$onViewBound$1(this), 0, 0, false, 116, null);
|
|
this.guildListUnreads = widgetChannelListUnreads;
|
|
if (widgetChannelListUnreads != null) {
|
|
widgetChannelListUnreads.setMentionResId(R.string._new);
|
|
}
|
|
WidgetChannelListUnreads widgetChannelListUnreads2 = this.guildListUnreads;
|
|
if (widgetChannelListUnreads2 != null) {
|
|
widgetChannelListUnreads2.setUnreadsEnabled(false);
|
|
}
|
|
Fragment parentFragment = getParentFragment();
|
|
if (!(parentFragment instanceof WidgetHome)) {
|
|
parentFragment = null;
|
|
}
|
|
WidgetHome widgetHome = (WidgetHome) parentFragment;
|
|
if (widgetHome != null) {
|
|
widgetHome.setOnGuildListAddHintCreate(new WidgetGuildsList$onViewBound$2(this));
|
|
}
|
|
}
|
|
}
|