package com.discord.views; import android.animation.Animator; import android.animation.AnimatorInflater; import android.animation.AnimatorSet; import android.content.Context; import android.content.res.Configuration; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import androidx.recyclerview.widget.RecyclerView; import c.a.i.p0; import c.a.i.q0; import c.a.y.k; import c.a.y.o; import com.discord.app.AppComponent; import com.discord.stores.StoreChannels; import com.discord.stores.StoreStream; import com.discord.stores.StoreVoiceParticipants; import com.discord.utilities.rx.ObservableExtensionsKt; import com.discord.utilities.view.extensions.ViewExtensions; import com.discord.utilities.views.SimpleRecyclerAdapter; import d0.t.u; import d0.z.d.m; import java.util.ArrayList; import java.util.List; import kotlin.Pair; import kotlin.Unit; import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function1; import rx.Observable; /* compiled from: OverlayMenuBubbleDialog.kt */ public final class OverlayMenuBubbleDialog extends k implements AppComponent { /* renamed from: y reason: collision with root package name */ public final p0 f2138y; /* renamed from: z reason: collision with root package name */ public final SimpleRecyclerAdapter f2139z; /* compiled from: OverlayMenuBubbleDialog.kt */ public static final class a extends SimpleRecyclerAdapter.ViewHolder { public final q0 a; /* JADX WARNING: Illegal instructions before constructor call */ public a(q0 q0Var) { super(r0); m.checkNotNullParameter(q0Var, "binding"); VoiceUserView voiceUserView = q0Var.a; m.checkNotNullExpressionValue(voiceUserView, "binding.root"); this.a = q0Var; } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // com.discord.utilities.views.SimpleRecyclerAdapter.ViewHolder public void bind(StoreVoiceParticipants.VoiceUser voiceUser) { StoreVoiceParticipants.VoiceUser voiceUser2 = voiceUser; m.checkNotNullParameter(voiceUser2, "data"); this.a.a.a(voiceUser2, 2131165286); } } /* compiled from: OverlayMenuBubbleDialog.kt */ public static final class b implements j0.k.b>> { public static final b i = new b(); /* 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 Observable> call(Long l) { Long l2 = l; StoreChannels channels = StoreStream.Companion.getChannels(); m.checkNotNullExpressionValue(l2, "channelId"); return channels.observeChannel(l2.longValue()).Y(new o(l2)); } } /* compiled from: OverlayMenuBubbleDialog.kt */ public static final class c implements j0.k.b, Pair, ? extends Integer>> { 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 Pair, ? extends Integer> call(List list) { List list2 = list; ArrayList R = c.d.b.a.a.R(list2, "voiceUsers"); for (T t : list2) { if (!t.isMe()) { R.add(t); } } int size = R.size(); return (size >= 0 && 3 >= size) ? d0.o.to(R, 0) : d0.o.to(u.take(R, 3), Integer.valueOf(R.size() - 3)); } } /* compiled from: OverlayMenuBubbleDialog.kt */ public static final class d extends d0.z.d.o implements Function1, ? extends Integer>, Unit> { public final /* synthetic */ OverlayMenuBubbleDialog this$0; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public d(OverlayMenuBubbleDialog overlayMenuBubbleDialog) { super(1); this.this$0 = overlayMenuBubbleDialog; } /* 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] */ /* JADX DEBUG: TODO: convert one arg to string using `String.valueOf()`, args: [('+' char), (r4v4 int)] */ @Override // kotlin.jvm.functions.Function1 public Unit invoke(Pair, ? extends Integer> pair) { String str; Pair, ? extends Integer> pair2 = pair; int intValue = ((Number) pair2.component2()).intValue(); OverlayMenuBubbleDialog overlayMenuBubbleDialog = this.this$0; overlayMenuBubbleDialog.f2139z.setData((List) pair2.component1()); if (intValue == 0) { str = null; } else { StringBuilder sb = new StringBuilder(); sb.append('+'); sb.append(intValue); str = sb.toString(); } TextView textView = overlayMenuBubbleDialog.f2138y.d; m.checkNotNullExpressionValue(textView, "binding.overlayMembersOverflowTv"); ViewExtensions.setTextAndVisibilityBy(textView, str); return Unit.a; } } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public OverlayMenuBubbleDialog(Context context) { super(context); m.checkNotNullParameter(context, "context"); View inflate = LayoutInflater.from(getContext()).inflate(2131558617, (ViewGroup) this, false); addView(inflate); int i = 2131364237; LinearLayout linearLayout = (LinearLayout) inflate.findViewById(2131364237); if (linearLayout != null) { i = 2131364239; View findViewById = inflate.findViewById(2131364239); if (findViewById != null) { i = 2131364240; TextView textView = (TextView) inflate.findViewById(2131364240); if (textView != null) { i = 2131364241; RecyclerView recyclerView = (RecyclerView) inflate.findViewById(2131364241); if (recyclerView != null) { i = 2131364242; OverlayMenuView overlayMenuView = (OverlayMenuView) inflate.findViewById(2131364242); if (overlayMenuView != null) { p0 p0Var = new p0((LinearLayout) inflate, linearLayout, findViewById, textView, recyclerView, overlayMenuView); m.checkNotNullExpressionValue(p0Var, "OverlayBubbleMenuBinding…rom(context), this, true)"); this.f2138y = p0Var; this.f2139z = new SimpleRecyclerAdapter<>(null, c.a.y.m.i, 1, null); overlayMenuView.setOnDismissRequested$app_productionBetaRelease(new q(0, this)); setClipChildren(false); return; } } } } } throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i))); } @Override // c.a.y.k public Animator getClosingAnimator() { AnimatorSet animatorSet = new AnimatorSet(); animatorSet.setStartDelay((long) getResources().getInteger(17694720)); OverlayMenuView overlayMenuView = this.f2138y.f; m.checkNotNullExpressionValue(overlayMenuView, "binding.overlayMenu"); Animator loadAnimator = AnimatorInflater.loadAnimator(overlayMenuView.getContext(), 2130837533); loadAnimator.setTarget(this.f2138y.f); Animator loadAnimator2 = AnimatorInflater.loadAnimator(getContext(), 2130837535); loadAnimator2.setTarget(this.f2138y.b); animatorSet.playTogether(loadAnimator, loadAnimator2); return animatorSet; } public final View getLinkedAnchorView() { View view = this.f2138y.f139c; m.checkNotNullExpressionValue(view, "binding.overlayLinkedAnchorView"); return view; } @Override // android.view.View, android.view.ViewGroup public void onAttachedToWindow() { super.onAttachedToWindow(); OverlayMenuView overlayMenuView = this.f2138y.f; m.checkNotNullExpressionValue(overlayMenuView, "binding.overlayMenu"); overlayMenuView.setAlpha(0.0f); LinearLayout linearLayout = this.f2138y.b; m.checkNotNullExpressionValue(linearLayout, "binding.overlayHeader"); linearLayout.setAlpha(0.0f); AnimatorSet animatorSet = new AnimatorSet(); OverlayMenuView overlayMenuView2 = this.f2138y.f; m.checkNotNullExpressionValue(overlayMenuView2, "binding.overlayMenu"); Animator loadAnimator = AnimatorInflater.loadAnimator(overlayMenuView2.getContext(), 2130837534); loadAnimator.setTarget(this.f2138y.f); Animator loadAnimator2 = AnimatorInflater.loadAnimator(getContext(), 2130837532); loadAnimator2.setTarget(this.f2138y.b); animatorSet.playTogether(loadAnimator, loadAnimator2); animatorSet.setStartDelay((long) getResources().getInteger(17694720)); animatorSet.start(); RecyclerView recyclerView = this.f2138y.e; m.checkNotNullExpressionValue(recyclerView, "binding.overlayMembersRv"); recyclerView.setAdapter(this.f2139z); Observable F = StoreStream.Companion.getVoiceChannelSelected().observeSelectedVoiceChannelId().Y(b.i).F(c.i); m.checkNotNullExpressionValue(F, "StoreStream\n .get…- 3\n }\n }"); ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(F), this, null, 2, null), OverlayMenuBubbleDialog.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new d(this), 62, (Object) null); } @Override // com.discord.overlay.views.OverlayDialog, com.discord.overlay.views.OverlayBubbleWrap, android.view.View public void onConfigurationChanged(Configuration configuration) { super.onConfigurationChanged(configuration); getOnDialogClosed().invoke(this); } }