2021-08-03 07:33:18 +00:00
|
|
|
package com.discord.widgets.guilds.invite;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.util.AttributeSet;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.ArrayAdapter;
|
|
|
|
import android.widget.RadioButton;
|
|
|
|
import android.widget.RadioGroup;
|
|
|
|
import android.widget.Spinner;
|
|
|
|
import android.widget.SpinnerAdapter;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import androidx.annotation.MainThread;
|
|
|
|
import androidx.core.widget.NestedScrollView;
|
2021-12-17 21:59:34 +00:00
|
|
|
import b.a.i.z2;
|
|
|
|
import b.a.k.b;
|
2021-08-09 22:51:56 +00:00
|
|
|
import com.discord.R;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.api.channel.Channel;
|
2021-10-08 22:11:56 +00:00
|
|
|
import com.discord.api.channel.ChannelUtils;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.databinding.ViewGuildInviteBottomSheetBinding;
|
|
|
|
import com.discord.models.domain.ModelInvite;
|
|
|
|
import com.discord.utilities.dimen.DimenUtils;
|
2021-09-23 06:25:23 +00:00
|
|
|
import com.discord.utilities.resources.DurationUtilsKt;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.views.CheckedSetting;
|
2021-11-02 06:38:17 +00:00
|
|
|
import d0.d0.f;
|
|
|
|
import d0.t.c0;
|
|
|
|
import d0.z.d.k;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import d0.z.d.o;
|
2021-08-03 07:33:18 +00:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.Objects;
|
|
|
|
import kotlin.Unit;
|
|
|
|
import kotlin.jvm.functions.Function0;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
import kotlin.ranges.IntRange;
|
|
|
|
/* compiled from: ViewInviteSettingsSheet.kt */
|
|
|
|
public final class ViewInviteSettingsSheet extends NestedScrollView {
|
|
|
|
private final ViewGuildInviteBottomSheetBinding binding;
|
|
|
|
private final ChannelsSpinnerAdapter channelsSpinnerAdapter;
|
|
|
|
private Function0<Unit> onGenerateLinkListener = ViewInviteSettingsSheet$onGenerateLinkListener$1.INSTANCE;
|
|
|
|
private ModelInvite.Settings pendingInviteSettings;
|
|
|
|
private Function1<? super ModelInvite.Settings, Unit> updateSettings = ViewInviteSettingsSheet$updateSettings$1.INSTANCE;
|
|
|
|
public WidgetGuildInviteShareViewModel viewModel;
|
|
|
|
|
|
|
|
/* compiled from: ViewInviteSettingsSheet.kt */
|
|
|
|
/* renamed from: com.discord.widgets.guilds.invite.ViewInviteSettingsSheet$1 reason: invalid class name */
|
2021-09-23 06:25:23 +00:00
|
|
|
public static final class AnonymousClass1 extends o implements Function1<Integer, CharSequence> {
|
|
|
|
public final /* synthetic */ ViewInviteSettingsSheet this$0;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
2021-08-03 07:33:18 +00:00
|
|
|
public AnonymousClass1(ViewInviteSettingsSheet viewInviteSettingsSheet) {
|
2021-09-23 06:25:23 +00:00
|
|
|
super(1);
|
|
|
|
this.this$0 = viewInviteSettingsSheet;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final CharSequence invoke(int i) {
|
2021-09-23 06:25:23 +00:00
|
|
|
Context context = this.this$0.getContext();
|
|
|
|
m.checkNotNullExpressionValue(context, "context");
|
|
|
|
return DurationUtilsKt.formatInviteExpireAfterString(context, i);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 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 /* bridge */ /* synthetic */ CharSequence invoke(Integer num) {
|
|
|
|
return invoke(num.intValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: ViewInviteSettingsSheet.kt */
|
|
|
|
/* renamed from: com.discord.widgets.guilds.invite.ViewInviteSettingsSheet$2 reason: invalid class name */
|
|
|
|
public static final /* synthetic */ class AnonymousClass2 extends k implements Function1<Integer, String> {
|
|
|
|
public AnonymousClass2(ViewInviteSettingsSheet viewInviteSettingsSheet) {
|
|
|
|
super(1, viewInviteSettingsSheet, ViewInviteSettingsSheet.class, "getMaxUsesString", "getMaxUsesString(I)Ljava/lang/String;", 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 /* bridge */ /* synthetic */ String invoke(Integer num) {
|
|
|
|
return invoke(num.intValue());
|
|
|
|
}
|
|
|
|
|
|
|
|
public final String invoke(int i) {
|
|
|
|
return ViewInviteSettingsSheet.access$getMaxUsesString((ViewInviteSettingsSheet) this.receiver, i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: ViewInviteSettingsSheet.kt */
|
|
|
|
public static final class ChannelsSpinnerAdapter extends ArrayAdapter<Channel> {
|
|
|
|
private Channel[] channels;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public ChannelsSpinnerAdapter(Context context, int i, Channel[] channelArr) {
|
|
|
|
super(context, i, channelArr);
|
|
|
|
m.checkNotNullParameter(context, "context");
|
|
|
|
m.checkNotNullParameter(channelArr, "channels");
|
|
|
|
this.channels = channelArr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
|
|
public /* synthetic */ ChannelsSpinnerAdapter(Context context, int i, Channel[] channelArr, int i2, DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this(context, i, (i2 & 4) != 0 ? new Channel[0] : channelArr);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final View getItemView(int i, int i2, View view, boolean z2) {
|
|
|
|
if (view == null) {
|
|
|
|
view = View.inflate(getContext(), i2, null);
|
|
|
|
}
|
|
|
|
m.checkNotNullExpressionValue(view, "view");
|
|
|
|
setupViews(view, i, z2);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void setupViews(View view, int i, boolean z2) {
|
2021-11-02 06:38:17 +00:00
|
|
|
TextView textView = (TextView) view.findViewById(new ViewInviteSettingsSheet$ChannelsSpinnerAdapter$setupViews$1(z2).mo1invoke());
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(textView, "label");
|
2021-10-08 22:11:56 +00:00
|
|
|
String format = String.format("#%s", Arrays.copyOf(new Object[]{ChannelUtils.c(this.channels[i])}, 1));
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
|
|
|
|
textView.setText(format);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // android.widget.ArrayAdapter, android.widget.Adapter
|
|
|
|
public int getCount() {
|
|
|
|
return this.channels.length;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // android.widget.ArrayAdapter, android.widget.SpinnerAdapter, android.widget.BaseAdapter
|
|
|
|
public View getDropDownView(int i, View view, ViewGroup viewGroup) {
|
|
|
|
m.checkNotNullParameter(viewGroup, "parent");
|
2021-08-09 22:51:56 +00:00
|
|
|
return getItemView(i, R.layout.view_invite_settngs_channel_spinner_item_open, view, true);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // android.widget.ArrayAdapter, android.widget.Adapter
|
|
|
|
public Channel getItem(int i) {
|
|
|
|
return this.channels[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // android.widget.ArrayAdapter, android.widget.Adapter
|
|
|
|
public View getView(int i, View view, ViewGroup viewGroup) {
|
|
|
|
m.checkNotNullParameter(viewGroup, "parent");
|
2021-08-09 22:51:56 +00:00
|
|
|
return getItemView(i, R.layout.view_invite_settings_channel_spinner_item, view, false);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final void setData(Channel[] channelArr) {
|
|
|
|
m.checkNotNullParameter(channelArr, "newData");
|
|
|
|
this.channels = channelArr;
|
|
|
|
notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public ViewInviteSettingsSheet(Context context) {
|
|
|
|
super(context);
|
|
|
|
m.checkNotNullParameter(context, "ctx");
|
|
|
|
ViewGuildInviteBottomSheetBinding a = ViewGuildInviteBottomSheetBinding.a(LayoutInflater.from(getContext()), this);
|
|
|
|
m.checkNotNullExpressionValue(a, "ViewGuildInviteBottomShe…ater.from(context), this)");
|
|
|
|
this.binding = a;
|
|
|
|
Context context2 = getContext();
|
|
|
|
m.checkNotNullExpressionValue(context2, "context");
|
2021-08-09 22:51:56 +00:00
|
|
|
ChannelsSpinnerAdapter channelsSpinnerAdapter = new ChannelsSpinnerAdapter(context2, R.layout.view_invite_settings_channel_spinner_item, null, 4, null);
|
2021-08-03 07:33:18 +00:00
|
|
|
this.channelsSpinnerAdapter = channelsSpinnerAdapter;
|
|
|
|
setFocusable(true);
|
2021-08-09 22:51:56 +00:00
|
|
|
setContentDescription(b.j(this, R.string.invite_settings_title, new Object[0], null, 4));
|
2021-12-20 07:27:17 +00:00
|
|
|
Spinner spinner = a.f2160b;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(spinner, "binding.guildInviteChannelSpinner");
|
|
|
|
spinner.setAdapter((SpinnerAdapter) channelsSpinnerAdapter);
|
2021-12-17 21:59:34 +00:00
|
|
|
RadioGroup radioGroup = a.c;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(radioGroup, "binding.guildInviteExpiresAfterRadiogroup");
|
|
|
|
int[] iArr = ModelInvite.Settings.EXPIRES_AFTER_ARRAY;
|
|
|
|
m.checkNotNullExpressionValue(iArr, "ModelInvite.Settings.EXPIRES_AFTER_ARRAY");
|
|
|
|
createHorizontalCheckableButtons(radioGroup, iArr, new AnonymousClass1(this));
|
|
|
|
RadioGroup radioGroup2 = a.e;
|
|
|
|
m.checkNotNullExpressionValue(radioGroup2, "binding.guildInviteMaxUsesRadiogroup");
|
|
|
|
int[] iArr2 = ModelInvite.Settings.MAX_USES_ARRAY;
|
|
|
|
m.checkNotNullExpressionValue(iArr2, "ModelInvite.Settings.MAX_USES_ARRAY");
|
|
|
|
createHorizontalCheckableButtons(radioGroup2, iArr2, new AnonymousClass2(this));
|
|
|
|
setOnItemSelected();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public ViewInviteSettingsSheet(Context context, AttributeSet attributeSet) {
|
|
|
|
super(context, attributeSet);
|
|
|
|
m.checkNotNullParameter(context, "ctx");
|
|
|
|
m.checkNotNullParameter(attributeSet, "attrSet");
|
|
|
|
ViewGuildInviteBottomSheetBinding a = ViewGuildInviteBottomSheetBinding.a(LayoutInflater.from(getContext()), this);
|
|
|
|
m.checkNotNullExpressionValue(a, "ViewGuildInviteBottomShe…ater.from(context), this)");
|
|
|
|
this.binding = a;
|
|
|
|
Context context2 = getContext();
|
|
|
|
m.checkNotNullExpressionValue(context2, "context");
|
2021-08-09 22:51:56 +00:00
|
|
|
ChannelsSpinnerAdapter channelsSpinnerAdapter = new ChannelsSpinnerAdapter(context2, R.layout.view_invite_settings_channel_spinner_item, null, 4, null);
|
2021-08-03 07:33:18 +00:00
|
|
|
this.channelsSpinnerAdapter = channelsSpinnerAdapter;
|
|
|
|
setFocusable(true);
|
2021-08-09 22:51:56 +00:00
|
|
|
setContentDescription(b.j(this, R.string.invite_settings_title, new Object[0], null, 4));
|
2021-12-20 07:27:17 +00:00
|
|
|
Spinner spinner = a.f2160b;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(spinner, "binding.guildInviteChannelSpinner");
|
|
|
|
spinner.setAdapter((SpinnerAdapter) channelsSpinnerAdapter);
|
2021-12-17 21:59:34 +00:00
|
|
|
RadioGroup radioGroup = a.c;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(radioGroup, "binding.guildInviteExpiresAfterRadiogroup");
|
|
|
|
int[] iArr = ModelInvite.Settings.EXPIRES_AFTER_ARRAY;
|
|
|
|
m.checkNotNullExpressionValue(iArr, "ModelInvite.Settings.EXPIRES_AFTER_ARRAY");
|
|
|
|
createHorizontalCheckableButtons(radioGroup, iArr, new AnonymousClass1(this));
|
|
|
|
RadioGroup radioGroup2 = a.e;
|
|
|
|
m.checkNotNullExpressionValue(radioGroup2, "binding.guildInviteMaxUsesRadiogroup");
|
|
|
|
int[] iArr2 = ModelInvite.Settings.MAX_USES_ARRAY;
|
|
|
|
m.checkNotNullExpressionValue(iArr2, "ModelInvite.Settings.MAX_USES_ARRAY");
|
|
|
|
createHorizontalCheckableButtons(radioGroup2, iArr2, new AnonymousClass2(this));
|
|
|
|
setOnItemSelected();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public ViewInviteSettingsSheet(Context context, AttributeSet attributeSet, int i) {
|
|
|
|
super(context, attributeSet, i);
|
|
|
|
m.checkNotNullParameter(context, "ctx");
|
|
|
|
m.checkNotNullParameter(attributeSet, "attrSet");
|
|
|
|
ViewGuildInviteBottomSheetBinding a = ViewGuildInviteBottomSheetBinding.a(LayoutInflater.from(getContext()), this);
|
|
|
|
m.checkNotNullExpressionValue(a, "ViewGuildInviteBottomShe…ater.from(context), this)");
|
|
|
|
this.binding = a;
|
|
|
|
Context context2 = getContext();
|
|
|
|
m.checkNotNullExpressionValue(context2, "context");
|
2021-08-09 22:51:56 +00:00
|
|
|
ChannelsSpinnerAdapter channelsSpinnerAdapter = new ChannelsSpinnerAdapter(context2, R.layout.view_invite_settings_channel_spinner_item, null, 4, null);
|
2021-08-03 07:33:18 +00:00
|
|
|
this.channelsSpinnerAdapter = channelsSpinnerAdapter;
|
|
|
|
setFocusable(true);
|
2021-08-09 22:51:56 +00:00
|
|
|
setContentDescription(b.j(this, R.string.invite_settings_title, new Object[0], null, 4));
|
2021-12-20 07:27:17 +00:00
|
|
|
Spinner spinner = a.f2160b;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(spinner, "binding.guildInviteChannelSpinner");
|
|
|
|
spinner.setAdapter((SpinnerAdapter) channelsSpinnerAdapter);
|
2021-12-17 21:59:34 +00:00
|
|
|
RadioGroup radioGroup = a.c;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(radioGroup, "binding.guildInviteExpiresAfterRadiogroup");
|
|
|
|
int[] iArr = ModelInvite.Settings.EXPIRES_AFTER_ARRAY;
|
|
|
|
m.checkNotNullExpressionValue(iArr, "ModelInvite.Settings.EXPIRES_AFTER_ARRAY");
|
|
|
|
createHorizontalCheckableButtons(radioGroup, iArr, new AnonymousClass1(this));
|
|
|
|
RadioGroup radioGroup2 = a.e;
|
|
|
|
m.checkNotNullExpressionValue(radioGroup2, "binding.guildInviteMaxUsesRadiogroup");
|
|
|
|
int[] iArr2 = ModelInvite.Settings.MAX_USES_ARRAY;
|
|
|
|
m.checkNotNullExpressionValue(iArr2, "ModelInvite.Settings.MAX_USES_ARRAY");
|
|
|
|
createHorizontalCheckableButtons(radioGroup2, iArr2, new AnonymousClass2(this));
|
|
|
|
setOnItemSelected();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ ViewGuildInviteBottomSheetBinding access$getBinding$p(ViewInviteSettingsSheet viewInviteSettingsSheet) {
|
|
|
|
return viewInviteSettingsSheet.binding;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ ChannelsSpinnerAdapter access$getChannelsSpinnerAdapter$p(ViewInviteSettingsSheet viewInviteSettingsSheet) {
|
|
|
|
return viewInviteSettingsSheet.channelsSpinnerAdapter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ String access$getMaxUsesString(ViewInviteSettingsSheet viewInviteSettingsSheet, int i) {
|
|
|
|
return viewInviteSettingsSheet.getMaxUsesString(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ ModelInvite.Settings access$getPendingInviteSettings$p(ViewInviteSettingsSheet viewInviteSettingsSheet) {
|
|
|
|
return viewInviteSettingsSheet.pendingInviteSettings;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$setPendingInviteSettings$p(ViewInviteSettingsSheet viewInviteSettingsSheet, ModelInvite.Settings settings) {
|
|
|
|
viewInviteSettingsSheet.pendingInviteSettings = settings;
|
|
|
|
}
|
|
|
|
|
|
|
|
@MainThread
|
|
|
|
private final void createHorizontalCheckableButtons(RadioGroup radioGroup, int[] iArr, Function1<? super Integer, ? extends CharSequence> function1) {
|
|
|
|
if (radioGroup.getChildCount() <= 0) {
|
|
|
|
boolean z2 = false;
|
|
|
|
for (int i : iArr) {
|
2021-08-09 22:51:56 +00:00
|
|
|
View inflate = LayoutInflater.from(getContext()).inflate(R.layout.view_radio_button, (ViewGroup) radioGroup, false);
|
2021-08-03 07:33:18 +00:00
|
|
|
Objects.requireNonNull(inflate, "rootView");
|
|
|
|
RadioButton radioButton = (RadioButton) inflate;
|
2021-11-20 07:11:29 +00:00
|
|
|
m.checkNotNullExpressionValue(new z2(radioButton), "ViewRadioButtonBinding.i…text), radioGroup, false)");
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(radioButton, "binding.root");
|
|
|
|
radioButton.setId(i);
|
|
|
|
m.checkNotNullExpressionValue(radioButton, "binding.root");
|
|
|
|
radioButton.setText((CharSequence) function1.invoke(Integer.valueOf(i)));
|
|
|
|
if (!z2) {
|
|
|
|
m.checkNotNullExpressionValue(radioButton, "binding.root");
|
|
|
|
ViewGroup.LayoutParams layoutParams = radioButton.getLayoutParams();
|
|
|
|
Objects.requireNonNull(layoutParams, "null cannot be cast to non-null type android.widget.RadioGroup.LayoutParams");
|
|
|
|
RadioGroup.LayoutParams layoutParams2 = (RadioGroup.LayoutParams) layoutParams;
|
|
|
|
layoutParams2.leftMargin = DimenUtils.dpToPixels(16);
|
|
|
|
m.checkNotNullExpressionValue(radioButton, "binding.root");
|
|
|
|
radioButton.setLayoutParams(layoutParams2);
|
|
|
|
z2 = true;
|
|
|
|
}
|
|
|
|
radioGroup.addView(radioButton);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private final String getMaxUsesString(int i) {
|
|
|
|
return i != 0 ? String.valueOf(i) : "∞";
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void setOnItemSelected() {
|
2021-12-20 07:27:17 +00:00
|
|
|
Spinner spinner = this.binding.f2160b;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(spinner, "binding.guildInviteChannelSpinner");
|
|
|
|
spinner.setOnItemSelectedListener(new ViewInviteSettingsSheet$setOnItemSelected$1(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void configureUi(WidgetInviteModel widgetInviteModel) {
|
|
|
|
Object obj;
|
|
|
|
Object obj2;
|
|
|
|
boolean z2;
|
|
|
|
boolean z3;
|
|
|
|
m.checkNotNullParameter(widgetInviteModel, "data");
|
|
|
|
ChannelsSpinnerAdapter channelsSpinnerAdapter = this.channelsSpinnerAdapter;
|
|
|
|
boolean z4 = false;
|
|
|
|
Object[] array = widgetInviteModel.getInvitableChannels().toArray(new Channel[0]);
|
|
|
|
Objects.requireNonNull(array, "null cannot be cast to non-null type kotlin.Array<T>");
|
|
|
|
channelsSpinnerAdapter.setData((Channel[]) array);
|
|
|
|
Iterator<Channel> it = widgetInviteModel.getInvitableChannels().iterator();
|
|
|
|
int i = 0;
|
|
|
|
while (true) {
|
|
|
|
if (!it.hasNext()) {
|
|
|
|
i = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
Channel next = it.next();
|
|
|
|
Channel targetChannel = widgetInviteModel.getTargetChannel();
|
|
|
|
if (targetChannel != null && targetChannel.h() == next.h()) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
2021-12-20 07:27:17 +00:00
|
|
|
this.binding.f2160b.setSelection(Math.max(i, 0), false);
|
2021-08-03 07:33:18 +00:00
|
|
|
ModelInvite.Settings settings = widgetInviteModel.getSettings();
|
|
|
|
if (settings != null) {
|
|
|
|
this.pendingInviteSettings = settings;
|
2021-12-17 21:59:34 +00:00
|
|
|
RadioGroup radioGroup = this.binding.c;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(radioGroup, "binding.guildInviteExpiresAfterRadiogroup");
|
|
|
|
IntRange until = f.until(0, radioGroup.getChildCount());
|
2021-11-02 06:38:17 +00:00
|
|
|
ArrayList arrayList = new ArrayList(d0.t.o.collectionSizeOrDefault(until, 10));
|
2021-08-03 07:33:18 +00:00
|
|
|
Iterator<Integer> it2 = until.iterator();
|
|
|
|
while (it2.hasNext()) {
|
2021-12-17 21:59:34 +00:00
|
|
|
View childAt = this.binding.c.getChildAt(((c0) it2).nextInt());
|
2021-08-03 07:33:18 +00:00
|
|
|
Objects.requireNonNull(childAt, "null cannot be cast to non-null type android.widget.RadioButton");
|
|
|
|
arrayList.add((RadioButton) childAt);
|
|
|
|
}
|
|
|
|
Iterator it3 = arrayList.iterator();
|
|
|
|
while (true) {
|
|
|
|
obj = null;
|
|
|
|
if (!it3.hasNext()) {
|
|
|
|
obj2 = null;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
obj2 = it3.next();
|
|
|
|
int id2 = ((RadioButton) obj2).getId();
|
|
|
|
ModelInvite.Settings settings2 = this.pendingInviteSettings;
|
|
|
|
if (settings2 == null || id2 != settings2.getMaxAge()) {
|
|
|
|
z3 = false;
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
z3 = true;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (z3) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RadioButton radioButton = (RadioButton) obj2;
|
|
|
|
if (radioButton != null) {
|
|
|
|
radioButton.setChecked(true);
|
|
|
|
}
|
2021-12-17 21:59:34 +00:00
|
|
|
this.binding.c.setOnCheckedChangeListener(new ViewInviteSettingsSheet$configureUi$4(this));
|
2021-08-03 07:33:18 +00:00
|
|
|
RadioGroup radioGroup2 = this.binding.e;
|
|
|
|
m.checkNotNullExpressionValue(radioGroup2, "binding.guildInviteMaxUsesRadiogroup");
|
|
|
|
IntRange until2 = f.until(0, radioGroup2.getChildCount());
|
2021-11-02 06:38:17 +00:00
|
|
|
ArrayList arrayList2 = new ArrayList(d0.t.o.collectionSizeOrDefault(until2, 10));
|
2021-08-03 07:33:18 +00:00
|
|
|
Iterator<Integer> it4 = until2.iterator();
|
|
|
|
while (it4.hasNext()) {
|
|
|
|
View childAt2 = this.binding.e.getChildAt(((c0) it4).nextInt());
|
|
|
|
Objects.requireNonNull(childAt2, "null cannot be cast to non-null type android.widget.RadioButton");
|
|
|
|
arrayList2.add((RadioButton) childAt2);
|
|
|
|
}
|
|
|
|
Iterator it5 = arrayList2.iterator();
|
|
|
|
while (true) {
|
|
|
|
if (!it5.hasNext()) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
Object next2 = it5.next();
|
|
|
|
int id3 = ((RadioButton) next2).getId();
|
|
|
|
ModelInvite.Settings settings3 = this.pendingInviteSettings;
|
|
|
|
if (settings3 == null || id3 != settings3.getMaxUses()) {
|
|
|
|
z2 = false;
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
z2 = true;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (z2) {
|
|
|
|
obj = next2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RadioButton radioButton2 = (RadioButton) obj;
|
|
|
|
if (radioButton2 != null) {
|
|
|
|
radioButton2.setChecked(true);
|
|
|
|
}
|
|
|
|
this.binding.e.setOnCheckedChangeListener(new ViewInviteSettingsSheet$configureUi$8(this));
|
|
|
|
CheckedSetting checkedSetting = this.binding.f;
|
|
|
|
m.checkNotNullExpressionValue(checkedSetting, "binding.guildInviteTemporaryMembership");
|
|
|
|
ModelInvite.Settings settings4 = this.pendingInviteSettings;
|
|
|
|
if (settings4 != null) {
|
|
|
|
z4 = settings4.isTemporary();
|
|
|
|
}
|
|
|
|
checkedSetting.setChecked(z4);
|
|
|
|
this.binding.f.e(new ViewInviteSettingsSheet$configureUi$9(this));
|
|
|
|
this.binding.d.setOnClickListener(new ViewInviteSettingsSheet$configureUi$10(this, widgetInviteModel));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Function0<Unit> getOnGenerateLinkListener() {
|
|
|
|
return this.onGenerateLinkListener;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final WidgetGuildInviteShareViewModel getViewModel() {
|
|
|
|
WidgetGuildInviteShareViewModel widgetGuildInviteShareViewModel = this.viewModel;
|
|
|
|
if (widgetGuildInviteShareViewModel == null) {
|
|
|
|
m.throwUninitializedPropertyAccessException("viewModel");
|
|
|
|
}
|
|
|
|
return widgetGuildInviteShareViewModel;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void setOnGenerateLinkListener(Function0<Unit> function0) {
|
|
|
|
m.checkNotNullParameter(function0, "<set-?>");
|
|
|
|
this.onGenerateLinkListener = function0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void setViewModel(WidgetGuildInviteShareViewModel widgetGuildInviteShareViewModel) {
|
|
|
|
m.checkNotNullParameter(widgetGuildInviteShareViewModel, "<set-?>");
|
|
|
|
this.viewModel = widgetGuildInviteShareViewModel;
|
|
|
|
}
|
|
|
|
}
|