556 lines
27 KiB
Java
556 lines
27 KiB
Java
package com.discord.widgets.voice.settings;
|
|
|
|
import a0.a.a.b;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.res.Resources;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.SeekBar;
|
|
import android.widget.TextView;
|
|
import androidx.appcompat.app.AlertDialog;
|
|
import androidx.fragment.app.Fragment;
|
|
import androidx.fragment.app.FragmentActivity;
|
|
import androidx.fragment.app.FragmentManager;
|
|
import b.a.a.n;
|
|
import b.a.d.j;
|
|
import b.a.d.o;
|
|
import b.a.i.n4;
|
|
import b.d.b.a.a;
|
|
import com.discord.R;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.api.channel.ChannelUtils;
|
|
import com.discord.app.AppFragment;
|
|
import com.discord.databinding.WidgetVoiceChannelSettingsBinding;
|
|
import com.discord.models.domain.ModelVoiceRegion;
|
|
import com.discord.stores.StoreChannels;
|
|
import com.discord.stores.StoreGuildVoiceRegions;
|
|
import com.discord.stores.StoreGuilds;
|
|
import com.discord.stores.StorePermissions;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.stores.StoreUser;
|
|
import com.discord.stores.updates.ObservationDeck;
|
|
import com.discord.stores.updates.ObservationDeckProvider;
|
|
import com.discord.utilities.resources.StringResourceUtilsKt;
|
|
import com.discord.utilities.rest.RestAPI;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.stateful.StatefulViews;
|
|
import com.discord.utilities.view.extensions.ViewExtensions;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
import com.discord.utilities.voice.Bitrate;
|
|
import com.discord.views.CheckedSetting;
|
|
import com.discord.widgets.chat.list.TextInVoiceFeatureFlag;
|
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
|
import com.google.android.material.textfield.TextInputLayout;
|
|
import d0.t.u;
|
|
import d0.z.d.m;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Objects;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.reflect.KProperty;
|
|
import rx.Observable;
|
|
/* compiled from: WidgetVoiceChannelSettings.kt */
|
|
public final class WidgetVoiceChannelSettings extends AppFragment {
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.b0(WidgetVoiceChannelSettings.class, "binding", "getBinding()Lcom/discord/databinding/WidgetVoiceChannelSettingsBinding;", 0)};
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final String INTENT_EXTRA_CHANNEL_ID = "INTENT_EXTRA_CHANNEL_ID";
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetVoiceChannelSettings$binding$2.INSTANCE, null, 2, null);
|
|
private final StatefulViews state = new StatefulViews(R.id.channel_settings_edit_name, R.id.channel_settings_edit_topic, R.id.current_user_limit_display, R.id.current_bitrate_display, R.id.channel_settings_region_override, R.id.channel_settings_nsfw);
|
|
|
|
/* compiled from: WidgetVoiceChannelSettings.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public final void launch(long j, Context context) {
|
|
m.checkNotNullParameter(context, "context");
|
|
Intent putExtra = new Intent().putExtra(WidgetVoiceChannelSettings.INTENT_EXTRA_CHANNEL_ID, j);
|
|
m.checkNotNullExpressionValue(putExtra, "Intent().putExtra(INTENT…RA_CHANNEL_ID, channelId)");
|
|
j.d(context, WidgetVoiceChannelSettings.class, putExtra);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetVoiceChannelSettings.kt */
|
|
public static final class Model {
|
|
public static final Companion Companion = new Companion(null);
|
|
private final boolean canManageChannel;
|
|
private final boolean canManagePermissions;
|
|
private final Channel channel;
|
|
private final long guildID;
|
|
private final int maxBitrate;
|
|
private final List<ModelVoiceRegion> regions;
|
|
|
|
/* compiled from: WidgetVoiceChannelSettings.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public final Observable<Model> get(long j) {
|
|
StoreStream.Companion companion = StoreStream.Companion;
|
|
StoreChannels channels = companion.getChannels();
|
|
StoreGuilds guilds = companion.getGuilds();
|
|
StoreUser users = companion.getUsers();
|
|
StorePermissions permissions = companion.getPermissions();
|
|
StoreGuildVoiceRegions guildVoiceRegions = companion.getGuildVoiceRegions();
|
|
Observable<Model> q = ObservableExtensionsKt.computationLatest(ObservationDeck.connectRx$default(ObservationDeckProvider.get(), new ObservationDeck.UpdateSource[]{channels, guilds, StoreUser.Companion.getMeUpdate(), permissions, guildVoiceRegions, companion.getExperiments()}, false, null, null, new WidgetVoiceChannelSettings$Model$Companion$get$1(channels, j, guilds, permissions, users, guildVoiceRegions), 14, null)).q();
|
|
m.checkNotNullExpressionValue(q, "ObservationDeckProvider.… .distinctUntilChanged()");
|
|
return q;
|
|
}
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r6v0, resolved type: java.util.List<? extends com.discord.models.domain.ModelVoiceRegion> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public Model(Channel channel, boolean z2, boolean z3, int i, List<? extends ModelVoiceRegion> list, long j) {
|
|
m.checkNotNullParameter(channel, "channel");
|
|
m.checkNotNullParameter(list, "regions");
|
|
this.channel = channel;
|
|
this.canManageChannel = z2;
|
|
this.canManagePermissions = z3;
|
|
this.maxBitrate = i;
|
|
this.regions = list;
|
|
this.guildID = j;
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r5v0, resolved type: com.discord.widgets.voice.settings.WidgetVoiceChannelSettings$Model */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ Model copy$default(Model model, Channel channel, boolean z2, boolean z3, int i, List list, long j, int i2, Object obj) {
|
|
if ((i2 & 1) != 0) {
|
|
channel = model.channel;
|
|
}
|
|
if ((i2 & 2) != 0) {
|
|
z2 = model.canManageChannel;
|
|
}
|
|
if ((i2 & 4) != 0) {
|
|
z3 = model.canManagePermissions;
|
|
}
|
|
if ((i2 & 8) != 0) {
|
|
i = model.maxBitrate;
|
|
}
|
|
if ((i2 & 16) != 0) {
|
|
list = model.regions;
|
|
}
|
|
if ((i2 & 32) != 0) {
|
|
j = model.guildID;
|
|
}
|
|
return model.copy(channel, z2, z3, i, list, j);
|
|
}
|
|
|
|
public final Channel component1() {
|
|
return this.channel;
|
|
}
|
|
|
|
public final boolean component2() {
|
|
return this.canManageChannel;
|
|
}
|
|
|
|
public final boolean component3() {
|
|
return this.canManagePermissions;
|
|
}
|
|
|
|
public final int component4() {
|
|
return this.maxBitrate;
|
|
}
|
|
|
|
public final List<ModelVoiceRegion> component5() {
|
|
return this.regions;
|
|
}
|
|
|
|
public final long component6() {
|
|
return this.guildID;
|
|
}
|
|
|
|
public final Model copy(Channel channel, boolean z2, boolean z3, int i, List<? extends ModelVoiceRegion> list, long j) {
|
|
m.checkNotNullParameter(channel, "channel");
|
|
m.checkNotNullParameter(list, "regions");
|
|
return new Model(channel, z2, z3, i, list, j);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof Model)) {
|
|
return false;
|
|
}
|
|
Model model = (Model) obj;
|
|
return m.areEqual(this.channel, model.channel) && this.canManageChannel == model.canManageChannel && this.canManagePermissions == model.canManagePermissions && this.maxBitrate == model.maxBitrate && m.areEqual(this.regions, model.regions) && this.guildID == model.guildID;
|
|
}
|
|
|
|
public final boolean getCanManageChannel() {
|
|
return this.canManageChannel;
|
|
}
|
|
|
|
public final boolean getCanManagePermissions() {
|
|
return this.canManagePermissions;
|
|
}
|
|
|
|
public final Channel getChannel() {
|
|
return this.channel;
|
|
}
|
|
|
|
public final long getGuildID() {
|
|
return this.guildID;
|
|
}
|
|
|
|
public final int getMaxBitrate() {
|
|
return this.maxBitrate;
|
|
}
|
|
|
|
public final List<ModelVoiceRegion> getRegions() {
|
|
return this.regions;
|
|
}
|
|
|
|
public int hashCode() {
|
|
Channel channel = this.channel;
|
|
int i = 0;
|
|
int hashCode = (channel != null ? channel.hashCode() : 0) * 31;
|
|
boolean z2 = this.canManageChannel;
|
|
int i2 = 1;
|
|
if (z2) {
|
|
z2 = true;
|
|
}
|
|
int i3 = z2 ? 1 : 0;
|
|
int i4 = z2 ? 1 : 0;
|
|
int i5 = z2 ? 1 : 0;
|
|
int i6 = (hashCode + i3) * 31;
|
|
boolean z3 = this.canManagePermissions;
|
|
if (!z3) {
|
|
i2 = z3 ? 1 : 0;
|
|
}
|
|
int i7 = (((i6 + i2) * 31) + this.maxBitrate) * 31;
|
|
List<ModelVoiceRegion> list = this.regions;
|
|
if (list != null) {
|
|
i = list.hashCode();
|
|
}
|
|
return b.a(this.guildID) + ((i7 + i) * 31);
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder R = a.R("Model(channel=");
|
|
R.append(this.channel);
|
|
R.append(", canManageChannel=");
|
|
R.append(this.canManageChannel);
|
|
R.append(", canManagePermissions=");
|
|
R.append(this.canManagePermissions);
|
|
R.append(", maxBitrate=");
|
|
R.append(this.maxBitrate);
|
|
R.append(", regions=");
|
|
R.append(this.regions);
|
|
R.append(", guildID=");
|
|
return a.B(R, this.guildID, ")");
|
|
}
|
|
}
|
|
|
|
public WidgetVoiceChannelSettings() {
|
|
super(R.layout.widget_voice_channel_settings);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$configureUI(WidgetVoiceChannelSettings widgetVoiceChannelSettings, Model model) {
|
|
widgetVoiceChannelSettings.configureUI(model);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$confirmDelete(WidgetVoiceChannelSettings widgetVoiceChannelSettings, Channel channel) {
|
|
widgetVoiceChannelSettings.confirmDelete(channel);
|
|
}
|
|
|
|
public static final /* synthetic */ WidgetVoiceChannelSettingsBinding access$getBinding$p(WidgetVoiceChannelSettings widgetVoiceChannelSettings) {
|
|
return widgetVoiceChannelSettings.getBinding();
|
|
}
|
|
|
|
public static final /* synthetic */ String access$getBitrateDisplayString(WidgetVoiceChannelSettings widgetVoiceChannelSettings, int i) {
|
|
return widgetVoiceChannelSettings.getBitrateDisplayString(i);
|
|
}
|
|
|
|
public static final /* synthetic */ StatefulViews access$getState$p(WidgetVoiceChannelSettings widgetVoiceChannelSettings) {
|
|
return widgetVoiceChannelSettings.state;
|
|
}
|
|
|
|
public static final /* synthetic */ CharSequence access$getUserLimitDisplayString(WidgetVoiceChannelSettings widgetVoiceChannelSettings, int i) {
|
|
return widgetVoiceChannelSettings.getUserLimitDisplayString(i);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$saveChannel(WidgetVoiceChannelSettings widgetVoiceChannelSettings, long j, String str, int i, String str2, Boolean bool, int i2, int i3, String str3) {
|
|
widgetVoiceChannelSettings.saveChannel(j, str, i, str2, bool, i2, i3, str3);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$showRegionDialog(WidgetVoiceChannelSettings widgetVoiceChannelSettings, List list) {
|
|
widgetVoiceChannelSettings.showRegionDialog(list);
|
|
}
|
|
|
|
private final void configureRegionOverrideVisibility(boolean z2) {
|
|
View view = getBinding().o;
|
|
m.checkNotNullExpressionValue(view, "binding.regionOverrideDivider");
|
|
int i = 0;
|
|
view.setVisibility(z2 ? 0 : 8);
|
|
LinearLayout linearLayout = getBinding().h;
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.channelSettingsRegionOverrideContainer");
|
|
linearLayout.setVisibility(z2 ? 0 : 8);
|
|
TextView textView = getBinding().i;
|
|
m.checkNotNullExpressionValue(textView, "binding.channelSettingsRegionOverrideHelp");
|
|
if (!z2) {
|
|
i = 8;
|
|
}
|
|
textView.setVisibility(i);
|
|
}
|
|
|
|
private final void configureUI(Model model) {
|
|
Object obj;
|
|
String str;
|
|
if (model == null || (!model.getCanManageChannel() && !model.getCanManagePermissions())) {
|
|
FragmentActivity activity = e();
|
|
if (activity != null) {
|
|
activity.finish();
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
boolean z2 = true;
|
|
this.state.clear(true);
|
|
AppFragment.setActionBarDisplayHomeAsUpEnabled$default(this, false, 1, null);
|
|
setActionBarTitle(R.string.channel_settings);
|
|
setActionBarSubtitle(ChannelUtils.e(model.getChannel(), requireContext(), false, 2));
|
|
AppFragment.setActionBarOptionsMenu$default(this, R.menu.menu_voice_channel_settings, new WidgetVoiceChannelSettings$configureUI$1(this, model), null, 4, null);
|
|
TextView textView = getBinding().n;
|
|
m.checkNotNullExpressionValue(textView, "binding.currentUserLimitDisplay");
|
|
StatefulViews statefulViews = this.state;
|
|
TextView textView2 = getBinding().n;
|
|
m.checkNotNullExpressionValue(textView2, "binding.currentUserLimitDisplay");
|
|
textView.setText((CharSequence) statefulViews.get(textView2.getId(), getUserLimitDisplayString(model.getChannel().B())));
|
|
TextView textView3 = getBinding().r;
|
|
m.checkNotNullExpressionValue(textView3, "binding.settingsUserLimitHelp");
|
|
b.a.k.b.n(textView3, R.string.form_help_user_limit, new Object[0], null, 4);
|
|
SeekBar seekBar = getBinding().t;
|
|
m.checkNotNullExpressionValue(seekBar, "binding.userLimitSeekbar");
|
|
seekBar.setProgress(model.getChannel().B());
|
|
getBinding().t.setOnSeekBarChangeListener(new WidgetVoiceChannelSettings$configureUI$2(this));
|
|
configureUserLimitVisibility(model.getChannel().A() == 2);
|
|
int c = model.getChannel().c() / 1000;
|
|
TextView textView4 = getBinding().m;
|
|
m.checkNotNullExpressionValue(textView4, "binding.currentBitrateDisplay");
|
|
StatefulViews statefulViews2 = this.state;
|
|
TextView textView5 = getBinding().m;
|
|
m.checkNotNullExpressionValue(textView5, "binding.currentBitrateDisplay");
|
|
textView4.setText((CharSequence) statefulViews2.get(textView5.getId(), getBitrateDisplayString(c)));
|
|
TextView textView6 = getBinding().p;
|
|
m.checkNotNullExpressionValue(textView6, "binding.settingsBitrateHelp");
|
|
b.a.k.b.n(textView6, R.string.form_help_bitrate, new Object[]{"64"}, null, 4);
|
|
SeekBar seekBar2 = getBinding().f2666b;
|
|
m.checkNotNullExpressionValue(seekBar2, "binding.bitrateSeekbar");
|
|
int maxBitrate = model.getMaxBitrate();
|
|
Bitrate bitrate = Bitrate.MIN;
|
|
seekBar2.setMax(maxBitrate - bitrate.getKbps());
|
|
SeekBar seekBar3 = getBinding().f2666b;
|
|
m.checkNotNullExpressionValue(seekBar3, "binding.bitrateSeekbar");
|
|
seekBar3.setProgress(c - bitrate.getKbps());
|
|
getBinding().f2666b.setOnSeekBarChangeListener(new WidgetVoiceChannelSettings$configureUI$3(this));
|
|
StatefulViews statefulViews3 = this.state;
|
|
TextView textView7 = getBinding().g;
|
|
m.checkNotNullExpressionValue(textView7, "binding.channelSettingsRegionOverride");
|
|
String str2 = (String) statefulViews3.get(textView7.getId(), model.getChannel().x());
|
|
Iterator<T> it = model.getRegions().iterator();
|
|
while (true) {
|
|
if (!it.hasNext()) {
|
|
obj = null;
|
|
break;
|
|
}
|
|
obj = it.next();
|
|
if (m.areEqual(((ModelVoiceRegion) obj).getId(), str2)) {
|
|
break;
|
|
}
|
|
}
|
|
ModelVoiceRegion modelVoiceRegion = (ModelVoiceRegion) obj;
|
|
if (modelVoiceRegion == null || (str = modelVoiceRegion.getName()) == null) {
|
|
str = getString(R.string.automatic_region);
|
|
m.checkNotNullExpressionValue(str, "getString(R.string.automatic_region)");
|
|
}
|
|
TextView textView8 = getBinding().g;
|
|
m.checkNotNullExpressionValue(textView8, "binding.channelSettingsRegionOverride");
|
|
textView8.setText(str);
|
|
TextView textView9 = getBinding().i;
|
|
m.checkNotNullExpressionValue(textView9, "binding.channelSettingsRegionOverrideHelp");
|
|
b.a.k.b.n(textView9, R.string.form_help_region_override, new Object[0], null, 4);
|
|
getBinding().h.setOnClickListener(new WidgetVoiceChannelSettings$configureUI$4(this, model));
|
|
configureRegionOverrideVisibility(model.getCanManageChannel());
|
|
TextInputLayout textInputLayout = getBinding().c;
|
|
m.checkNotNullExpressionValue(textInputLayout, "binding.channelSettingsEditName");
|
|
StatefulViews statefulViews4 = this.state;
|
|
TextInputLayout textInputLayout2 = getBinding().c;
|
|
m.checkNotNullExpressionValue(textInputLayout2, "binding.channelSettingsEditName");
|
|
ViewExtensions.setText(textInputLayout, (CharSequence) statefulViews4.get(textInputLayout2.getId(), ChannelUtils.c(model.getChannel())));
|
|
TextInputLayout textInputLayout3 = getBinding().d;
|
|
m.checkNotNullExpressionValue(textInputLayout3, "binding.channelSettingsEditTopic");
|
|
int i = 8;
|
|
textInputLayout3.setVisibility(8);
|
|
TextInputLayout textInputLayout4 = getBinding().d;
|
|
m.checkNotNullExpressionValue(textInputLayout4, "binding.channelSettingsEditTopic");
|
|
StatefulViews statefulViews5 = this.state;
|
|
TextInputLayout textInputLayout5 = getBinding().d;
|
|
m.checkNotNullExpressionValue(textInputLayout5, "binding.channelSettingsEditTopic");
|
|
int id2 = textInputLayout5.getId();
|
|
String z3 = model.getChannel().z();
|
|
if (z3 == null) {
|
|
z3 = "";
|
|
}
|
|
ViewExtensions.setText(textInputLayout4, (CharSequence) statefulViews5.get(id2, z3));
|
|
LinearLayout linearLayout = getBinding().l;
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.channelSettingsSectionUserManagement");
|
|
linearLayout.setVisibility(model.getCanManagePermissions() ? 0 : 8);
|
|
getBinding().f.setOnClickListener(new WidgetVoiceChannelSettings$configureUI$5(this, model));
|
|
LinearLayout linearLayout2 = getBinding().k;
|
|
m.checkNotNullExpressionValue(linearLayout2, "binding.channelSettingsSectionPrivacySafety");
|
|
if (!model.getCanManageChannel() || !ChannelUtils.E(model.getChannel()) || !TextInVoiceFeatureFlag.Companion.getINSTANCE().isEnabled(Long.valueOf(model.getChannel().f()))) {
|
|
z2 = false;
|
|
}
|
|
linearLayout2.setVisibility(z2 ? 0 : 8);
|
|
CheckedSetting checkedSetting = getBinding().e;
|
|
m.checkNotNullExpressionValue(checkedSetting, "binding.channelSettingsNsfw");
|
|
if (model.getCanManageChannel()) {
|
|
i = 0;
|
|
}
|
|
checkedSetting.setVisibility(i);
|
|
StatefulViews statefulViews6 = this.state;
|
|
CheckedSetting checkedSetting2 = getBinding().e;
|
|
m.checkNotNullExpressionValue(checkedSetting2, "binding.channelSettingsNsfw");
|
|
getBinding().e.g(((Boolean) statefulViews6.get(checkedSetting2.getId(), Boolean.valueOf(model.getChannel().o()))).booleanValue(), false);
|
|
getBinding().j.setOnClickListener(new WidgetVoiceChannelSettings$configureUI$6(this, model));
|
|
this.state.configureSaveActionView(getBinding().j);
|
|
}
|
|
|
|
private final void configureUserLimitVisibility(boolean z2) {
|
|
View view = getBinding().f2667s;
|
|
m.checkNotNullExpressionValue(view, "binding.userLimitDivider");
|
|
int i = 0;
|
|
view.setVisibility(z2 ? 0 : 8);
|
|
TextView textView = getBinding().u;
|
|
m.checkNotNullExpressionValue(textView, "binding.userLimitTitle");
|
|
textView.setVisibility(z2 ? 0 : 8);
|
|
LinearLayout linearLayout = getBinding().q;
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.settingsUserLimit");
|
|
linearLayout.setVisibility(z2 ? 0 : 8);
|
|
TextView textView2 = getBinding().r;
|
|
m.checkNotNullExpressionValue(textView2, "binding.settingsUserLimitHelp");
|
|
if (!z2) {
|
|
i = 8;
|
|
}
|
|
textView2.setVisibility(i);
|
|
}
|
|
|
|
private final void confirmDelete(Channel channel) {
|
|
n4 a = n4.a(LayoutInflater.from(getContext()), null, false);
|
|
m.checkNotNullExpressionValue(a, "WidgetChannelSettingsDel…om(context), null, false)");
|
|
LinearLayout linearLayout = a.a;
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.root");
|
|
AlertDialog create = new AlertDialog.Builder(linearLayout.getContext()).setView(a.a).create();
|
|
m.checkNotNullExpressionValue(create, "AlertDialog.Builder(bind…ew(binding.root).create()");
|
|
a.c.setOnClickListener(new WidgetVoiceChannelSettings$confirmDelete$1(create));
|
|
a.d.setOnClickListener(new WidgetVoiceChannelSettings$confirmDelete$2(this, channel));
|
|
TextView textView = a.f163b;
|
|
m.checkNotNullExpressionValue(textView, "binding.channelSettingsDeleteBody");
|
|
LinearLayout linearLayout2 = a.a;
|
|
m.checkNotNullExpressionValue(linearLayout2, "binding.root");
|
|
Context context = linearLayout2.getContext();
|
|
m.checkNotNullExpressionValue(context, "binding.root.context");
|
|
b.a.k.b.n(textView, R.string.delete_channel_body, new Object[]{ChannelUtils.e(channel, context, false, 2)}, null, 4);
|
|
create.show();
|
|
}
|
|
|
|
private final WidgetVoiceChannelSettingsBinding getBinding() {
|
|
return (WidgetVoiceChannelSettingsBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
}
|
|
|
|
private final String getBitrateDisplayString(int i) {
|
|
return i + " Kbps";
|
|
}
|
|
|
|
private final CharSequence getUserLimitDisplayString(int i) {
|
|
if (i == 0) {
|
|
Resources resources = getResources();
|
|
m.checkNotNullExpressionValue(resources, "resources");
|
|
return b.a.k.b.i(resources, R.string.no_user_limit, new Object[0], null, 4);
|
|
}
|
|
Resources resources2 = getResources();
|
|
m.checkNotNullExpressionValue(resources2, "resources");
|
|
return StringResourceUtilsKt.getQuantityString(resources2, requireContext(), (int) R.plurals.num_users_num, i, Integer.valueOf(i));
|
|
}
|
|
|
|
public static final void launch(long j, Context context) {
|
|
Companion.launch(j, context);
|
|
}
|
|
|
|
private final void saveChannel(long j, String str, int i, String str2, Boolean bool, int i2, int i3, String str3) {
|
|
ObservableExtensionsKt.ui$default(RestAPI.Companion.getApiSerializeNulls().editVoiceChannel(j, str, str2, bool, Integer.valueOf(i), Integer.valueOf(i3), Integer.valueOf(i2), str3), this, null, 2, null).k(o.a.g(getContext(), new WidgetVoiceChannelSettings$saveChannel$1(this), null));
|
|
}
|
|
|
|
public static /* synthetic */ void saveChannel$default(WidgetVoiceChannelSettings widgetVoiceChannelSettings, long j, String str, int i, String str2, Boolean bool, int i2, int i3, String str3, int i4, Object obj) {
|
|
widgetVoiceChannelSettings.saveChannel(j, str, i, str2, (i4 & 16) != 0 ? null : bool, i2, i3, str3);
|
|
}
|
|
|
|
private final void showRegionDialog(List<? extends ModelVoiceRegion> list) {
|
|
n.a aVar = n.k;
|
|
FragmentManager parentFragmentManager = getParentFragmentManager();
|
|
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
|
|
CharSequence k = b.a.k.b.k(this, R.string.form_label_region_override, new Object[0], null, 4);
|
|
List listOf = d0.t.m.listOf(b.a.k.b.k(this, R.string.automatic_region, new Object[0], null, 4));
|
|
ArrayList arrayList = new ArrayList(d0.t.o.collectionSizeOrDefault(list, 10));
|
|
for (ModelVoiceRegion modelVoiceRegion : list) {
|
|
arrayList.add(modelVoiceRegion.getName());
|
|
}
|
|
Object[] array = u.plus((Collection) listOf, (Iterable) arrayList).toArray(new CharSequence[0]);
|
|
Objects.requireNonNull(array, "null cannot be cast to non-null type kotlin.Array<T>");
|
|
aVar.a(parentFragmentManager, k, (CharSequence[]) array, new WidgetVoiceChannelSettings$showRegionDialog$2(this, list));
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
public void onViewBound(View view) {
|
|
m.checkNotNullParameter(view, "view");
|
|
super.onViewBound(view);
|
|
setRetainInstance(true);
|
|
this.state.setupUnsavedChangesConfirmation(this);
|
|
StatefulViews statefulViews = this.state;
|
|
TextInputLayout textInputLayout = getBinding().d;
|
|
m.checkNotNullExpressionValue(textInputLayout, "binding.channelSettingsEditTopic");
|
|
statefulViews.addOptionalFields(textInputLayout);
|
|
StatefulViews statefulViews2 = this.state;
|
|
TextView textView = getBinding().g;
|
|
m.checkNotNullExpressionValue(textView, "binding.channelSettingsRegionOverride");
|
|
statefulViews2.addOptionalFields(textView);
|
|
StatefulViews statefulViews3 = this.state;
|
|
FloatingActionButton floatingActionButton = getBinding().j;
|
|
TextInputLayout textInputLayout2 = getBinding().c;
|
|
m.checkNotNullExpressionValue(textInputLayout2, "binding.channelSettingsEditName");
|
|
TextInputLayout textInputLayout3 = getBinding().d;
|
|
m.checkNotNullExpressionValue(textInputLayout3, "binding.channelSettingsEditTopic");
|
|
TextView textView2 = getBinding().n;
|
|
m.checkNotNullExpressionValue(textView2, "binding.currentUserLimitDisplay");
|
|
TextView textView3 = getBinding().m;
|
|
m.checkNotNullExpressionValue(textView3, "binding.currentBitrateDisplay");
|
|
CheckedSetting checkedSetting = getBinding().e;
|
|
m.checkNotNullExpressionValue(checkedSetting, "binding.channelSettingsNsfw");
|
|
statefulViews3.setupTextWatcherWithSaveAction(this, floatingActionButton, textInputLayout2, textInputLayout3, textView2, textView3, checkedSetting);
|
|
TextInputLayout textInputLayout4 = getBinding().d;
|
|
m.checkNotNullExpressionValue(textInputLayout4, "binding.channelSettingsEditTopic");
|
|
ViewExtensions.interceptScrollWhenInsideScrollable(textInputLayout4);
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
public void onViewBoundOrOnResume() {
|
|
super.onViewBoundOrOnResume();
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(Model.Companion.get(getMostRecentIntent().getLongExtra(INTENT_EXTRA_CHANNEL_ID, -1)), this, null, 2, null), WidgetVoiceChannelSettings.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetVoiceChannelSettings$onViewBoundOrOnResume$1(this), 62, (Object) null);
|
|
}
|
|
}
|