197 lines
8.7 KiB
Java
197 lines
8.7 KiB
Java
package c.a.y;
|
|
|
|
import android.animation.Animator;
|
|
import android.animation.AnimatorInflater;
|
|
import android.content.Context;
|
|
import android.content.res.Configuration;
|
|
import android.text.Editable;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.widget.EditText;
|
|
import android.widget.TextView;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import c.a.i.t0;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import com.discord.R;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.app.AppComponent;
|
|
import com.discord.utilities.mg_recycler.MGRecyclerAdapter;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.view.extensions.ViewExtensions;
|
|
import com.discord.utilities.view.text.TextWatcher;
|
|
import com.discord.widgets.user.search.WidgetGlobalSearchAdapter;
|
|
import com.discord.widgets.user.search.WidgetGlobalSearchModel;
|
|
import com.google.android.material.textfield.TextInputLayout;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import rx.Observable;
|
|
import rx.subjects.BehaviorSubject;
|
|
/* compiled from: OverlayVoiceSelectorBubbleDialog.kt */
|
|
public final class z extends l implements AppComponent {
|
|
public final BehaviorSubject<String> A = BehaviorSubject.k0("");
|
|
public String B;
|
|
|
|
/* renamed from: y reason: collision with root package name */
|
|
public t0 f247y;
|
|
|
|
/* renamed from: z reason: collision with root package name */
|
|
public final WidgetGlobalSearchAdapter f248z;
|
|
|
|
/* compiled from: OverlayVoiceSelectorBubbleDialog.kt */
|
|
public static final class a implements View.OnClickListener {
|
|
public final /* synthetic */ z i;
|
|
|
|
public a(z zVar) {
|
|
this.i = zVar;
|
|
}
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
this.i.g();
|
|
}
|
|
}
|
|
|
|
/* compiled from: OverlayVoiceSelectorBubbleDialog.kt */
|
|
public static final class b extends o implements Function1<Editable, Unit> {
|
|
public final /* synthetic */ z this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public b(z zVar) {
|
|
super(1);
|
|
this.this$0 = zVar;
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public Unit invoke(Editable editable) {
|
|
Editable editable2 = editable;
|
|
m.checkNotNullParameter(editable2, "editable");
|
|
this.this$0.A.onNext(editable2.toString());
|
|
return Unit.a;
|
|
}
|
|
}
|
|
|
|
/* compiled from: OverlayVoiceSelectorBubbleDialog.kt */
|
|
public static final class c<T, R> implements j0.k.b<String, String> {
|
|
public static final c i = new c();
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
@Override // j0.k.b
|
|
public String call(String str) {
|
|
return '!' + str;
|
|
}
|
|
}
|
|
|
|
/* compiled from: OverlayVoiceSelectorBubbleDialog.kt */
|
|
public static final class d extends o implements Function1<WidgetGlobalSearchModel, Unit> {
|
|
public final /* synthetic */ z this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public d(z zVar) {
|
|
super(1);
|
|
this.this$0 = zVar;
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public Unit invoke(WidgetGlobalSearchModel widgetGlobalSearchModel) {
|
|
WidgetGlobalSearchModel widgetGlobalSearchModel2 = widgetGlobalSearchModel;
|
|
m.checkNotNullParameter(widgetGlobalSearchModel2, "it");
|
|
z zVar = this.this$0;
|
|
TextView textView = zVar.f247y.d;
|
|
m.checkNotNullExpressionValue(textView, "binding.emptyResults");
|
|
int i = 8;
|
|
textView.setVisibility(widgetGlobalSearchModel2.getData().isEmpty() ? 0 : 8);
|
|
RecyclerView recyclerView = zVar.f247y.f;
|
|
m.checkNotNullExpressionValue(recyclerView, "binding.resultsRv");
|
|
if (!widgetGlobalSearchModel2.getData().isEmpty()) {
|
|
i = 0;
|
|
}
|
|
recyclerView.setVisibility(i);
|
|
WidgetGlobalSearchAdapter widgetGlobalSearchAdapter = zVar.f248z;
|
|
widgetGlobalSearchAdapter.setOnUpdated(new x(zVar, widgetGlobalSearchModel2));
|
|
List<WidgetGlobalSearchModel.ItemDataPayload> data = widgetGlobalSearchModel2.getData();
|
|
ArrayList arrayList = new ArrayList();
|
|
for (Object obj : data) {
|
|
Channel channel = ((WidgetGlobalSearchModel.ItemDataPayload) obj).getChannel();
|
|
if (channel != null && AnimatableValueParser.D1(channel)) {
|
|
arrayList.add(obj);
|
|
}
|
|
}
|
|
widgetGlobalSearchAdapter.setData(arrayList);
|
|
widgetGlobalSearchAdapter.setOnSelectedListener(new y(zVar, widgetGlobalSearchModel2));
|
|
return Unit.a;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public z(Context context) {
|
|
super(context);
|
|
m.checkNotNullParameter(context, "context");
|
|
getWindowLayoutParams().flags &= -9;
|
|
t0 a2 = t0.a(LayoutInflater.from(getContext()), this, true);
|
|
m.checkNotNullExpressionValue(a2, "OverlayVoiceChannelSelec…rom(context), this, true)");
|
|
this.f247y = a2;
|
|
RecyclerView recyclerView = this.f247y.f;
|
|
m.checkNotNullExpressionValue(recyclerView, "binding.resultsRv");
|
|
this.f248z = new WidgetGlobalSearchAdapter(recyclerView);
|
|
}
|
|
|
|
@Override // c.a.y.l
|
|
public Animator getClosingAnimator() {
|
|
Animator loadAnimator = AnimatorInflater.loadAnimator(getContext(), R.animator.overlay_slide_down_fade_out);
|
|
loadAnimator.setTarget(this.f247y.f160c);
|
|
m.checkNotNullExpressionValue(loadAnimator, "AnimatorInflater.loadAni…binding.dialogCard)\n }");
|
|
return loadAnimator;
|
|
}
|
|
|
|
public final void h() {
|
|
this.f247y.b.setOnClickListener(new a(this));
|
|
TextInputLayout textInputLayout = this.f247y.e;
|
|
m.checkNotNullExpressionValue(textInputLayout, "binding.overlayChannelSearch");
|
|
ViewExtensions.setText(textInputLayout, this.B);
|
|
TextInputLayout textInputLayout2 = this.f247y.e;
|
|
m.checkNotNullExpressionValue(textInputLayout2, "binding.overlayChannelSearch");
|
|
EditText editText = textInputLayout2.getEditText();
|
|
if (editText != null) {
|
|
editText.addTextChangedListener(new TextWatcher(null, null, new b(this), 3, null));
|
|
}
|
|
WidgetGlobalSearchAdapter widgetGlobalSearchAdapter = this.f248z;
|
|
RecyclerView recyclerView = this.f247y.f;
|
|
m.checkNotNullExpressionValue(recyclerView, "binding.resultsRv");
|
|
widgetGlobalSearchAdapter.setRecycler(recyclerView);
|
|
MGRecyclerAdapter.Companion.configure(this.f248z);
|
|
WidgetGlobalSearchModel.Companion companion = WidgetGlobalSearchModel.Companion;
|
|
Observable<String> F = this.A.F(c.i);
|
|
m.checkNotNullExpressionValue(F, "filterPublisher.map { \"!$it\" }");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui(companion.getForNav(F), this, this.f248z), z.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new d(this), 62, (Object) null);
|
|
}
|
|
|
|
@Override // android.view.View, android.view.ViewGroup
|
|
public void onAttachedToWindow() {
|
|
super.onAttachedToWindow();
|
|
h();
|
|
Animator loadAnimator = AnimatorInflater.loadAnimator(getContext(), R.animator.overlay_slide_up_fade_in);
|
|
loadAnimator.setTarget(this.f247y.f160c);
|
|
loadAnimator.start();
|
|
}
|
|
|
|
@Override // com.discord.overlay.views.OverlayDialog, com.discord.overlay.views.OverlayBubbleWrap, android.view.View
|
|
public void onConfigurationChanged(Configuration configuration) {
|
|
super.onConfigurationChanged(configuration);
|
|
getUnsubscribeSignal().onNext(null);
|
|
removeAllViewsInLayout();
|
|
t0 a2 = t0.a(LayoutInflater.from(getContext()), this, true);
|
|
m.checkNotNullExpressionValue(a2, "OverlayVoiceChannelSelec…rom(context), this, true)");
|
|
this.f247y = a2;
|
|
h();
|
|
}
|
|
}
|