125 lines
7.3 KiB
Java
125 lines
7.3 KiB
Java
package com.discord.widgets.servers;
|
|
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.view.View;
|
|
import androidx.fragment.app.Fragment;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import c.a.d.l;
|
|
import c.d.b.a.a;
|
|
import com.discord.app.AppFragment;
|
|
import com.discord.databinding.WidgetServerNotificationOverrideSelectorBinding;
|
|
import com.discord.stores.StoreChannels;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.utilities.channel.GuildChannelsInfo;
|
|
import com.discord.utilities.mg_recycler.CategoricalDragAndDropAdapter;
|
|
import com.discord.utilities.mg_recycler.MGRecyclerAdapter;
|
|
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.google.android.material.textfield.TextInputLayout;
|
|
import d0.z.d.m;
|
|
import java.util.List;
|
|
import java.util.concurrent.TimeUnit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.reflect.KProperty;
|
|
import rx.Observable;
|
|
import rx.subjects.BehaviorSubject;
|
|
/* compiled from: WidgetServerNotificationsOverrideSelector.kt */
|
|
public final class WidgetServerNotificationsOverrideSelector extends AppFragment {
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.V(WidgetServerNotificationsOverrideSelector.class, "binding", "getBinding()Lcom/discord/databinding/WidgetServerNotificationOverrideSelectorBinding;", 0)};
|
|
public static final Companion Companion = new Companion(null);
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetServerNotificationsOverrideSelector$binding$2.INSTANCE, null, 2, null);
|
|
private SettingsChannelListAdapter channelsAdapter;
|
|
private final BehaviorSubject<String> filterPublisher = BehaviorSubject.l0("");
|
|
|
|
/* compiled from: WidgetServerNotificationsOverrideSelector.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public static final /* synthetic */ Observable access$get(Companion companion, long j, BehaviorSubject behaviorSubject) {
|
|
return companion.get(j, behaviorSubject);
|
|
}
|
|
|
|
private final Observable<List<CategoricalDragAndDropAdapter.Payload>> get(long j, BehaviorSubject<String> behaviorSubject) {
|
|
Observable i = Observable.i(StoreChannels.observeChannelsForGuild$default(StoreStream.Companion.getChannels(), j, null, 2, null), GuildChannelsInfo.Companion.get(j), ObservableExtensionsKt.leadingEdgeThrottle(behaviorSubject, 100, TimeUnit.MILLISECONDS), WidgetServerNotificationsOverrideSelector$Companion$get$1.INSTANCE);
|
|
m.checkNotNullExpressionValue(i, "Observable.combineLatest… }\n }");
|
|
return ObservableExtensionsKt.computationBuffered(i).r();
|
|
}
|
|
|
|
public final void launch(Context context, long j) {
|
|
m.checkNotNullParameter(context, "context");
|
|
Intent putExtra = new Intent().putExtra("com.discord.intent.extra.EXTRA_GUILD_ID", j);
|
|
m.checkNotNullExpressionValue(putExtra, "Intent()\n .putE….EXTRA_GUILD_ID, guildId)");
|
|
l.d(context, WidgetServerNotificationsOverrideSelector.class, putExtra);
|
|
}
|
|
}
|
|
|
|
public WidgetServerNotificationsOverrideSelector() {
|
|
super(2131559161);
|
|
}
|
|
|
|
public static final /* synthetic */ SettingsChannelListAdapter access$getChannelsAdapter$p(WidgetServerNotificationsOverrideSelector widgetServerNotificationsOverrideSelector) {
|
|
SettingsChannelListAdapter settingsChannelListAdapter = widgetServerNotificationsOverrideSelector.channelsAdapter;
|
|
if (settingsChannelListAdapter == null) {
|
|
m.throwUninitializedPropertyAccessException("channelsAdapter");
|
|
}
|
|
return settingsChannelListAdapter;
|
|
}
|
|
|
|
public static final /* synthetic */ BehaviorSubject access$getFilterPublisher$p(WidgetServerNotificationsOverrideSelector widgetServerNotificationsOverrideSelector) {
|
|
return widgetServerNotificationsOverrideSelector.filterPublisher;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setChannelsAdapter$p(WidgetServerNotificationsOverrideSelector widgetServerNotificationsOverrideSelector, SettingsChannelListAdapter settingsChannelListAdapter) {
|
|
widgetServerNotificationsOverrideSelector.channelsAdapter = settingsChannelListAdapter;
|
|
}
|
|
|
|
private final WidgetServerNotificationOverrideSelectorBinding getBinding() {
|
|
return (WidgetServerNotificationOverrideSelectorBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
public void onViewBound(View view) {
|
|
m.checkNotNullParameter(view, "view");
|
|
super.onViewBound(view);
|
|
AppFragment.setActionBarDisplayHomeAsUpEnabled$default(this, false, 1, null);
|
|
setActionBarTitle(2131891685);
|
|
setActionBarSubtitle(2131893315);
|
|
TextInputLayout textInputLayout = getBinding().f1881c;
|
|
m.checkNotNullExpressionValue(textInputLayout, "binding.guildNotificationsChannelSearch");
|
|
ViewExtensions.addBindedTextWatcher(textInputLayout, this, new WidgetServerNotificationsOverrideSelector$onViewBound$1(this));
|
|
MGRecyclerAdapter.Companion companion = MGRecyclerAdapter.Companion;
|
|
RecyclerView recyclerView = getBinding().b;
|
|
m.checkNotNullExpressionValue(recyclerView, "binding.guildNotificationsChannelList");
|
|
SettingsChannelListAdapter settingsChannelListAdapter = (SettingsChannelListAdapter) companion.configure(new SettingsChannelListAdapter(recyclerView, false));
|
|
this.channelsAdapter = settingsChannelListAdapter;
|
|
if (settingsChannelListAdapter == null) {
|
|
m.throwUninitializedPropertyAccessException("channelsAdapter");
|
|
}
|
|
settingsChannelListAdapter.setOnClickListener(new WidgetServerNotificationsOverrideSelector$onViewBound$2(this));
|
|
RecyclerView recyclerView2 = getBinding().b;
|
|
m.checkNotNullExpressionValue(recyclerView2, "binding.guildNotificationsChannelList");
|
|
recyclerView2.setNestedScrollingEnabled(false);
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
public void onViewBoundOrOnResume() {
|
|
super.onViewBoundOrOnResume();
|
|
long longExtra = getMostRecentIntent().getLongExtra("com.discord.intent.extra.EXTRA_GUILD_ID", -1);
|
|
Companion companion = Companion;
|
|
BehaviorSubject<String> behaviorSubject = this.filterPublisher;
|
|
m.checkNotNullExpressionValue(behaviorSubject, "filterPublisher");
|
|
Observable access$get = Companion.access$get(companion, longExtra, behaviorSubject);
|
|
m.checkNotNullExpressionValue(access$get, "get(guildId, filterPublisher)");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(access$get, this, null, 2, null), WidgetServerNotificationsOverrideSelector.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetServerNotificationsOverrideSelector$onViewBoundOrOnResume$1(this), 62, (Object) null);
|
|
}
|
|
}
|