203 lines
10 KiB
Java
203 lines
10 KiB
Java
package com.discord.views;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.ColorStateList;
|
|
import android.util.AttributeSet;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.widget.ImageView;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.TextView;
|
|
import androidx.cardview.widget.CardView;
|
|
import c.a.i.h2;
|
|
import c.a.i.i2;
|
|
import c.a.y.q;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import com.discord.app.AppComponent;
|
|
import com.discord.models.guild.Guild;
|
|
import com.discord.rtcconnection.RtcConnection;
|
|
import com.discord.stores.StoreAudioDevices;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.utilities.color.ColorCompat;
|
|
import com.discord.utilities.permissions.PermissionUtils;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.voice.VoiceViewUtils;
|
|
import com.discord.widgets.voice.model.CallModel;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import java.util.Objects;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import rx.Observable;
|
|
import rx.subjects.PublishSubject;
|
|
import rx.subjects.Subject;
|
|
/* compiled from: OverlayMenuView.kt */
|
|
public final class OverlayMenuView extends LinearLayout implements AppComponent {
|
|
public static final /* synthetic */ int i = 0;
|
|
public final h2 j;
|
|
public final Subject<Void, Void> k;
|
|
public Function0<Unit> l;
|
|
|
|
/* compiled from: OverlayMenuView.kt */
|
|
public static final class a {
|
|
public final Long a;
|
|
public final Guild b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public final CallModel f2135c;
|
|
public final RtcConnection.Quality d;
|
|
|
|
public a(Long l, Guild guild, CallModel callModel, RtcConnection.Quality quality) {
|
|
m.checkNotNullParameter(quality, "rtcQuality");
|
|
this.a = l;
|
|
this.b = guild;
|
|
this.f2135c = callModel;
|
|
this.d = quality;
|
|
}
|
|
}
|
|
|
|
/* compiled from: OverlayMenuView.kt */
|
|
public static final class b extends o implements Function1<a, Unit> {
|
|
public final /* synthetic */ OverlayMenuView this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public b(OverlayMenuView overlayMenuView) {
|
|
super(1);
|
|
this.this$0 = overlayMenuView;
|
|
}
|
|
|
|
/* 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(a aVar) {
|
|
a aVar2 = aVar;
|
|
if (aVar2 != null) {
|
|
OverlayMenuView overlayMenuView = this.this$0;
|
|
int i = OverlayMenuView.i;
|
|
Objects.requireNonNull(overlayMenuView);
|
|
if (aVar2.f2135c != null) {
|
|
overlayMenuView.j.b.d.setOnClickListener(new e(0, overlayMenuView, aVar2));
|
|
TextView textView = overlayMenuView.j.b.d;
|
|
m.checkNotNullExpressionValue(textView, "binding.content.overlayInviteLink");
|
|
textView.setVisibility(PermissionUtils.can(1, aVar2.a) ? 0 : 8);
|
|
overlayMenuView.j.b.g.setOnClickListener(new h(0, overlayMenuView));
|
|
overlayMenuView.j.b.f.setOnClickListener(new e(1, overlayMenuView, aVar2));
|
|
ImageView imageView = overlayMenuView.j.e;
|
|
m.checkNotNullExpressionValue(imageView, "binding.srcToggle");
|
|
ColorStateList valueOf = aVar2.f2135c.getAudioDevicesState().getSelectedOutputDevice() == StoreAudioDevices.OutputDevice.Speaker.INSTANCE ? ColorStateList.valueOf(-1) : ColorStateList.valueOf(ColorCompat.getColor(overlayMenuView.getContext(), 2131100162));
|
|
m.checkNotNullExpressionValue(valueOf, "if (selectedOutputDevice…rimary_dark_400))\n }");
|
|
imageView.setImageTintList(valueOf);
|
|
overlayMenuView.j.e.setOnClickListener(new h(1, aVar2));
|
|
ImageView imageView2 = overlayMenuView.j.d;
|
|
m.checkNotNullExpressionValue(imageView2, "binding.muteToggle");
|
|
imageView2.setActivated(aVar2.f2135c.isMeMutedByAnySource());
|
|
overlayMenuView.j.d.setOnClickListener(new h(2, aVar2));
|
|
overlayMenuView.j.f98c.setOnClickListener(new h(3, overlayMenuView));
|
|
overlayMenuView.j.b.e.setImageResource(VoiceViewUtils.INSTANCE.getQualityIndicator(aVar2.d));
|
|
TextView textView2 = overlayMenuView.j.b.f104c;
|
|
m.checkNotNullExpressionValue(textView2, "binding.content.overlayGuildName");
|
|
Guild guild = aVar2.b;
|
|
String name = guild != null ? guild.getName() : null;
|
|
if (name == null) {
|
|
name = "";
|
|
}
|
|
textView2.setText(name);
|
|
TextView textView3 = overlayMenuView.j.b.b;
|
|
m.checkNotNullExpressionValue(textView3, "binding.content.overlayChannelName");
|
|
textView3.setText(AnimatableValueParser.y0(aVar2.f2135c.getChannel()));
|
|
}
|
|
}
|
|
return Unit.a;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public OverlayMenuView(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
m.checkNotNullParameter(context, "context");
|
|
LayoutInflater.from(getContext()).inflate(2131558779, this);
|
|
int i2 = 2131362781;
|
|
View findViewById = findViewById(2131362781);
|
|
if (findViewById != null) {
|
|
int i3 = 2131364212;
|
|
TextView textView = (TextView) findViewById.findViewById(2131364212);
|
|
if (textView != null) {
|
|
i3 = 2131364214;
|
|
TextView textView2 = (TextView) findViewById.findViewById(2131364214);
|
|
if (textView2 != null) {
|
|
i3 = 2131364216;
|
|
TextView textView3 = (TextView) findViewById.findViewById(2131364216);
|
|
if (textView3 != null) {
|
|
i3 = 2131364221;
|
|
ImageView imageView = (ImageView) findViewById.findViewById(2131364221);
|
|
if (imageView != null) {
|
|
i3 = 2131364222;
|
|
TextView textView4 = (TextView) findViewById.findViewById(2131364222);
|
|
if (textView4 != null) {
|
|
i3 = 2131364223;
|
|
TextView textView5 = (TextView) findViewById.findViewById(2131364223);
|
|
if (textView5 != null) {
|
|
i2 i2Var = new i2((CardView) findViewById, textView, textView2, textView3, imageView, textView4, textView5);
|
|
i2 = 2131362945;
|
|
ImageView imageView2 = (ImageView) findViewById(2131362945);
|
|
if (imageView2 != null) {
|
|
i2 = 2131364083;
|
|
ImageView imageView3 = (ImageView) findViewById(2131364083);
|
|
if (imageView3 != null) {
|
|
i2 = 2131365080;
|
|
ImageView imageView4 = (ImageView) findViewById(2131365080);
|
|
if (imageView4 != null) {
|
|
h2 h2Var = new h2(this, i2Var, imageView2, imageView3, imageView4);
|
|
m.checkNotNullExpressionValue(h2Var, "ViewOverlayMenuBinding.i…ater.from(context), this)");
|
|
this.j = h2Var;
|
|
PublishSubject k0 = PublishSubject.k0();
|
|
m.checkNotNullExpressionValue(k0, "PublishSubject.create()");
|
|
this.k = k0;
|
|
this.l = r.i;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(findViewById.getResources().getResourceName(i3)));
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(getResources().getResourceName(i2)));
|
|
}
|
|
|
|
public final Function0<Unit> getOnDismissRequested$app_productionBetaRelease() {
|
|
return this.l;
|
|
}
|
|
|
|
@Override // com.discord.app.AppComponent
|
|
public Subject<Void, Void> getUnsubscribeSignal() {
|
|
return this.k;
|
|
}
|
|
|
|
@Override // android.view.View, android.view.ViewGroup
|
|
public void onAttachedToWindow() {
|
|
super.onAttachedToWindow();
|
|
Observable<R> Y = StoreStream.Companion.getVoiceChannelSelected().observeSelectedChannel().Y(q.i);
|
|
m.checkNotNullExpressionValue(Y, "StoreStream\n … }\n }");
|
|
Observable r = ObservableExtensionsKt.computationLatest(Y).r();
|
|
m.checkNotNullExpressionValue(r, "StoreStream\n … .distinctUntilChanged()");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(r, this, null, 2, null), OverlayMenuView.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new b(this), 62, (Object) null);
|
|
}
|
|
|
|
@Override // android.view.View, android.view.ViewGroup
|
|
public void onDetachedFromWindow() {
|
|
getUnsubscribeSignal().onNext(null);
|
|
super.onDetachedFromWindow();
|
|
}
|
|
|
|
public final void setOnDismissRequested$app_productionBetaRelease(Function0<Unit> function0) {
|
|
m.checkNotNullParameter(function0, "<set-?>");
|
|
this.l = function0;
|
|
}
|
|
}
|