591 lines
29 KiB
Java
591 lines
29 KiB
Java
package com.discord.widgets.channels.settings;
|
|
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
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 c.a.d.f;
|
|
import c.a.d.l;
|
|
import c.a.d.q;
|
|
import c.a.i.f4;
|
|
import c.a.i.g4;
|
|
import c.a.k.b;
|
|
import c.d.b.a.a;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.app.AppFragment;
|
|
import com.discord.databinding.WidgetTextChannelSettingsBinding;
|
|
import com.discord.models.guild.Guild;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.utilities.rest.RestAPI;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.stateful.StatefulViews;
|
|
import com.discord.utilities.threads.ThreadUtils;
|
|
import com.discord.utilities.view.extensions.ViewExtensions;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
import com.discord.views.CheckedSetting;
|
|
import com.google.android.material.button.MaterialButton;
|
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
|
import com.google.android.material.textfield.TextInputLayout;
|
|
import d0.t.n;
|
|
import d0.z.d.m;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.reflect.KProperty;
|
|
import rx.Observable;
|
|
/* compiled from: WidgetTextChannelSettings.kt */
|
|
public final class WidgetTextChannelSettings extends AppFragment {
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.V(WidgetTextChannelSettings.class, "binding", "getBinding()Lcom/discord/databinding/WidgetTextChannelSettingsBinding;", 0)};
|
|
public static final Companion Companion = new Companion(null);
|
|
public static final int ONE_DAY = 86400;
|
|
public static final int ONE_HOUR = 3600;
|
|
public static final int ONE_MINUTE = 60;
|
|
private static final List<Integer> SLOWMODE_COOLDOWN_VALUES = n.listOf((Object[]) new Integer[]{0, 5, 10, 15, 30, 60, 120, 300, 600, 900, 1800, 3600, 7200, 21600});
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetTextChannelSettings$binding$2.INSTANCE, null, 2, null);
|
|
private final StatefulViews state = new StatefulViews(2131362359, 2131362360, 2131362381, 2131362353, 2131362348);
|
|
|
|
/* compiled from: WidgetTextChannelSettings.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public static /* synthetic */ void setDurationSecondsLabel$default(Companion companion, TextView textView, int i, Context context, int i2, int i3, Object obj) {
|
|
if ((i3 & 8) != 0) {
|
|
i2 = 2131888753;
|
|
}
|
|
companion.setDurationSecondsLabel(textView, i, context, i2);
|
|
}
|
|
|
|
public final List<Integer> getSLOWMODE_COOLDOWN_VALUES() {
|
|
return WidgetTextChannelSettings.access$getSLOWMODE_COOLDOWN_VALUES$cp();
|
|
}
|
|
|
|
public final void launch(long j, Context context) {
|
|
m.checkNotNullParameter(context, "context");
|
|
Intent putExtra = new Intent().putExtra("com.discord.intent.extra.EXTRA_CHANNEL_ID", j);
|
|
m.checkNotNullExpressionValue(putExtra, "Intent()\n .putE…RA_CHANNEL_ID, channelId)");
|
|
l.d(context, WidgetTextChannelSettings.class, putExtra);
|
|
}
|
|
|
|
public final void setDurationSecondsLabel(TextView textView, int i, Context context, int i2) {
|
|
m.checkNotNullParameter(textView, "textView");
|
|
m.checkNotNullParameter(context, "context");
|
|
if (i == 0) {
|
|
textView.setText(context.getString(i2));
|
|
} else if (1 <= i && 60 > i) {
|
|
ViewExtensions.setPluralText(textView, 2131755070, i, new Object[0]);
|
|
} else if (60 <= i && 3600 > i) {
|
|
ViewExtensions.setPluralText(textView, 2131755067, i / 60, new Object[0]);
|
|
} else if (3600 <= i && 86400 > i) {
|
|
ViewExtensions.setPluralText(textView, 2131755065, i / 3600, new Object[0]);
|
|
} else {
|
|
ViewExtensions.setPluralText(textView, 2131755063, i / 86400, new Object[0]);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetTextChannelSettings.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 Guild guild;
|
|
private final boolean isCommunityGuild;
|
|
private final boolean isPinsEnabled;
|
|
private final boolean isPublicGuildRulesChannel;
|
|
private final boolean isPublicGuildUpdatesChannel;
|
|
|
|
/* compiled from: WidgetTextChannelSettings.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public final Observable<Model> get(long j) {
|
|
Observable<R> Y = StoreStream.Companion.getChannels().observeChannel(j).Y(new WidgetTextChannelSettings$Model$Companion$get$1(j));
|
|
m.checkNotNullExpressionValue(Y, "StoreStream\n … }\n }");
|
|
Observable<Model> r = ObservableExtensionsKt.computationLatest(Y).r();
|
|
m.checkNotNullExpressionValue(r, "StoreStream\n … .distinctUntilChanged()");
|
|
return r;
|
|
}
|
|
}
|
|
|
|
public Model(Guild guild, Channel channel, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, boolean z7) {
|
|
m.checkNotNullParameter(guild, "guild");
|
|
m.checkNotNullParameter(channel, "channel");
|
|
this.guild = guild;
|
|
this.channel = channel;
|
|
this.canManageChannel = z2;
|
|
this.canManagePermissions = z3;
|
|
this.isPinsEnabled = z4;
|
|
this.isPublicGuildRulesChannel = z5;
|
|
this.isPublicGuildUpdatesChannel = z6;
|
|
this.isCommunityGuild = z7;
|
|
}
|
|
|
|
public static /* synthetic */ Model copy$default(Model model, Guild guild, Channel channel, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, boolean z7, int i, Object obj) {
|
|
return model.copy((i & 1) != 0 ? model.guild : guild, (i & 2) != 0 ? model.channel : channel, (i & 4) != 0 ? model.canManageChannel : z2, (i & 8) != 0 ? model.canManagePermissions : z3, (i & 16) != 0 ? model.isPinsEnabled : z4, (i & 32) != 0 ? model.isPublicGuildRulesChannel : z5, (i & 64) != 0 ? model.isPublicGuildUpdatesChannel : z6, (i & 128) != 0 ? model.isCommunityGuild : z7);
|
|
}
|
|
|
|
public final Guild component1() {
|
|
return this.guild;
|
|
}
|
|
|
|
public final Channel component2() {
|
|
return this.channel;
|
|
}
|
|
|
|
public final boolean component3() {
|
|
return this.canManageChannel;
|
|
}
|
|
|
|
public final boolean component4() {
|
|
return this.canManagePermissions;
|
|
}
|
|
|
|
public final boolean component5() {
|
|
return this.isPinsEnabled;
|
|
}
|
|
|
|
public final boolean component6() {
|
|
return this.isPublicGuildRulesChannel;
|
|
}
|
|
|
|
public final boolean component7() {
|
|
return this.isPublicGuildUpdatesChannel;
|
|
}
|
|
|
|
public final boolean component8() {
|
|
return this.isCommunityGuild;
|
|
}
|
|
|
|
public final Model copy(Guild guild, Channel channel, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, boolean z7) {
|
|
m.checkNotNullParameter(guild, "guild");
|
|
m.checkNotNullParameter(channel, "channel");
|
|
return new Model(guild, channel, z2, z3, z4, z5, z6, z7);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof Model)) {
|
|
return false;
|
|
}
|
|
Model model = (Model) obj;
|
|
return m.areEqual(this.guild, model.guild) && m.areEqual(this.channel, model.channel) && this.canManageChannel == model.canManageChannel && this.canManagePermissions == model.canManagePermissions && this.isPinsEnabled == model.isPinsEnabled && this.isPublicGuildRulesChannel == model.isPublicGuildRulesChannel && this.isPublicGuildUpdatesChannel == model.isPublicGuildUpdatesChannel && this.isCommunityGuild == model.isCommunityGuild;
|
|
}
|
|
|
|
public final boolean getCanManageChannel() {
|
|
return this.canManageChannel;
|
|
}
|
|
|
|
public final boolean getCanManagePermissions() {
|
|
return this.canManagePermissions;
|
|
}
|
|
|
|
public final Channel getChannel() {
|
|
return this.channel;
|
|
}
|
|
|
|
public final Guild getGuild() {
|
|
return this.guild;
|
|
}
|
|
|
|
public int hashCode() {
|
|
Guild guild = this.guild;
|
|
int i = 0;
|
|
int hashCode = (guild != null ? guild.hashCode() : 0) * 31;
|
|
Channel channel = this.channel;
|
|
if (channel != null) {
|
|
i = channel.hashCode();
|
|
}
|
|
int i2 = (hashCode + i) * 31;
|
|
boolean z2 = this.canManageChannel;
|
|
int i3 = 1;
|
|
if (z2) {
|
|
z2 = true;
|
|
}
|
|
int i4 = z2 ? 1 : 0;
|
|
int i5 = z2 ? 1 : 0;
|
|
int i6 = z2 ? 1 : 0;
|
|
int i7 = (i2 + i4) * 31;
|
|
boolean z3 = this.canManagePermissions;
|
|
if (z3) {
|
|
z3 = true;
|
|
}
|
|
int i8 = z3 ? 1 : 0;
|
|
int i9 = z3 ? 1 : 0;
|
|
int i10 = z3 ? 1 : 0;
|
|
int i11 = (i7 + i8) * 31;
|
|
boolean z4 = this.isPinsEnabled;
|
|
if (z4) {
|
|
z4 = true;
|
|
}
|
|
int i12 = z4 ? 1 : 0;
|
|
int i13 = z4 ? 1 : 0;
|
|
int i14 = z4 ? 1 : 0;
|
|
int i15 = (i11 + i12) * 31;
|
|
boolean z5 = this.isPublicGuildRulesChannel;
|
|
if (z5) {
|
|
z5 = true;
|
|
}
|
|
int i16 = z5 ? 1 : 0;
|
|
int i17 = z5 ? 1 : 0;
|
|
int i18 = z5 ? 1 : 0;
|
|
int i19 = (i15 + i16) * 31;
|
|
boolean z6 = this.isPublicGuildUpdatesChannel;
|
|
if (z6) {
|
|
z6 = true;
|
|
}
|
|
int i20 = z6 ? 1 : 0;
|
|
int i21 = z6 ? 1 : 0;
|
|
int i22 = z6 ? 1 : 0;
|
|
int i23 = (i19 + i20) * 31;
|
|
boolean z7 = this.isCommunityGuild;
|
|
if (!z7) {
|
|
i3 = z7 ? 1 : 0;
|
|
}
|
|
return i23 + i3;
|
|
}
|
|
|
|
public final boolean isCommunityGuild() {
|
|
return this.isCommunityGuild;
|
|
}
|
|
|
|
public final boolean isPinsEnabled() {
|
|
return this.isPinsEnabled;
|
|
}
|
|
|
|
public final boolean isPublicGuildRulesChannel() {
|
|
return this.isPublicGuildRulesChannel;
|
|
}
|
|
|
|
public final boolean isPublicGuildUpdatesChannel() {
|
|
return this.isPublicGuildUpdatesChannel;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("Model(guild=");
|
|
K.append(this.guild);
|
|
K.append(", channel=");
|
|
K.append(this.channel);
|
|
K.append(", canManageChannel=");
|
|
K.append(this.canManageChannel);
|
|
K.append(", canManagePermissions=");
|
|
K.append(this.canManagePermissions);
|
|
K.append(", isPinsEnabled=");
|
|
K.append(this.isPinsEnabled);
|
|
K.append(", isPublicGuildRulesChannel=");
|
|
K.append(this.isPublicGuildRulesChannel);
|
|
K.append(", isPublicGuildUpdatesChannel=");
|
|
K.append(this.isPublicGuildUpdatesChannel);
|
|
K.append(", isCommunityGuild=");
|
|
return a.F(K, this.isCommunityGuild, ")");
|
|
}
|
|
}
|
|
|
|
public WidgetTextChannelSettings() {
|
|
super(2131559273);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$cannotDeleteWarn(WidgetTextChannelSettings widgetTextChannelSettings, boolean z2) {
|
|
widgetTextChannelSettings.cannotDeleteWarn(z2);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$configureUI(WidgetTextChannelSettings widgetTextChannelSettings, Model model) {
|
|
widgetTextChannelSettings.configureUI(model);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$confirmDelete(WidgetTextChannelSettings widgetTextChannelSettings, Channel channel) {
|
|
widgetTextChannelSettings.confirmDelete(channel);
|
|
}
|
|
|
|
public static final /* synthetic */ WidgetTextChannelSettingsBinding access$getBinding$p(WidgetTextChannelSettings widgetTextChannelSettings) {
|
|
return widgetTextChannelSettings.getBinding();
|
|
}
|
|
|
|
public static final /* synthetic */ List access$getSLOWMODE_COOLDOWN_VALUES$cp() {
|
|
return SLOWMODE_COOLDOWN_VALUES;
|
|
}
|
|
|
|
public static final /* synthetic */ StatefulViews access$getState$p(WidgetTextChannelSettings widgetTextChannelSettings) {
|
|
return widgetTextChannelSettings.state;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setDefaultAutoArchiveDurationLabel(WidgetTextChannelSettings widgetTextChannelSettings, int i) {
|
|
widgetTextChannelSettings.setDefaultAutoArchiveDurationLabel(i);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setSlowmodeLabel(WidgetTextChannelSettings widgetTextChannelSettings, int i) {
|
|
widgetTextChannelSettings.setSlowmodeLabel(i);
|
|
}
|
|
|
|
private final void cannotDeleteWarn(boolean z2) {
|
|
View inflate = LayoutInflater.from(getContext()).inflate(2131558892, (ViewGroup) null, false);
|
|
int i = 2131362349;
|
|
TextView textView = (TextView) inflate.findViewById(2131362349);
|
|
if (textView != null) {
|
|
i = 2131362350;
|
|
MaterialButton materialButton = (MaterialButton) inflate.findViewById(2131362350);
|
|
if (materialButton != null) {
|
|
i = 2131362351;
|
|
TextView textView2 = (TextView) inflate.findViewById(2131362351);
|
|
if (textView2 != null) {
|
|
LinearLayout linearLayout = (LinearLayout) inflate;
|
|
m.checkNotNullExpressionValue(new f4(linearLayout, textView, materialButton, textView2), "WidgetChannelSettingsCan…om(context), null, false)");
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.root");
|
|
AlertDialog create = new AlertDialog.Builder(linearLayout.getContext()).setView(linearLayout).create();
|
|
m.checkNotNullExpressionValue(create, "AlertDialog.Builder(bind…ew(binding.root).create()");
|
|
textView.setText(z2 ? 2131888077 : 2131888086);
|
|
materialButton.setOnClickListener(new WidgetTextChannelSettings$cannotDeleteWarn$1(create));
|
|
create.show();
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i)));
|
|
}
|
|
|
|
private final void configureUI(Model model) {
|
|
int i;
|
|
if (model == null) {
|
|
FragmentActivity activity = getActivity();
|
|
if (activity != null) {
|
|
activity.finish();
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
CharSequence charSequence = null;
|
|
AppFragment.setActionBarDisplayHomeAsUpEnabled$default(this, false, 1, null);
|
|
setActionBarTitle(AnimatableValueParser.z1(model.getChannel()) ? 2131887329 : 2131887210);
|
|
setActionBarSubtitle(AnimatableValueParser.A0(model.getChannel(), requireContext(), false, 2));
|
|
setActionBarOptionsMenu(AnimatableValueParser.z1(model.getChannel()) ? 2131623965 : 2131623940, new WidgetTextChannelSettings$configureUI$1(this, model), new WidgetTextChannelSettings$configureUI$2(model));
|
|
TextInputLayout textInputLayout = getBinding().e;
|
|
m.checkNotNullExpressionValue(textInputLayout, "binding.channelSettingsEditName");
|
|
StatefulViews statefulViews = this.state;
|
|
TextInputLayout textInputLayout2 = getBinding().e;
|
|
m.checkNotNullExpressionValue(textInputLayout2, "binding.channelSettingsEditName");
|
|
ViewExtensions.setText(textInputLayout, (CharSequence) statefulViews.get(textInputLayout2.getId(), AnimatableValueParser.y0(model.getChannel())));
|
|
getBinding().e.setHint(AnimatableValueParser.z1(model.getChannel()) ? 2131888634 : 2131887206);
|
|
TextInputLayout textInputLayout3 = getBinding().f;
|
|
m.checkNotNullExpressionValue(textInputLayout3, "binding.channelSettingsEditTopic");
|
|
StatefulViews statefulViews2 = this.state;
|
|
TextInputLayout textInputLayout4 = getBinding().f;
|
|
m.checkNotNullExpressionValue(textInputLayout4, "binding.channelSettingsEditTopic");
|
|
int id2 = textInputLayout4.getId();
|
|
String z2 = model.getChannel().z();
|
|
if (z2 == null) {
|
|
z2 = "";
|
|
}
|
|
ViewExtensions.setText(textInputLayout3, (CharSequence) statefulViews2.get(id2, z2));
|
|
TextInputLayout textInputLayout5 = getBinding().f;
|
|
m.checkNotNullExpressionValue(textInputLayout5, "binding.channelSettingsEditTopic");
|
|
int i2 = 8;
|
|
textInputLayout5.setVisibility(AnimatableValueParser.z1(model.getChannel()) ? 0 : 8);
|
|
LinearLayout linearLayout = getBinding().g;
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.channelSettingsEditWrap");
|
|
linearLayout.setVisibility(model.getCanManageChannel() ? 0 : 8);
|
|
getBinding().m.setOnClickListener(new WidgetTextChannelSettings$configureUI$3(this, model));
|
|
this.state.configureSaveActionView(getBinding().m);
|
|
LinearLayout linearLayout2 = getBinding().k;
|
|
m.checkNotNullExpressionValue(linearLayout2, "binding.channelSettingsPinnedMessagesContainer");
|
|
linearLayout2.setVisibility(AnimatableValueParser.z1(model.getChannel()) ? 0 : 8);
|
|
TextView textView = getBinding().j;
|
|
m.checkNotNullExpressionValue(textView, "binding.channelSettingsPinnedMessages");
|
|
textView.setEnabled(model.isPinsEnabled());
|
|
getBinding().j.setOnClickListener(new WidgetTextChannelSettings$configureUI$5(model));
|
|
View view = getBinding().l;
|
|
m.checkNotNullExpressionValue(view, "binding.channelSettingsP…edMessagesDisabledOverlay");
|
|
view.setVisibility(model.isPinsEnabled() ^ true ? 0 : 8);
|
|
getBinding().l.setOnClickListener(WidgetTextChannelSettings$configureUI$6.INSTANCE);
|
|
TextView textView2 = getBinding().i;
|
|
m.checkNotNullExpressionValue(textView2, "binding.channelSettingsPermissions");
|
|
textView2.setVisibility(model.getCanManagePermissions() ? 0 : 8);
|
|
getBinding().i.setOnClickListener(new WidgetTextChannelSettings$configureUI$7(model));
|
|
CheckedSetting checkedSetting = getBinding().b;
|
|
m.checkNotNullExpressionValue(checkedSetting, "binding.channelSettingsAnnouncement");
|
|
Channel channel = model.getChannel();
|
|
m.checkNotNullParameter(channel, "$this$isGuildTextChannel");
|
|
checkedSetting.setVisibility(((channel.A() == 0) || AnimatableValueParser.d1(model.getChannel())) && model.getCanManageChannel() && model.isCommunityGuild() && !model.isPublicGuildRulesChannel() && !model.isPublicGuildUpdatesChannel() ? 0 : 8);
|
|
getBinding().b.g(AnimatableValueParser.d1(model.getChannel()), false);
|
|
CheckedSetting checkedSetting2 = getBinding().b;
|
|
Context context = getContext();
|
|
if (context != null) {
|
|
charSequence = b.g(context, 2131888593, new Object[]{f.a.a(360032008192L, null)}, null, 4);
|
|
}
|
|
checkedSetting2.h(charSequence, true);
|
|
getBinding().b.e(new WidgetTextChannelSettings$configureUI$8(this, model));
|
|
LinearLayout linearLayout3 = getBinding().q;
|
|
m.checkNotNullExpressionValue(linearLayout3, "binding.channelSettingsSectionUserManagement");
|
|
linearLayout3.setVisibility(model.getCanManageChannel() || model.getCanManagePermissions() ? 0 : 8);
|
|
LinearLayout linearLayout4 = getBinding().o;
|
|
m.checkNotNullExpressionValue(linearLayout4, "binding.channelSettingsSectionPrivacySafety");
|
|
linearLayout4.setVisibility(model.getCanManageChannel() && AnimatableValueParser.z1(model.getChannel()) ? 0 : 8);
|
|
CheckedSetting checkedSetting3 = getBinding().h;
|
|
m.checkNotNullExpressionValue(checkedSetting3, "binding.channelSettingsNsfw");
|
|
checkedSetting3.setVisibility(model.getCanManageChannel() ? 0 : 8);
|
|
getBinding().h.g(model.getChannel().o(), false);
|
|
getBinding().h.e(new WidgetTextChannelSettings$configureUI$9(this, model));
|
|
LinearLayout linearLayout5 = getBinding().p;
|
|
m.checkNotNullExpressionValue(linearLayout5, "binding.channelSettingsSectionSlowMode");
|
|
linearLayout5.setVisibility(model.getCanManageChannel() && AnimatableValueParser.z1(model.getChannel()) && !AnimatableValueParser.d1(model.getChannel()) ? 0 : 8);
|
|
int intValue = ((Number) this.state.get(2131362381, Integer.valueOf(model.getChannel().u()))).intValue();
|
|
setSlowmodeLabel(intValue);
|
|
Iterator<Integer> it = SLOWMODE_COOLDOWN_VALUES.iterator();
|
|
int i3 = 0;
|
|
while (true) {
|
|
i = -1;
|
|
if (!it.hasNext()) {
|
|
i3 = -1;
|
|
break;
|
|
}
|
|
if (it.next().intValue() >= intValue) {
|
|
break;
|
|
}
|
|
i3++;
|
|
}
|
|
SeekBar seekBar = getBinding().f1986s;
|
|
m.checkNotNullExpressionValue(seekBar, "binding.channelSettingsSlowModeCooldownSlider");
|
|
seekBar.setProgress(i3);
|
|
this.state.configureSaveActionView(getBinding().m);
|
|
SeekBar seekBar2 = getBinding().f1986s;
|
|
m.checkNotNullExpressionValue(seekBar2, "binding.channelSettingsSlowModeCooldownSlider");
|
|
TextView textView3 = getBinding().r;
|
|
m.checkNotNullExpressionValue(textView3, "binding.channelSettingsSlowModeCooldownLabel");
|
|
seekBar2.setContentDescription(textView3.getText());
|
|
LinearLayout linearLayout6 = getBinding().n;
|
|
m.checkNotNullExpressionValue(linearLayout6, "binding.channelSettingsS…efaultAutoArchiveDuration");
|
|
if (model.getCanManageChannel() && AnimatableValueParser.B1(model.getChannel()) && ThreadUtils.INSTANCE.isThreadsEnabled(model.getGuild().getId())) {
|
|
i2 = 0;
|
|
}
|
|
linearLayout6.setVisibility(i2);
|
|
Integer num = (Integer) this.state.get(2131362353, model.getChannel().d());
|
|
int intValue2 = num != null ? num.intValue() : 1440;
|
|
setDefaultAutoArchiveDurationLabel(intValue2);
|
|
Iterator<Integer> it2 = ThreadUtils.INSTANCE.getTHREAD_AUTO_ARCHIVE_DURATIONS().iterator();
|
|
int i4 = 0;
|
|
while (true) {
|
|
if (!it2.hasNext()) {
|
|
break;
|
|
}
|
|
if (m.compare(it2.next().intValue(), intValue2) >= 0) {
|
|
i = i4;
|
|
break;
|
|
}
|
|
i4++;
|
|
}
|
|
SeekBar seekBar3 = getBinding().d;
|
|
m.checkNotNullExpressionValue(seekBar3, "binding.channelSettingsD…AutoArchiveDurationSlider");
|
|
seekBar3.setProgress(i);
|
|
this.state.configureSaveActionView(getBinding().m);
|
|
SeekBar seekBar4 = getBinding().d;
|
|
m.checkNotNullExpressionValue(seekBar4, "binding.channelSettingsD…AutoArchiveDurationSlider");
|
|
TextView textView4 = getBinding().r;
|
|
m.checkNotNullExpressionValue(textView4, "binding.channelSettingsSlowModeCooldownLabel");
|
|
seekBar4.setContentDescription(textView4.getText());
|
|
}
|
|
|
|
private final void confirmDelete(Channel channel) {
|
|
g4 a = g4.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.e.setText(AnimatableValueParser.z1(channel) ? 2131888064 : 2131888063);
|
|
a.f95c.setOnClickListener(new WidgetTextChannelSettings$confirmDelete$1(create));
|
|
a.d.setOnClickListener(new WidgetTextChannelSettings$confirmDelete$2(this, channel));
|
|
TextView textView = a.b;
|
|
m.checkNotNullExpressionValue(textView, "binding.channelSettingsDeleteBody");
|
|
b.m(textView, 2131888065, new Object[]{AnimatableValueParser.A0(channel, requireContext(), false, 2)}, null, 4);
|
|
create.show();
|
|
}
|
|
|
|
private final WidgetTextChannelSettingsBinding getBinding() {
|
|
return (WidgetTextChannelSettingsBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
}
|
|
|
|
public static final void launch(long j, Context context) {
|
|
Companion.launch(j, context);
|
|
}
|
|
|
|
private final void saveChannel(long j, String str, Integer num, String str2, Boolean bool, Integer num2, Integer num3) {
|
|
ObservableExtensionsKt.ui$default(RestAPI.Companion.getApi().editTextChannel(j, str, num, str2, bool, num2, num3), this, null, 2, null).k(q.a.g(getContext(), new WidgetTextChannelSettings$saveChannel$1(this), null));
|
|
}
|
|
|
|
public static /* synthetic */ void saveChannel$default(WidgetTextChannelSettings widgetTextChannelSettings, long j, String str, Integer num, String str2, Boolean bool, Integer num2, Integer num3, int i, Object obj) {
|
|
widgetTextChannelSettings.saveChannel(j, (i & 2) != 0 ? null : str, (i & 4) != 0 ? null : num, (i & 8) != 0 ? null : str2, (i & 16) != 0 ? null : bool, (i & 32) != 0 ? null : num2, (i & 64) != 0 ? null : num3);
|
|
}
|
|
|
|
private final void setDefaultAutoArchiveDurationLabel(int i) {
|
|
Companion companion = Companion;
|
|
TextView textView = getBinding().f1985c;
|
|
m.checkNotNullExpressionValue(textView, "binding.channelSettingsD…tAutoArchiveDurationLabel");
|
|
Companion.setDurationSecondsLabel$default(companion, textView, i * 60, requireContext(), 0, 8, null);
|
|
}
|
|
|
|
private final void setSlowmodeLabel(int i) {
|
|
Companion companion = Companion;
|
|
TextView textView = getBinding().r;
|
|
m.checkNotNullExpressionValue(textView, "binding.channelSettingsSlowModeCooldownLabel");
|
|
companion.setDurationSecondsLabel(textView, i, requireContext(), 2131888753);
|
|
}
|
|
|
|
@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().f;
|
|
m.checkNotNullExpressionValue(textInputLayout, "binding.channelSettingsEditTopic");
|
|
statefulViews.addOptionalFields(textInputLayout);
|
|
StatefulViews statefulViews2 = this.state;
|
|
FloatingActionButton floatingActionButton = getBinding().m;
|
|
TextInputLayout textInputLayout2 = getBinding().e;
|
|
m.checkNotNullExpressionValue(textInputLayout2, "binding.channelSettingsEditName");
|
|
TextInputLayout textInputLayout3 = getBinding().f;
|
|
m.checkNotNullExpressionValue(textInputLayout3, "binding.channelSettingsEditTopic");
|
|
statefulViews2.setupTextWatcherWithSaveAction(this, floatingActionButton, textInputLayout2, textInputLayout3);
|
|
SeekBar seekBar = getBinding().f1986s;
|
|
m.checkNotNullExpressionValue(seekBar, "binding.channelSettingsSlowModeCooldownSlider");
|
|
seekBar.setMax(n.getLastIndex(SLOWMODE_COOLDOWN_VALUES));
|
|
getBinding().f1986s.setOnSeekBarChangeListener(new WidgetTextChannelSettings$onViewBound$1(this));
|
|
SeekBar seekBar2 = getBinding().d;
|
|
m.checkNotNullExpressionValue(seekBar2, "binding.channelSettingsD…AutoArchiveDurationSlider");
|
|
seekBar2.setMax(n.getLastIndex(ThreadUtils.INSTANCE.getTHREAD_AUTO_ARCHIVE_DURATIONS()));
|
|
getBinding().d.setOnSeekBarChangeListener(new WidgetTextChannelSettings$onViewBound$2(this));
|
|
TextInputLayout textInputLayout4 = getBinding().f;
|
|
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("com.discord.intent.extra.EXTRA_CHANNEL_ID", -1)), this, null, 2, null), WidgetTextChannelSettings.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetTextChannelSettings$onViewBoundOrOnResume$1(this), 62, (Object) null);
|
|
}
|
|
}
|