discord-jadx/app/src/main/java/c/a/a/e/a/a.java

293 lines
14 KiB
Java

package c.a.a.e.a;
import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RadioGroup;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentViewModelLazyKt;
import c.a.a.e.a.f;
import c.a.d.h0;
import c.a.d.j0;
import com.discord.app.AppDialog;
import com.discord.app.AppViewModel;
import com.discord.rtcconnection.audio.DiscordAudioManager;
import com.discord.stores.StoreAudioDevices;
import com.discord.utilities.color.ColorCompat;
import com.discord.utilities.color.ColorCompatKt;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
import com.google.android.material.radiobutton.MaterialRadioButton;
import d0.z.d.a0;
import d0.z.d.k;
import d0.z.d.m;
import d0.z.d.o;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import kotlin.Lazy;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.reflect.KProperty;
import rx.Observable;
/* compiled from: AudioOutputSelectionDialog.kt */
public final class a extends AppDialog {
public static final /* synthetic */ KProperty[] i = {c.d.b.a.a.V(a.class, "binding", "getBinding()Lcom/discord/databinding/AudioOutputSelectionDialogBinding;", 0)};
public static final b j = new b(null);
public final FragmentViewBindingDelegate k = FragmentViewBindingDelegateKt.viewBinding$default(this, c.i, null, 2, null);
public final Lazy l;
/* compiled from: java-style lambda group */
/* renamed from: c.a.a.e.a.a$a reason: collision with other inner class name */
public static final class View$OnClickListenerC0015a implements View.OnClickListener {
public final /* synthetic */ int i;
public final /* synthetic */ Object j;
public View$OnClickListenerC0015a(int i, Object obj) {
this.i = i;
this.j = obj;
}
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
StoreAudioDevices.OutputDevice.BluetoothAudio bluetoothAudio;
int i = this.i;
f.c.a aVar = null;
if (i == 0) {
f h = a.h((a) this.j);
if (h.j.getEnabled()) {
f.c viewState = h.getViewState();
if (viewState instanceof f.c.a) {
aVar = viewState;
}
f.c.a aVar2 = aVar;
if (!(aVar2 == null || (bluetoothAudio = aVar2.f37c) == null)) {
h.j.selectAudioOutput(bluetoothAudio);
}
} else {
h.k.selectOutputDevice(DiscordAudioManager.DeviceTypes.BLUETOOTH_HEADSET);
}
a.g((a) this.j);
} else if (i == 1) {
f h2 = a.h((a) this.j);
if (h2.j.getEnabled()) {
h2.j.selectAudioOutput(StoreAudioDevices.OutputDevice.Speaker.INSTANCE);
} else {
h2.k.selectOutputDevice(DiscordAudioManager.DeviceTypes.SPEAKERPHONE);
}
a.g((a) this.j);
} else if (i == 2) {
f h3 = a.h((a) this.j);
if (h3.j.getEnabled()) {
h3.j.selectAudioOutput(StoreAudioDevices.OutputDevice.WiredAudio.INSTANCE);
} else {
h3.k.selectOutputDevice(DiscordAudioManager.DeviceTypes.WIRED_HEADSET);
}
a.g((a) this.j);
} else if (i == 3) {
f h4 = a.h((a) this.j);
if (h4.j.getEnabled()) {
h4.j.selectAudioOutput(StoreAudioDevices.OutputDevice.Earpiece.INSTANCE);
} else {
h4.k.selectOutputDevice(DiscordAudioManager.DeviceTypes.EARPIECE);
}
a.g((a) this.j);
} else {
throw null;
}
}
}
/* compiled from: AudioOutputSelectionDialog.kt */
public static final class b {
public b(DefaultConstructorMarker defaultConstructorMarker) {
}
}
/* compiled from: AudioOutputSelectionDialog.kt */
public static final /* synthetic */ class c extends k implements Function1<View, c.a.i.b> {
public static final c i = new c();
public c() {
super(1, c.a.i.b.class, "bind", "bind(Landroid/view/View;)Lcom/discord/databinding/AudioOutputSelectionDialogBinding;", 0);
}
/* 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 c.a.i.b invoke(View view) {
View view2 = view;
m.checkNotNullParameter(view2, "p1");
int i2 = 2131361995;
MaterialRadioButton materialRadioButton = (MaterialRadioButton) view2.findViewById(2131361995);
if (materialRadioButton != null) {
i2 = 2131361996;
TextView textView = (TextView) view2.findViewById(2131361996);
if (textView != null) {
i2 = 2131361997;
RadioGroup radioGroup = (RadioGroup) view2.findViewById(2131361997);
if (radioGroup != null) {
i2 = 2131361998;
MaterialRadioButton materialRadioButton2 = (MaterialRadioButton) view2.findViewById(2131361998);
if (materialRadioButton2 != null) {
i2 = 2131361999;
MaterialRadioButton materialRadioButton3 = (MaterialRadioButton) view2.findViewById(2131361999);
if (materialRadioButton3 != null) {
i2 = 2131362000;
MaterialRadioButton materialRadioButton4 = (MaterialRadioButton) view2.findViewById(2131362000);
if (materialRadioButton4 != null) {
return new c.a.i.b((LinearLayout) view2, materialRadioButton, textView, radioGroup, materialRadioButton2, materialRadioButton3, materialRadioButton4);
}
}
}
}
}
}
throw new NullPointerException("Missing required view with ID: ".concat(view2.getResources().getResourceName(i2)));
}
}
/* compiled from: AudioOutputSelectionDialog.kt */
public static final class d extends o implements Function1<f.c, Unit> {
public final /* synthetic */ a this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public d(a aVar) {
super(1);
this.this$0 = aVar;
}
/* 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(f.c cVar) {
int i;
String str;
f.c cVar2 = cVar;
m.checkNotNullParameter(cVar2, "viewState");
a aVar = this.this$0;
Objects.requireNonNull(aVar);
m.checkNotNullParameter(cVar2, "viewState");
if (!(cVar2 instanceof f.c.b) && (cVar2 instanceof f.c.a)) {
f.c.a aVar2 = (f.c.a) cVar2;
StoreAudioDevices.OutputDevice outputDevice = aVar2.a;
if (outputDevice instanceof StoreAudioDevices.OutputDevice.BluetoothAudio) {
MaterialRadioButton materialRadioButton = aVar.i().b;
m.checkNotNullExpressionValue(materialRadioButton, "binding.audioOutputSelectionBluetoothRadio");
i = materialRadioButton.getId();
} else if (outputDevice instanceof StoreAudioDevices.OutputDevice.Speaker) {
MaterialRadioButton materialRadioButton2 = aVar.i().e;
m.checkNotNullExpressionValue(materialRadioButton2, "binding.audioOutputSelectionSpeakerRadio");
i = materialRadioButton2.getId();
} else if (outputDevice instanceof StoreAudioDevices.OutputDevice.WiredAudio) {
MaterialRadioButton materialRadioButton3 = aVar.i().f;
m.checkNotNullExpressionValue(materialRadioButton3, "binding.audioOutputSelectionWiredRadio");
i = materialRadioButton3.getId();
} else if (outputDevice instanceof StoreAudioDevices.OutputDevice.Earpiece) {
MaterialRadioButton materialRadioButton4 = aVar.i().d;
m.checkNotNullExpressionValue(materialRadioButton4, "binding.audioOutputSelectionEarpieceRadio");
i = materialRadioButton4.getId();
} else {
throw new NoWhenBranchMatchedException();
}
aVar.i().f65c.check(i);
MaterialRadioButton materialRadioButton5 = aVar.i().b;
m.checkNotNullExpressionValue(materialRadioButton5, "binding.audioOutputSelectionBluetoothRadio");
int i2 = 0;
materialRadioButton5.setVisibility(aVar2.b ? 0 : 8);
MaterialRadioButton materialRadioButton6 = aVar.i().b;
m.checkNotNullExpressionValue(materialRadioButton6, "binding.audioOutputSelectionBluetoothRadio");
StoreAudioDevices.OutputDevice.BluetoothAudio bluetoothAudio = aVar2.f37c;
if (bluetoothAudio == null || (str = bluetoothAudio.getName()) == null) {
str = aVar.getString(2131886745);
}
materialRadioButton6.setText(str);
MaterialRadioButton materialRadioButton7 = aVar.i().e;
m.checkNotNullExpressionValue(materialRadioButton7, "binding.audioOutputSelectionSpeakerRadio");
materialRadioButton7.setVisibility(aVar2.d ? 0 : 8);
MaterialRadioButton materialRadioButton8 = aVar.i().f;
m.checkNotNullExpressionValue(materialRadioButton8, "binding.audioOutputSelectionWiredRadio");
materialRadioButton8.setVisibility(aVar2.e ? 0 : 8);
MaterialRadioButton materialRadioButton9 = aVar.i().d;
m.checkNotNullExpressionValue(materialRadioButton9, "binding.audioOutputSelectionEarpieceRadio");
if (!aVar2.f) {
i2 = 8;
}
materialRadioButton9.setVisibility(i2);
}
return Unit.a;
}
}
/* compiled from: AudioOutputSelectionDialog.kt */
public static final class e extends o implements Function0<AppViewModel<f.c>> {
public static final e i = new e();
public e() {
super(0);
}
/* Return type fixed from 'java.lang.Object' to match base method */
@Override // kotlin.jvm.functions.Function0
/* renamed from: invoke */
public AppViewModel<f.c> mo1invoke() {
return new f(null, null, null, 7);
}
}
public a() {
super(2131558433);
e eVar = e.i;
h0 h0Var = new h0(this);
this.l = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(f.class), new m(5, h0Var), new j0(eVar));
}
public static final void g(a aVar) {
Objects.requireNonNull(aVar);
Observable<Long> d02 = Observable.d0(300, TimeUnit.MILLISECONDS);
m.checkNotNullExpressionValue(d02, "Observable\n .time…S, TimeUnit.MILLISECONDS)");
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(d02, aVar, null, 2, null), a.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new b(aVar), 62, (Object) null);
}
public static final f h(a aVar) {
return (f) aVar.l.getValue();
}
public final c.a.i.b i() {
return (c.a.i.b) this.k.getValue((Fragment) this, i[0]);
}
@Override // com.discord.app.AppDialog
public void onViewBound(View view) {
m.checkNotNullParameter(view, "view");
super.onViewBound(view);
int themedColor = ColorCompat.getThemedColor(view, 2130968949);
MaterialRadioButton materialRadioButton = i().b;
m.checkNotNullExpressionValue(materialRadioButton, "binding.audioOutputSelectionBluetoothRadio");
ColorCompatKt.setDrawableColor(materialRadioButton, themedColor);
MaterialRadioButton materialRadioButton2 = i().e;
m.checkNotNullExpressionValue(materialRadioButton2, "binding.audioOutputSelectionSpeakerRadio");
ColorCompatKt.setDrawableColor(materialRadioButton2, themedColor);
MaterialRadioButton materialRadioButton3 = i().f;
m.checkNotNullExpressionValue(materialRadioButton3, "binding.audioOutputSelectionWiredRadio");
ColorCompatKt.setDrawableColor(materialRadioButton3, themedColor);
MaterialRadioButton materialRadioButton4 = i().d;
m.checkNotNullExpressionValue(materialRadioButton4, "binding.audioOutputSelectionEarpieceRadio");
ColorCompatKt.setDrawableColor(materialRadioButton4, themedColor);
i().b.setOnClickListener(new View$OnClickListenerC0015a(0, this));
i().e.setOnClickListener(new View$OnClickListenerC0015a(1, this));
i().f.setOnClickListener(new View$OnClickListenerC0015a(2, this));
i().d.setOnClickListener(new View$OnClickListenerC0015a(3, this));
}
@Override // com.discord.app.AppDialog
public void onViewBoundOrOnResume() {
super.onViewBoundOrOnResume();
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle(((f) this.l.getValue()).observeViewState(), this), a.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new d(this), 62, (Object) null);
}
}