forked from Juby210/discord-jadx
164 lines
7.7 KiB
Java
164 lines
7.7 KiB
Java
package com.discord.widgets.quickmentions;
|
|
|
|
import android.app.Dialog;
|
|
import android.content.Context;
|
|
import android.graphics.drawable.ColorDrawable;
|
|
import android.os.Bundle;
|
|
import android.view.Window;
|
|
import androidx.core.os.BundleKt;
|
|
import androidx.fragment.app.Fragment;
|
|
import androidx.fragment.app.FragmentManager;
|
|
import androidx.fragment.app.FragmentViewModelLazyKt;
|
|
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
|
import androidx.viewpager2.widget.ViewPager2;
|
|
import c.d.b.a.a;
|
|
import c0.o;
|
|
import c0.z.d.a0;
|
|
import c0.z.d.m;
|
|
import com.discord.R;
|
|
import com.discord.app.AppDialog;
|
|
import com.discord.databinding.WidgetQuickMentionsDialogBinding;
|
|
import com.discord.utilities.accessibility.AccessibilityUtils;
|
|
import com.discord.utilities.analytics.AnalyticsTracker;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.view.recycler.ViewPager2ExtensionsKt;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
import com.discord.widgets.user.WidgetUserMentions;
|
|
import com.discord.widgets.user.search.WidgetGlobalSearch;
|
|
import com.discord.widgets.user.search.WidgetGlobalSearchDismissModel;
|
|
import com.google.android.material.tabs.TabLayout;
|
|
import kotlin.Lazy;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.reflect.KProperty;
|
|
/* compiled from: WidgetQuickMentionsDialog.kt */
|
|
public final class WidgetQuickMentionsDialog extends AppDialog {
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.Z(WidgetQuickMentionsDialog.class, "binding", "getBinding()Lcom/discord/databinding/WidgetQuickMentionsDialogBinding;", 0)};
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final int POSITION_MENTIONS = 1;
|
|
private static final int POSITION_QUICK_SWITCHER = 0;
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetQuickMentionsDialog$binding$2.INSTANCE, null, 2, null);
|
|
private final Lazy dismissViewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(WidgetGlobalSearchDismissModel.class), new WidgetQuickMentionsDialog$$special$$inlined$activityViewModels$1(this), new WidgetQuickMentionsDialog$$special$$inlined$activityViewModels$2(this));
|
|
|
|
/* compiled from: WidgetQuickMentionsDialog.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public static /* synthetic */ void show$default(Companion companion, FragmentManager fragmentManager, String str, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
str = null;
|
|
}
|
|
companion.show(fragmentManager, str);
|
|
}
|
|
|
|
public final void dismiss(FragmentManager fragmentManager) {
|
|
m.checkNotNullParameter(fragmentManager, "fragmentManager");
|
|
Fragment findFragmentByTag = fragmentManager.findFragmentByTag("javaClass");
|
|
if (findFragmentByTag instanceof WidgetQuickMentionsDialog) {
|
|
((WidgetQuickMentionsDialog) findFragmentByTag).dismiss();
|
|
}
|
|
}
|
|
|
|
public final void show(FragmentManager fragmentManager, String str) {
|
|
m.checkNotNullParameter(fragmentManager, "fragmentManager");
|
|
dismiss(fragmentManager);
|
|
WidgetQuickMentionsDialog widgetQuickMentionsDialog = new WidgetQuickMentionsDialog();
|
|
widgetQuickMentionsDialog.setArguments(BundleKt.bundleOf(o.to(WidgetGlobalSearch.EXTRA_SEARCH_TEXT, str)));
|
|
widgetQuickMentionsDialog.show(fragmentManager, "javaClass");
|
|
AnalyticsTracker.INSTANCE.quickSwitcherOpen();
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetQuickMentionsDialog.kt */
|
|
public static final class TabsAdapter extends FragmentStateAdapter {
|
|
private final String searchText;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public TabsAdapter(WidgetQuickMentionsDialog widgetQuickMentionsDialog, String str) {
|
|
super(widgetQuickMentionsDialog);
|
|
m.checkNotNullParameter(widgetQuickMentionsDialog, "fragment");
|
|
this.searchText = str;
|
|
}
|
|
|
|
@Override // androidx.viewpager2.adapter.FragmentStateAdapter
|
|
public Fragment createFragment(int i) {
|
|
if (i == 0) {
|
|
return WidgetGlobalSearch.Companion.create(this.searchText);
|
|
}
|
|
if (i == 1) {
|
|
return WidgetUserMentions.Companion.create(true);
|
|
}
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public int getItemCount() {
|
|
return 2;
|
|
}
|
|
|
|
public final int getItemTitleResId(int i) {
|
|
if (i == 0) {
|
|
return R.string.search;
|
|
}
|
|
if (i == 1) {
|
|
return R.string.mentions;
|
|
}
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
}
|
|
|
|
public WidgetQuickMentionsDialog() {
|
|
super(R.layout.widget_quick_mentions_dialog);
|
|
}
|
|
|
|
private final WidgetQuickMentionsDialogBinding getBinding() {
|
|
return (WidgetQuickMentionsDialogBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
}
|
|
|
|
private final WidgetGlobalSearchDismissModel getDismissViewModel() {
|
|
return (WidgetGlobalSearchDismissModel) this.dismissViewModel$delegate.getValue();
|
|
}
|
|
|
|
@Override // com.discord.app.AppDialog, androidx.fragment.app.DialogFragment
|
|
public Dialog onCreateDialog(Bundle bundle) {
|
|
setStyle(0, R.style.AppTheme_GlobalSearchDialog);
|
|
return super.onCreateDialog(bundle);
|
|
}
|
|
|
|
@Override // com.discord.app.AppDialog, androidx.fragment.app.DialogFragment, androidx.fragment.app.Fragment
|
|
public void onStart() {
|
|
Window window;
|
|
super.onStart();
|
|
Dialog dialog = getDialog();
|
|
if (dialog != null && (window = dialog.getWindow()) != null) {
|
|
if (!AccessibilityUtils.INSTANCE.isReducedMotionEnabled()) {
|
|
window.getAttributes().windowAnimations = R.style.UiKit_QuickSwitcher_Animation;
|
|
}
|
|
window.setLayout(-1, -1);
|
|
window.setBackgroundDrawable(new ColorDrawable(0));
|
|
window.setSoftInputMode(53);
|
|
}
|
|
}
|
|
|
|
@Override // com.discord.app.AppDialog
|
|
public void onViewBoundOrOnResume() {
|
|
super.onViewBoundOrOnResume();
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(getDismissViewModel().getDismissEvents(), this, null, 2, null), WidgetQuickMentionsDialog.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetQuickMentionsDialog$onViewBoundOrOnResume$1(this), 62, (Object) null);
|
|
TabsAdapter tabsAdapter = new TabsAdapter(this, requireArguments().getString(WidgetGlobalSearch.EXTRA_SEARCH_TEXT));
|
|
ViewPager2 viewPager2 = getBinding().b;
|
|
m.checkNotNullExpressionValue(viewPager2, "binding.tabContents");
|
|
viewPager2.setAdapter(tabsAdapter);
|
|
TabLayout tabLayout = getBinding().f2336c;
|
|
m.checkNotNullExpressionValue(tabLayout, "binding.tabs");
|
|
ViewPager2 viewPager22 = getBinding().b;
|
|
m.checkNotNullExpressionValue(viewPager22, "binding.tabContents");
|
|
ViewPager2ExtensionsKt.setUpWithViewPager2(tabLayout, viewPager22, new WidgetQuickMentionsDialog$onViewBoundOrOnResume$2(this, tabsAdapter));
|
|
}
|
|
}
|