223 lines
11 KiB
Java
223 lines
11 KiB
Java
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.z.k;
|
|
import c.a.z.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 f2131y;
|
|
|
|
/* renamed from: z reason: collision with root package name */
|
|
public final SimpleRecyclerAdapter<StoreVoiceParticipants.VoiceUser, a> f2132z;
|
|
|
|
/* compiled from: OverlayMenuBubbleDialog.kt */
|
|
public static final class a extends SimpleRecyclerAdapter.ViewHolder<StoreVoiceParticipants.VoiceUser> {
|
|
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<T, R> implements j0.k.b<Long, Observable<? extends List<? extends StoreVoiceParticipants.VoiceUser>>> {
|
|
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<? extends List<? extends StoreVoiceParticipants.VoiceUser>> 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<T, R> implements j0.k.b<List<? extends StoreVoiceParticipants.VoiceUser>, Pair<? extends List<? extends StoreVoiceParticipants.VoiceUser>, ? 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 List<? extends StoreVoiceParticipants.VoiceUser>, ? extends Integer> call(List<? extends StoreVoiceParticipants.VoiceUser> list) {
|
|
List<? extends StoreVoiceParticipants.VoiceUser> list2 = list;
|
|
ArrayList S = c.d.b.a.a.S(list2, "voiceUsers");
|
|
for (T t : list2) {
|
|
if (!t.isMe()) {
|
|
S.add(t);
|
|
}
|
|
}
|
|
int size = S.size();
|
|
return (size >= 0 && 3 >= size) ? d0.o.to(S, 0) : d0.o.to(u.take(S, 3), Integer.valueOf(S.size() - 3));
|
|
}
|
|
}
|
|
|
|
/* compiled from: OverlayMenuBubbleDialog.kt */
|
|
public static final class d extends d0.z.d.o implements Function1<Pair<? extends List<? extends StoreVoiceParticipants.VoiceUser>, ? 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 List<? extends StoreVoiceParticipants.VoiceUser>, ? extends Integer> pair) {
|
|
String str;
|
|
Pair<? extends List<? extends StoreVoiceParticipants.VoiceUser>, ? extends Integer> pair2 = pair;
|
|
int intValue = ((Number) pair2.component2()).intValue();
|
|
OverlayMenuBubbleDialog overlayMenuBubbleDialog = this.this$0;
|
|
overlayMenuBubbleDialog.f2132z.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.f2131y.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(2131558613, (ViewGroup) this, false);
|
|
addView(inflate);
|
|
int i = 2131364205;
|
|
LinearLayout linearLayout = (LinearLayout) inflate.findViewById(2131364205);
|
|
if (linearLayout != null) {
|
|
i = 2131364207;
|
|
View findViewById = inflate.findViewById(2131364207);
|
|
if (findViewById != null) {
|
|
i = 2131364208;
|
|
TextView textView = (TextView) inflate.findViewById(2131364208);
|
|
if (textView != null) {
|
|
i = 2131364209;
|
|
RecyclerView recyclerView = (RecyclerView) inflate.findViewById(2131364209);
|
|
if (recyclerView != null) {
|
|
i = 2131364210;
|
|
OverlayMenuView overlayMenuView = (OverlayMenuView) inflate.findViewById(2131364210);
|
|
if (overlayMenuView != null) {
|
|
p0 p0Var = new p0((LinearLayout) inflate, linearLayout, findViewById, textView, recyclerView, overlayMenuView);
|
|
m.checkNotNullExpressionValue(p0Var, "OverlayBubbleMenuBinding…rom(context), this, true)");
|
|
this.f2131y = p0Var;
|
|
this.f2132z = new SimpleRecyclerAdapter<>(null, c.a.z.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.z.k
|
|
public Animator getClosingAnimator() {
|
|
AnimatorSet animatorSet = new AnimatorSet();
|
|
animatorSet.setStartDelay((long) getResources().getInteger(17694720));
|
|
OverlayMenuView overlayMenuView = this.f2131y.f;
|
|
m.checkNotNullExpressionValue(overlayMenuView, "binding.overlayMenu");
|
|
Animator loadAnimator = AnimatorInflater.loadAnimator(overlayMenuView.getContext(), 2130837533);
|
|
loadAnimator.setTarget(this.f2131y.f);
|
|
Animator loadAnimator2 = AnimatorInflater.loadAnimator(getContext(), 2130837535);
|
|
loadAnimator2.setTarget(this.f2131y.b);
|
|
animatorSet.playTogether(loadAnimator, loadAnimator2);
|
|
return animatorSet;
|
|
}
|
|
|
|
public final View getLinkedAnchorView() {
|
|
View view = this.f2131y.f140c;
|
|
m.checkNotNullExpressionValue(view, "binding.overlayLinkedAnchorView");
|
|
return view;
|
|
}
|
|
|
|
@Override // android.view.View, android.view.ViewGroup
|
|
public void onAttachedToWindow() {
|
|
super.onAttachedToWindow();
|
|
OverlayMenuView overlayMenuView = this.f2131y.f;
|
|
m.checkNotNullExpressionValue(overlayMenuView, "binding.overlayMenu");
|
|
overlayMenuView.setAlpha(0.0f);
|
|
LinearLayout linearLayout = this.f2131y.b;
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.overlayHeader");
|
|
linearLayout.setAlpha(0.0f);
|
|
AnimatorSet animatorSet = new AnimatorSet();
|
|
OverlayMenuView overlayMenuView2 = this.f2131y.f;
|
|
m.checkNotNullExpressionValue(overlayMenuView2, "binding.overlayMenu");
|
|
Animator loadAnimator = AnimatorInflater.loadAnimator(overlayMenuView2.getContext(), 2130837534);
|
|
loadAnimator.setTarget(this.f2131y.f);
|
|
Animator loadAnimator2 = AnimatorInflater.loadAnimator(getContext(), 2130837532);
|
|
loadAnimator2.setTarget(this.f2131y.b);
|
|
animatorSet.playTogether(loadAnimator, loadAnimator2);
|
|
animatorSet.setStartDelay((long) getResources().getInteger(17694720));
|
|
animatorSet.start();
|
|
RecyclerView recyclerView = this.f2131y.e;
|
|
m.checkNotNullExpressionValue(recyclerView, "binding.overlayMembersRv");
|
|
recyclerView.setAdapter(this.f2132z);
|
|
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);
|
|
}
|
|
}
|