discord-jadx/app/src/main/java/com/discord/widgets/settings/WidgetSettingsVoice.java

519 lines
29 KiB
Java

package com.discord.widgets.settings;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.widget.Checkable;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import androidx.annotation.IdRes;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import c.a.d.f;
import c.a.d.j;
import c.a.k.b;
import c.d.b.a.a;
import com.discord.R;
import com.discord.app.AppBottomSheet;
import com.discord.app.AppFragment;
import com.discord.databinding.WidgetSettingsVoiceBinding;
import com.discord.databinding.WidgetSettingsVoiceInputModeBinding;
import com.discord.rtcconnection.RtcConnection;
import com.discord.rtcconnection.mediaengine.MediaEngine;
import com.discord.rtcconnection.mediaengine.MediaEngineConnection;
import com.discord.stores.StoreAnalytics;
import com.discord.stores.StoreMediaSettings;
import com.discord.stores.StoreStream;
import com.discord.utilities.accessibility.AccessibilityUtils;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.utilities.rx.ObservableExtensionsKt$filterNull$1;
import com.discord.utilities.rx.ObservableExtensionsKt$filterNull$2;
import com.discord.utilities.view.text.LinkifiedTextView;
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
import com.discord.utilities.views.ViewCoroutineScopeKt;
import com.discord.utilities.voice.DiscordOverlayService;
import com.discord.utilities.voice.PerceptualVolumeUtils;
import com.discord.views.CheckedSetting;
import com.discord.views.RadioManager;
import com.google.android.material.button.MaterialButton;
import d0.t.n;
import d0.z.d.m;
import java.util.List;
import kotlin.NoWhenBranchMatchedException;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.reflect.KProperty;
import kotlinx.coroutines.CoroutineScope;
import rx.Observable;
import rx.functions.Func3;
import rx.subjects.BehaviorSubject;
/* compiled from: WidgetSettingsVoice.kt */
public final class WidgetSettingsVoice extends AppFragment {
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.a0(WidgetSettingsVoice.class, "binding", "getBinding()Lcom/discord/databinding/WidgetSettingsVoiceBinding;", 0)};
private static final String ARG_TARGET_AUTO_TOGGLE = "ARG_TARGET_AUTO_TOGGLE";
private static final String ARG_TARGET_RES_ID = "ARG_TARGET_RES_ID";
public static final Companion Companion = new Companion(null);
private static final MediaEngine.LocalVoiceStatus LOCAL_VOICE_STATUS_ENGINE_UNINITIALIZED = new MediaEngine.LocalVoiceStatus(-1.0f, false);
private static final int OVERLAY_PERMISSION_REQUEST_CODE = 2552;
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetSettingsVoice$binding$2.INSTANCE, null, 2, null);
private List<CheckedSetting> openSLESConfigRadioButtons;
private RadioManager openSLESConfigRadioManager;
private final BehaviorSubject<Boolean> requestListenForSensitivitySubject = BehaviorSubject.k0(Boolean.FALSE);
/* compiled from: WidgetSettingsVoice.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public static final /* synthetic */ boolean access$hasOverlayPermission(Companion companion, Context context) {
return companion.hasOverlayPermission(context);
}
private final boolean hasOverlayPermission(Context context) {
return Build.VERSION.SDK_INT <= 22 || Settings.canDrawOverlays(context);
}
public static /* synthetic */ void launch$default(Companion companion, Context context, Integer num, boolean z2, int i, Object obj) {
if ((i & 2) != 0) {
num = null;
}
if ((i & 4) != 0) {
z2 = false;
}
companion.launch(context, num, z2);
}
public final void launch(Context context, @IdRes Integer num, boolean z2) {
m.checkNotNullParameter(context, "context");
Intent intent = new Intent();
if (num != null) {
intent.putExtra(WidgetSettingsVoice.ARG_TARGET_RES_ID, num.intValue());
}
if (z2) {
intent.putExtra(WidgetSettingsVoice.ARG_TARGET_AUTO_TOGGLE, z2);
}
j.d(context, WidgetSettingsVoice.class, intent);
StoreAnalytics.onUserSettingsPaneViewed$default(StoreStream.Companion.getAnalytics(), "Voice & Video", null, 2, null);
}
}
/* compiled from: WidgetSettingsVoice.kt */
public static final class InputModeSelector extends AppBottomSheet {
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.a0(InputModeSelector.class, "binding", "getBinding()Lcom/discord/databinding/WidgetSettingsVoiceInputModeBinding;", 0)};
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetSettingsVoice$InputModeSelector$binding$2.INSTANCE, null, 2, null);
public InputModeSelector() {
super(false, 1, null);
}
private final WidgetSettingsVoiceInputModeBinding getBinding() {
return (WidgetSettingsVoiceInputModeBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
}
@Override // com.discord.app.AppBottomSheet
public int getContentViewResId() {
return R.layout.widget_settings_voice_input_mode;
}
@Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment
public void onViewCreated(View view, Bundle bundle) {
m.checkNotNullParameter(view, "view");
super.onViewCreated(view, bundle);
setBottomSheetCollapsedStateDisabled();
getBinding().b.setOnClickListener(new WidgetSettingsVoice$InputModeSelector$onViewCreated$1(this));
getBinding().f2031c.setOnClickListener(new WidgetSettingsVoice$InputModeSelector$onViewCreated$2(this));
}
}
/* compiled from: WidgetSettingsVoice.kt */
public static final class Model {
public static final Companion Companion = new Companion(null);
private final MediaEngine.LocalVoiceStatus localVoiceStatus;
private final boolean modePTT;
private final boolean modeVAD;
private final MediaEngine.OpenSLESConfig openSLESConfig;
private final StoreMediaSettings.VoiceConfiguration voiceConfig;
/* compiled from: WidgetSettingsVoice.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARNING: Unknown variable types count: 1 */
public final Observable<Model> get(Observable<Boolean> observable) {
m.checkNotNullParameter(observable, "requestListenForSensitivity");
StoreStream.Companion companion = StoreStream.Companion;
Observable j = Observable.j(observable, companion.getMediaEngine().getIsNativeEngineInitialized(), WidgetSettingsVoice$Model$Companion$get$shouldListenForSensitivity$1.INSTANCE);
Observable<StoreMediaSettings.VoiceConfiguration> voiceConfig = companion.getMediaSettings().getVoiceConfig();
Observable<MediaEngine.OpenSLESConfig> openSLESConfig = companion.getMediaEngine().getOpenSLESConfig();
Observable X = j.X(WidgetSettingsVoice$Model$Companion$get$1.INSTANCE);
WidgetSettingsVoice$Model$Companion$get$2 widgetSettingsVoice$Model$Companion$get$2 = WidgetSettingsVoice$Model$Companion$get$2.INSTANCE;
if (widgetSettingsVoice$Model$Companion$get$2 != null) {
widgetSettingsVoice$Model$Companion$get$2 = new WidgetSettingsVoice$sam$rx_functions_Func3$0(widgetSettingsVoice$Model$Companion$get$2);
}
Observable i = Observable.i(voiceConfig, openSLESConfig, X, (Func3) widgetSettingsVoice$Model$Companion$get$2);
m.checkNotNullExpressionValue(i, "Observable\n .… ::Model\n )");
Observable<Model> r = ObservableExtensionsKt.computationLatest(i).r();
m.checkNotNullExpressionValue(r, "Observable\n .… .distinctUntilChanged()");
return r;
}
}
private Model(StoreMediaSettings.VoiceConfiguration voiceConfiguration, MediaEngine.OpenSLESConfig openSLESConfig, MediaEngine.LocalVoiceStatus localVoiceStatus) {
this.voiceConfig = voiceConfiguration;
this.openSLESConfig = openSLESConfig;
this.localVoiceStatus = localVoiceStatus;
boolean z2 = true;
this.modePTT = voiceConfiguration.getInputMode() == MediaEngineConnection.InputMode.PUSH_TO_TALK;
this.modeVAD = voiceConfiguration.getInputMode() != MediaEngineConnection.InputMode.VOICE_ACTIVITY ? false : z2;
}
public /* synthetic */ Model(StoreMediaSettings.VoiceConfiguration voiceConfiguration, MediaEngine.OpenSLESConfig openSLESConfig, MediaEngine.LocalVoiceStatus localVoiceStatus, DefaultConstructorMarker defaultConstructorMarker) {
this(voiceConfiguration, openSLESConfig, localVoiceStatus);
}
public final MediaEngine.LocalVoiceStatus getLocalVoiceStatus() {
return this.localVoiceStatus;
}
public final boolean getModePTT() {
return this.modePTT;
}
public final boolean getModeVAD() {
return this.modeVAD;
}
public final MediaEngine.OpenSLESConfig getOpenSLESConfig() {
return this.openSLESConfig;
}
public final StoreMediaSettings.VoiceConfiguration getVoiceConfig() {
return this.voiceConfig;
}
}
public final /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
MediaEngine.OpenSLESConfig.values();
int[] iArr = new int[3];
$EnumSwitchMapping$0 = iArr;
iArr[MediaEngine.OpenSLESConfig.DEFAULT.ordinal()] = 1;
iArr[MediaEngine.OpenSLESConfig.FORCE_ENABLED.ordinal()] = 2;
iArr[MediaEngine.OpenSLESConfig.FORCE_DISABLED.ordinal()] = 3;
}
}
public WidgetSettingsVoice() {
super(R.layout.widget_settings_voice);
}
public static final /* synthetic */ void access$configureUI(WidgetSettingsVoice widgetSettingsVoice, Model model) {
widgetSettingsVoice.configureUI(model);
}
public static final /* synthetic */ WidgetSettingsVoiceBinding access$getBinding$p(WidgetSettingsVoice widgetSettingsVoice) {
return widgetSettingsVoice.getBinding();
}
public static final /* synthetic */ MediaEngine.LocalVoiceStatus access$getLOCAL_VOICE_STATUS_ENGINE_UNINITIALIZED$cp() {
return LOCAL_VOICE_STATUS_ENGINE_UNINITIALIZED;
}
public static final /* synthetic */ RadioManager access$getOpenSLESConfigRadioManager$p(WidgetSettingsVoice widgetSettingsVoice) {
RadioManager radioManager = widgetSettingsVoice.openSLESConfigRadioManager;
if (radioManager == null) {
m.throwUninitializedPropertyAccessException("openSLESConfigRadioManager");
}
return radioManager;
}
public static final /* synthetic */ BehaviorSubject access$getRequestListenForSensitivitySubject$p(WidgetSettingsVoice widgetSettingsVoice) {
return widgetSettingsVoice.requestListenForSensitivitySubject;
}
public static final /* synthetic */ void access$onOpenSLESConfigChanged(WidgetSettingsVoice widgetSettingsVoice) {
widgetSettingsVoice.onOpenSLESConfigChanged();
}
public static final /* synthetic */ void access$onOverlayToggled(WidgetSettingsVoice widgetSettingsVoice, Context context) {
widgetSettingsVoice.onOverlayToggled(context);
}
public static final /* synthetic */ void access$setOpenSLESConfigRadioManager$p(WidgetSettingsVoice widgetSettingsVoice, RadioManager radioManager) {
widgetSettingsVoice.openSLESConfigRadioManager = radioManager;
}
private final void configureUI(Model model) {
CheckedSetting checkedSetting;
SeekBar seekBar = getBinding().f2027s;
m.checkNotNullExpressionValue(seekBar, "binding.settingsVoiceOutputVolume");
seekBar.setProgress(d0.a0.a.roundToInt(PerceptualVolumeUtils.amplitudeToPerceptual$default(PerceptualVolumeUtils.INSTANCE, model.getVoiceConfig().getOutputVolume(), 0.0f, 2, null)));
getBinding().i.setOnClickListener(new WidgetSettingsVoice$configureUI$1(this));
int i = 0;
getBinding().j.setText(model.getModePTT() ? R.string.input_mode_ptt : model.getModeVAD() ? R.string.input_mode_vad : 0);
String H = a.H(new StringBuilder(), f.a.a(360045138471L, null), "?utm_source=discord&utm_medium=blog&utm_campaign=2020-06_help-voice-video&utm_content=--t%3Apm");
LinkifiedTextView linkifiedTextView = getBinding().D;
m.checkNotNullExpressionValue(linkifiedTextView, "binding.settingsVoiceVideoTroubleshootingGuide");
boolean z2 = true;
b.n(linkifiedTextView, R.string.form_help_voice_video_troubleshooting_guide, new Object[]{H}, null, 4);
RadioManager radioManager = this.openSLESConfigRadioManager;
if (radioManager == null) {
m.throwUninitializedPropertyAccessException("openSLESConfigRadioManager");
}
int ordinal = model.getOpenSLESConfig().ordinal();
if (ordinal == 0) {
checkedSetting = getBinding().n;
} else if (ordinal == 1) {
checkedSetting = getBinding().p;
} else if (ordinal == 2) {
checkedSetting = getBinding().o;
} else {
throw new NoWhenBranchMatchedException();
}
m.checkNotNullExpressionValue(checkedSetting, "when (model.openSLESConf…esForceDisabled\n }");
radioManager.a(checkedSetting);
List<CheckedSetting> list = this.openSLESConfigRadioButtons;
if (list == null) {
m.throwUninitializedPropertyAccessException("openSLESConfigRadioButtons");
}
for (CheckedSetting checkedSetting2 : list) {
checkedSetting2.setOnCheckedListener(new WidgetSettingsVoice$configureUI$$inlined$forEach$lambda$1(checkedSetting2, this));
}
CheckedSetting checkedSetting3 = getBinding().e;
m.checkNotNullExpressionValue(checkedSetting3, "binding.settingsVoiceGainControlToggle");
checkedSetting3.setChecked(model.getVoiceConfig().getAutomaticGainControl());
getBinding().e.setOnCheckedListener(WidgetSettingsVoice$configureUI$3.INSTANCE);
CheckedSetting checkedSetting4 = getBinding().k;
m.checkNotNullExpressionValue(checkedSetting4, "binding.settingsVoiceNoiseCancellationToggle");
StoreMediaSettings.NoiseProcessing noiseProcessing = model.getVoiceConfig().getNoiseProcessing();
StoreMediaSettings.NoiseProcessing noiseProcessing2 = StoreMediaSettings.NoiseProcessing.Cancellation;
checkedSetting4.setChecked(noiseProcessing == noiseProcessing2);
getBinding().k.setOnCheckedListener(WidgetSettingsVoice$configureUI$4.INSTANCE);
TextView textView = getBinding().g;
m.checkNotNullExpressionValue(textView, "binding.settingsVoiceKrispInfo");
b.n(textView, R.string.learn_more_link, new Object[]{f.a.a(360040843952L, null)}, null, 4);
TextView textView2 = getBinding().g;
m.checkNotNullExpressionValue(textView2, "binding.settingsVoiceKrispInfo");
textView2.setMovementMethod(LinkMovementMethod.getInstance());
CheckedSetting checkedSetting5 = getBinding().l;
m.checkNotNullExpressionValue(checkedSetting5, "binding.settingsVoiceNoiseSuppressionToggle");
checkedSetting5.setChecked(model.getVoiceConfig().getNoiseProcessing() == StoreMediaSettings.NoiseProcessing.Suppression);
if (model.getVoiceConfig().getNoiseProcessing() == noiseProcessing2) {
getBinding().l.b(R.string.user_settings_disable_noise_suppression);
CheckedSetting.i(getBinding().l, b.k(this, R.string.user_settings_disable_noise_suppression, new Object[0], null, 4), false, 2);
} else {
getBinding().l.e(WidgetSettingsVoice$configureUI$5.INSTANCE);
CheckedSetting.i(getBinding().l, null, false, 2);
}
CheckedSetting checkedSetting6 = getBinding().h;
m.checkNotNullExpressionValue(checkedSetting6, "binding.settingsVoiceKrispVadToggle");
if (model.getVoiceConfig().getVadUseKrisp() != StoreMediaSettings.VadUseKrisp.Enabled) {
z2 = false;
}
checkedSetting6.setChecked(z2);
getBinding().h.setOnCheckedListener(WidgetSettingsVoice$configureUI$6.INSTANCE);
CheckedSetting checkedSetting7 = getBinding().f2026c;
m.checkNotNullExpressionValue(checkedSetting7, "binding.settingsVoiceEchoCancellationToggle");
checkedSetting7.setChecked(model.getVoiceConfig().getEchoCancellation());
getBinding().f2026c.setOnCheckedListener(WidgetSettingsVoice$configureUI$7.INSTANCE);
CheckedSetting checkedSetting8 = getBinding().b;
m.checkNotNullExpressionValue(checkedSetting8, "binding.settingsVoiceAutoVadToggle");
checkedSetting8.setChecked(model.getVoiceConfig().getAutomaticVad());
CheckedSetting checkedSetting9 = getBinding().b;
m.checkNotNullExpressionValue(checkedSetting9, "binding.settingsVoiceAutoVadToggle");
if (!model.getModeVAD()) {
i = 8;
}
checkedSetting9.setVisibility(i);
getBinding().b.setOnCheckedListener(WidgetSettingsVoice$configureUI$8.INSTANCE);
CheckedSetting checkedSetting10 = getBinding().d;
m.checkNotNullExpressionValue(checkedSetting10, "binding.settingsVoiceEnableHardwareScalingToggle");
checkedSetting10.setChecked(model.getVoiceConfig().getEnableVideoHardwareScaling());
getBinding().d.setOnCheckedListener(WidgetSettingsVoice$configureUI$9.INSTANCE);
configureVoiceSensitivity(model);
}
private final void configureVoiceSensitivity(Model model) {
RelativeLayout relativeLayout = getBinding().B;
m.checkNotNullExpressionValue(relativeLayout, "binding.settingsVoiceSensitivityWrap");
int i = 8;
relativeLayout.setVisibility(model.getModeVAD() ? 0 : 8);
TextView textView = getBinding().f2028x;
m.checkNotNullExpressionValue(textView, "binding.settingsVoiceSensitivityLabel");
textView.setVisibility(model.getVoiceConfig().getAutomaticVad() ? 0 : 8);
boolean z2 = !m.areEqual(model.getLocalVoiceStatus(), LOCAL_VOICE_STATUS_ENGINE_UNINITIALIZED);
LinearLayout linearLayout = getBinding().A;
m.checkNotNullExpressionValue(linearLayout, "binding.settingsVoiceSensitivityTestingContainer");
linearLayout.setVisibility(z2 ? 0 : 8);
MaterialButton materialButton = getBinding().f2030z;
m.checkNotNullExpressionValue(materialButton, "binding.settingsVoiceSensitivityTestButton");
if (!z2) {
i = 0;
}
materialButton.setVisibility(i);
getBinding().f2030z.setOnClickListener(new WidgetSettingsVoice$configureVoiceSensitivity$1(this));
if (model.getVoiceConfig().getAutomaticVad()) {
View view = getBinding().w;
m.checkNotNullExpressionValue(view, "binding.settingsVoiceSensitivityAutomatic");
view.setVisibility(0);
SeekBar seekBar = getBinding().f2029y;
m.checkNotNullExpressionValue(seekBar, "binding.settingsVoiceSensitivityManual");
seekBar.setVisibility(4);
int i2 = model.getLocalVoiceStatus().b ? R.drawable.drawable_voice_indicator_speaking : R.drawable.drawable_voice_indicator_not_speaking;
View view2 = getBinding().w;
m.checkNotNullExpressionValue(view2, "binding.settingsVoiceSensitivityAutomatic");
view2.setBackground(ContextCompat.getDrawable(requireContext(), i2));
return;
}
View view3 = getBinding().w;
m.checkNotNullExpressionValue(view3, "binding.settingsVoiceSensitivityAutomatic");
view3.setVisibility(4);
SeekBar seekBar2 = getBinding().f2029y;
m.checkNotNullExpressionValue(seekBar2, "binding.settingsVoiceSensitivityManual");
seekBar2.setVisibility(0);
SeekBar seekBar3 = getBinding().f2029y;
m.checkNotNullExpressionValue(seekBar3, "binding.settingsVoiceSensitivityManual");
seekBar3.setSecondaryProgress(((int) model.getLocalVoiceStatus().a) + 100);
SeekBar seekBar4 = getBinding().f2029y;
m.checkNotNullExpressionValue(seekBar4, "binding.settingsVoiceSensitivityManual");
seekBar4.setProgress(((int) model.getVoiceConfig().getSensitivity()) + 100);
}
private final WidgetSettingsVoiceBinding getBinding() {
return (WidgetSettingsVoiceBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
}
public static final void launch(Context context, @IdRes Integer num, boolean z2) {
Companion.launch(context, num, z2);
}
private final void onOpenSLESConfigChanged() {
RadioManager radioManager = this.openSLESConfigRadioManager;
if (radioManager == null) {
m.throwUninitializedPropertyAccessException("openSLESConfigRadioManager");
}
Checkable checkable = radioManager.a.get(radioManager.b());
MediaEngine.OpenSLESConfig openSLESConfig = m.areEqual(checkable, getBinding().n) ? MediaEngine.OpenSLESConfig.DEFAULT : m.areEqual(checkable, getBinding().p) ? MediaEngine.OpenSLESConfig.FORCE_ENABLED : m.areEqual(checkable, getBinding().o) ? MediaEngine.OpenSLESConfig.FORCE_DISABLED : null;
if (openSLESConfig != null) {
StoreStream.Companion.getMediaEngine().setOpenSLESConfig(openSLESConfig);
}
c.a.d.m.i(this, R.string.user_settings_restart_app_mobile, 0, 4);
}
private final void onOverlayToggled(Context context) {
StoreStream.Companion companion = StoreStream.Companion;
if (companion.getUserSettings().getIsMobileOverlayEnabled()) {
Observable<RtcConnection.StateChange> x2 = companion.getRtcConnection().getConnectionState().x(WidgetSettingsVoice$onOverlayToggled$1.INSTANCE);
Observable<R> F = companion.getVoiceChannelSelected().observeSelectedChannel().x(ObservableExtensionsKt$filterNull$1.INSTANCE).F(ObservableExtensionsKt$filterNull$2.INSTANCE);
m.checkNotNullExpressionValue(F, "filter { it != null }.map { it!! }");
Observable j = Observable.j(x2, F, WidgetSettingsVoice$onOverlayToggled$2.INSTANCE);
m.checkNotNullExpressionValue(j, "Observable\n .co… -> rtcState to channel }");
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.takeSingleUntilTimeout(j, 200, false), this, null, 2, null), WidgetSettingsVoice.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetSettingsVoice$onOverlayToggled$3(context), 62, (Object) null);
return;
}
DiscordOverlayService.Companion.launchForClose(context);
}
@Override // com.discord.app.AppFragment, androidx.fragment.app.Fragment
public void onActivityResult(int i, int i2, Intent intent) {
if (i == OVERLAY_PERMISSION_REQUEST_CODE) {
boolean access$hasOverlayPermission = Companion.access$hasOverlayPermission(Companion, requireContext());
StoreStream.Companion.getUserSettings().setIsMobileOverlayEnabled(access$hasOverlayPermission);
CheckedSetting checkedSetting = getBinding().u;
m.checkNotNullExpressionValue(checkedSetting, "binding.settingsVoiceOverlayToggle");
checkedSetting.setChecked(access$hasOverlayPermission);
CheckedSetting checkedSetting2 = getBinding().u;
m.checkNotNullExpressionValue(checkedSetting2, "binding.settingsVoiceOverlayToggle");
Context context = checkedSetting2.getContext();
m.checkNotNullExpressionValue(context, "binding.settingsVoiceOverlayToggle.context");
onOverlayToggled(context);
return;
}
super.onActivityResult(i, i2, intent);
}
@Override // com.discord.app.AppFragment
public void onViewBound(View view) {
m.checkNotNullParameter(view, "view");
super.onViewBound(view);
TextView textView = getBinding().q;
m.checkNotNullExpressionValue(textView, "binding.settingsVoiceOpenslesHelp");
b.n(textView, R.string.form_label_android_opensl_desc, new Object[0], null, 4);
CheckedSetting checkedSetting = getBinding().n;
m.checkNotNullExpressionValue(checkedSetting, "binding.settingsVoiceOpenslesDefault");
CheckedSetting checkedSetting2 = getBinding().p;
m.checkNotNullExpressionValue(checkedSetting2, "binding.settingsVoiceOpenslesForceEnabled");
boolean z2 = true;
CheckedSetting checkedSetting3 = getBinding().o;
m.checkNotNullExpressionValue(checkedSetting3, "binding.settingsVoiceOpenslesForceDisabled");
List<CheckedSetting> listOf = n.listOf((Object[]) new CheckedSetting[]{checkedSetting, checkedSetting2, checkedSetting3});
this.openSLESConfigRadioButtons = listOf;
if (listOf == null) {
m.throwUninitializedPropertyAccessException("openSLESConfigRadioButtons");
}
this.openSLESConfigRadioManager = new RadioManager(listOf);
CheckedSetting checkedSetting4 = getBinding().u;
m.checkNotNullExpressionValue(checkedSetting4, "binding.settingsVoiceOverlayToggle");
checkedSetting4.setChecked(StoreStream.Companion.getUserSettings().getIsMobileOverlayEnabled() && Companion.access$hasOverlayPermission(Companion, requireContext()));
getBinding().u.setOnCheckedListener(new WidgetSettingsVoice$onViewBound$1(this));
for (TextView textView2 : n.listOf((Object[]) new TextView[]{getBinding().f, getBinding().r, getBinding().t, getBinding().v, getBinding().C, getBinding().m})) {
AccessibilityUtils accessibilityUtils = AccessibilityUtils.INSTANCE;
m.checkNotNullExpressionValue(textView2, "header");
accessibilityUtils.setViewIsHeading(textView2);
}
Integer valueOf = Integer.valueOf(getMostRecentIntent().getIntExtra(ARG_TARGET_RES_ID, 0));
if (valueOf.intValue() != 0) {
z2 = false;
}
if (z2) {
valueOf = null;
}
if (valueOf != null) {
View findViewById = view.findViewById(valueOf.intValue());
m.checkNotNullExpressionValue(findViewById, "target");
CoroutineScope coroutineScope = ViewCoroutineScopeKt.getCoroutineScope(findViewById);
if (coroutineScope != null) {
c.q.a.k.a.G(coroutineScope, null, null, new WidgetSettingsVoice$onViewBound$3$1(findViewById, null), 3, null);
}
if (m.areEqual(findViewById, getBinding().u)) {
CheckedSetting checkedSetting5 = getBinding().u;
m.checkNotNullExpressionValue(checkedSetting5, "binding.settingsVoiceOverlayToggle");
if (!checkedSetting5.isChecked() && getMostRecentIntent().getBooleanExtra(ARG_TARGET_AUTO_TOGGLE, false)) {
findViewById.post(new WidgetSettingsVoice$onViewBound$$inlined$let$lambda$1(this, view));
}
}
}
}
@Override // com.discord.app.AppFragment
public void onViewBoundOrOnResume() {
super.onViewBoundOrOnResume();
getBinding().f2027s.setOnSeekBarChangeListener(new WidgetSettingsVoice$onViewBoundOrOnResume$1());
getBinding().f2029y.setOnSeekBarChangeListener(new WidgetSettingsVoice$onViewBoundOrOnResume$2());
Model.Companion companion = Model.Companion;
BehaviorSubject<Boolean> behaviorSubject = this.requestListenForSensitivitySubject;
m.checkNotNullExpressionValue(behaviorSubject, "requestListenForSensitivitySubject");
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(companion.get(behaviorSubject), this, null, 2, null), WidgetSettingsVoice.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetSettingsVoice$onViewBoundOrOnResume$3(this), 62, (Object) null);
}
}