2021-08-03 07:33:18 +00:00
|
|
|
package com.discord.widgets.guilds.invite;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
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.activity.result.ActivityResultLauncher;
|
|
|
|
import androidx.activity.result.contract.ActivityResultContracts;
|
|
|
|
import androidx.annotation.MainThread;
|
|
|
|
import androidx.appcompat.widget.AppCompatRadioButton;
|
|
|
|
import androidx.fragment.app.DialogFragment;
|
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
|
import androidx.fragment.app.FragmentViewModelLazyKt;
|
2021-08-13 06:23:11 +00:00
|
|
|
import c.a.d.f0;
|
2021-08-11 06:37:47 +00:00
|
|
|
import c.a.d.h0;
|
2021-08-13 06:23:11 +00:00
|
|
|
import c.a.d.j;
|
2021-08-20 05:39:29 +00:00
|
|
|
import c.a.i.x;
|
2021-08-03 07:33:18 +00:00
|
|
|
import c.d.b.a.a;
|
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.app.AppFragment;
|
2021-09-30 06:24:59 +00:00
|
|
|
import com.discord.app.LoggingConfig;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.databinding.WidgetGuildInviteSettingsBinding;
|
|
|
|
import com.discord.models.domain.ModelInvite;
|
|
|
|
import com.discord.utilities.analytics.AnalyticsTracker;
|
|
|
|
import com.discord.utilities.dimen.DimenUtils;
|
|
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
|
|
import com.discord.views.CheckedSetting;
|
|
|
|
import com.discord.widgets.guilds.invite.GuildInviteSettingsViewModel;
|
2021-11-02 06:38:17 +00:00
|
|
|
import d0.d0.f;
|
|
|
|
import d0.t.c0;
|
|
|
|
import d0.t.o;
|
|
|
|
import d0.z.d.a0;
|
|
|
|
import d0.z.d.m;
|
2021-08-03 07:33:18 +00:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Objects;
|
|
|
|
import kotlin.Lazy;
|
|
|
|
import kotlin.Unit;
|
|
|
|
import kotlin.jvm.functions.Function0;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
import kotlin.ranges.IntRange;
|
|
|
|
import kotlin.reflect.KProperty;
|
|
|
|
import rx.Observable;
|
|
|
|
/* compiled from: WidgetGuildInviteSettings.kt */
|
|
|
|
public final class WidgetGuildInviteSettings extends AppFragment {
|
2021-10-09 06:29:02 +00:00
|
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.Z(WidgetGuildInviteSettings.class, "binding", "getBinding()Lcom/discord/databinding/WidgetGuildInviteSettingsBinding;", 0)};
|
2021-08-03 07:33:18 +00:00
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
private static final String EXTRA_CREATED_INVITE = "EXTRA_CREATED_INVITE";
|
|
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetGuildInviteSettings$binding$2.INSTANCE, null, 2, null);
|
|
|
|
private ChannelsSpinnerAdapter channelsSpinnerAdapter;
|
2021-09-30 06:24:59 +00:00
|
|
|
private final LoggingConfig loggingConfig;
|
2021-08-03 07:33:18 +00:00
|
|
|
private final Lazy viewModel$delegate;
|
|
|
|
|
|
|
|
/* compiled from: WidgetGuildInviteSettings.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 WidgetGuildInviteSettings$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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: WidgetGuildInviteSettings.kt */
|
|
|
|
public static final class Companion {
|
|
|
|
private Companion() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void launch(Context context, ActivityResultLauncher<Intent> activityResultLauncher, Long l, long j, String str) {
|
|
|
|
m.checkNotNullParameter(context, "context");
|
|
|
|
m.checkNotNullParameter(activityResultLauncher, "launcher");
|
|
|
|
m.checkNotNullParameter(str, "source");
|
|
|
|
AnalyticsTracker.openModal$default("Link Settings", str, null, 4, null);
|
|
|
|
Intent intent = new Intent();
|
|
|
|
if (l != null) {
|
|
|
|
intent.putExtra("com.discord.intent.extra.EXTRA_CHANNEL_ID", l.longValue());
|
|
|
|
}
|
|
|
|
intent.putExtra("com.discord.intent.extra.EXTRA_GUILD_ID", j);
|
2021-08-13 06:23:11 +00:00
|
|
|
j.g.f(context, activityResultLauncher, WidgetGuildInviteSettings.class, intent);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final ActivityResultLauncher<Intent> registerForResult(DialogFragment dialogFragment, Function1<? super GuildInvite, Unit> function1) {
|
|
|
|
m.checkNotNullParameter(dialogFragment, "fragment");
|
|
|
|
m.checkNotNullParameter(function1, "callback");
|
|
|
|
ActivityResultLauncher<Intent> registerForActivityResult = dialogFragment.registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new WidgetGuildInviteSettings$Companion$registerForResult$1(function1));
|
|
|
|
m.checkNotNullExpressionValue(registerForActivityResult, "fragment.registerForActi… }\n }\n }");
|
|
|
|
return registerForActivityResult;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public WidgetGuildInviteSettings() {
|
2021-08-09 22:51:56 +00:00
|
|
|
super(R.layout.widget_guild_invite_settings);
|
2021-08-03 07:33:18 +00:00
|
|
|
WidgetGuildInviteSettings$viewModel$2 widgetGuildInviteSettings$viewModel$2 = new WidgetGuildInviteSettings$viewModel$2(this);
|
2021-08-13 06:23:11 +00:00
|
|
|
f0 f0Var = new f0(this);
|
|
|
|
this.viewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(GuildInviteSettingsViewModel.class), new WidgetGuildInviteSettings$appViewModels$$inlined$viewModels$1(f0Var), new h0(widgetGuildInviteSettings$viewModel$2));
|
2021-09-30 06:24:59 +00:00
|
|
|
this.loggingConfig = new LoggingConfig(false, null, WidgetGuildInviteSettings$loggingConfig$1.INSTANCE, 3);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ WidgetGuildInviteSettingsBinding access$getBinding$p(WidgetGuildInviteSettings widgetGuildInviteSettings) {
|
|
|
|
return widgetGuildInviteSettings.getBinding();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ ChannelsSpinnerAdapter access$getChannelsSpinnerAdapter$p(WidgetGuildInviteSettings widgetGuildInviteSettings) {
|
|
|
|
ChannelsSpinnerAdapter channelsSpinnerAdapter = widgetGuildInviteSettings.channelsSpinnerAdapter;
|
|
|
|
if (channelsSpinnerAdapter == null) {
|
|
|
|
m.throwUninitializedPropertyAccessException("channelsSpinnerAdapter");
|
|
|
|
}
|
|
|
|
return channelsSpinnerAdapter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ String access$getMaxUsesString(WidgetGuildInviteSettings widgetGuildInviteSettings, int i) {
|
|
|
|
return widgetGuildInviteSettings.getMaxUsesString(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ GuildInviteSettingsViewModel access$getViewModel$p(WidgetGuildInviteSettings widgetGuildInviteSettings) {
|
|
|
|
return widgetGuildInviteSettings.getViewModel();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$setChannelsSpinnerAdapter$p(WidgetGuildInviteSettings widgetGuildInviteSettings, ChannelsSpinnerAdapter channelsSpinnerAdapter) {
|
|
|
|
widgetGuildInviteSettings.channelsSpinnerAdapter = channelsSpinnerAdapter;
|
|
|
|
}
|
|
|
|
|
|
|
|
@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.invite_settings_radio_button, (ViewGroup) radioGroup, false);
|
2021-08-03 07:33:18 +00:00
|
|
|
Objects.requireNonNull(inflate, "rootView");
|
|
|
|
AppCompatRadioButton appCompatRadioButton = (AppCompatRadioButton) inflate;
|
2021-08-20 05:39:29 +00:00
|
|
|
m.checkNotNullExpressionValue(new x(appCompatRadioButton), "InviteSettingsRadioButto…text), radioGroup, false)");
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(appCompatRadioButton, "binding.root");
|
|
|
|
appCompatRadioButton.setId(i);
|
|
|
|
m.checkNotNullExpressionValue(appCompatRadioButton, "binding.root");
|
|
|
|
appCompatRadioButton.setText((CharSequence) function1.invoke(Integer.valueOf(i)));
|
|
|
|
if (!z2) {
|
|
|
|
m.checkNotNullExpressionValue(appCompatRadioButton, "binding.root");
|
|
|
|
ViewGroup.LayoutParams layoutParams = appCompatRadioButton.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(appCompatRadioButton, "binding.root");
|
|
|
|
appCompatRadioButton.setLayoutParams(layoutParams2);
|
|
|
|
z2 = true;
|
|
|
|
}
|
|
|
|
radioGroup.addView(appCompatRadioButton);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private final WidgetGuildInviteSettingsBinding getBinding() {
|
|
|
|
return (WidgetGuildInviteSettingsBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final String getMaxUsesString(int i) {
|
|
|
|
return i != 0 ? String.valueOf(i) : "∞";
|
|
|
|
}
|
|
|
|
|
|
|
|
private final GuildInviteSettingsViewModel getViewModel() {
|
|
|
|
return (GuildInviteSettingsViewModel) this.viewModel$delegate.getValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void setOnItemSelected() {
|
|
|
|
Spinner spinner = getBinding().b;
|
|
|
|
m.checkNotNullExpressionValue(spinner, "binding.guildInviteChannelSpinner");
|
|
|
|
spinner.setOnItemSelectedListener(new WidgetGuildInviteSettings$setOnItemSelected$1(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void configureUi(GuildInviteSettingsViewModel.ViewState viewState) {
|
|
|
|
Object obj;
|
|
|
|
Object obj2;
|
|
|
|
boolean z2;
|
|
|
|
boolean z3;
|
|
|
|
m.checkNotNullParameter(viewState, "viewState");
|
|
|
|
List<Channel> invitableChannels = viewState.getInvitableChannels();
|
|
|
|
ChannelsSpinnerAdapter channelsSpinnerAdapter = this.channelsSpinnerAdapter;
|
|
|
|
if (channelsSpinnerAdapter == null) {
|
|
|
|
m.throwUninitializedPropertyAccessException("channelsSpinnerAdapter");
|
|
|
|
}
|
|
|
|
Object[] array = invitableChannels.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 = invitableChannels.iterator();
|
|
|
|
int i = 0;
|
|
|
|
while (true) {
|
|
|
|
if (!it.hasNext()) {
|
|
|
|
i = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
Channel next = it.next();
|
|
|
|
Channel targetChannel = viewState.getTargetChannel();
|
|
|
|
if (targetChannel != null && targetChannel.h() == next.h()) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
getBinding().b.setSelection(Math.max(i, 0), false);
|
|
|
|
ModelInvite.Settings inviteSettings = viewState.getInviteSettings();
|
2021-11-02 06:38:17 +00:00
|
|
|
RadioGroup radioGroup = getBinding().f1852c;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(radioGroup, "binding.guildInviteExpiresAfterRadiogroup");
|
|
|
|
IntRange until = f.until(0, radioGroup.getChildCount());
|
|
|
|
ArrayList arrayList = new ArrayList(o.collectionSizeOrDefault(until, 10));
|
|
|
|
Iterator<Integer> it2 = until.iterator();
|
|
|
|
while (it2.hasNext()) {
|
2021-11-02 06:38:17 +00:00
|
|
|
View childAt = getBinding().f1852c.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();
|
|
|
|
if (((RadioButton) obj2).getId() == inviteSettings.getMaxAge()) {
|
|
|
|
z3 = true;
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
z3 = false;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (z3) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RadioButton radioButton = (RadioButton) obj2;
|
|
|
|
if (radioButton != null) {
|
|
|
|
radioButton.setChecked(true);
|
|
|
|
}
|
2021-11-02 06:38:17 +00:00
|
|
|
getBinding().f1852c.setOnCheckedChangeListener(new WidgetGuildInviteSettings$configureUi$4(this, inviteSettings));
|
2021-08-03 07:33:18 +00:00
|
|
|
RadioGroup radioGroup2 = getBinding().e;
|
|
|
|
m.checkNotNullExpressionValue(radioGroup2, "binding.guildInviteMaxUsesRadiogroup");
|
|
|
|
IntRange until2 = f.until(0, radioGroup2.getChildCount());
|
|
|
|
ArrayList arrayList2 = new ArrayList(o.collectionSizeOrDefault(until2, 10));
|
|
|
|
Iterator<Integer> it4 = until2.iterator();
|
|
|
|
while (it4.hasNext()) {
|
|
|
|
View childAt2 = getBinding().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();
|
|
|
|
if (((RadioButton) next2).getId() == inviteSettings.getMaxUses()) {
|
|
|
|
z2 = true;
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
z2 = false;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (z2) {
|
|
|
|
obj = next2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RadioButton radioButton2 = (RadioButton) obj;
|
|
|
|
if (radioButton2 != null) {
|
|
|
|
radioButton2.setChecked(true);
|
|
|
|
}
|
|
|
|
getBinding().e.setOnCheckedChangeListener(new WidgetGuildInviteSettings$configureUi$8(this, inviteSettings));
|
|
|
|
CheckedSetting checkedSetting = getBinding().f;
|
|
|
|
m.checkNotNullExpressionValue(checkedSetting, "binding.guildInviteTemporaryMembership");
|
|
|
|
checkedSetting.setChecked(inviteSettings.isTemporary());
|
|
|
|
getBinding().f.e(new WidgetGuildInviteSettings$configureUi$9(this, inviteSettings));
|
|
|
|
getBinding().d.setOnClickListener(new WidgetGuildInviteSettings$configureUi$10(this));
|
|
|
|
}
|
|
|
|
|
2021-09-30 06:24:59 +00:00
|
|
|
@Override // com.discord.app.AppFragment, com.discord.app.AppLogger.a
|
|
|
|
public LoggingConfig getLoggingConfig() {
|
|
|
|
return this.loggingConfig;
|
|
|
|
}
|
|
|
|
|
2021-08-03 07:33:18 +00:00
|
|
|
public final void handleEvent(GuildInviteSettingsViewModel.Event event) {
|
2021-08-20 02:22:46 +00:00
|
|
|
m.checkNotNullParameter(event, "event");
|
2021-08-03 07:33:18 +00:00
|
|
|
if (event instanceof GuildInviteSettingsViewModel.Event.InviteCreationSuccess) {
|
|
|
|
Intent intent = new Intent();
|
2021-08-09 22:51:56 +00:00
|
|
|
intent.putExtra(EXTRA_CREATED_INVITE, ((GuildInviteSettingsViewModel.Event.InviteCreationSuccess) event).getInvite());
|
2021-08-03 07:33:18 +00:00
|
|
|
requireActivity().setResult(-1, intent);
|
|
|
|
requireActivity().finish();
|
|
|
|
} else if (m.areEqual(event, GuildInviteSettingsViewModel.Event.InviteCreationFailure.INSTANCE)) {
|
2021-08-13 06:23:11 +00:00
|
|
|
c.a.d.m.g(requireContext(), R.string.default_failure_to_perform_action_message, 0, null, 12);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
|
|
public void onViewBound(View view) {
|
|
|
|
m.checkNotNullParameter(view, "view");
|
|
|
|
super.onViewBound(view);
|
2021-08-09 22:51:56 +00:00
|
|
|
this.channelsSpinnerAdapter = new ChannelsSpinnerAdapter(requireContext(), R.layout.view_invite_settings_channel_spinner_item, null, 4, null);
|
2021-08-03 07:33:18 +00:00
|
|
|
Spinner spinner = getBinding().b;
|
|
|
|
m.checkNotNullExpressionValue(spinner, "binding.guildInviteChannelSpinner");
|
|
|
|
ChannelsSpinnerAdapter channelsSpinnerAdapter = this.channelsSpinnerAdapter;
|
|
|
|
if (channelsSpinnerAdapter == null) {
|
|
|
|
m.throwUninitializedPropertyAccessException("channelsSpinnerAdapter");
|
|
|
|
}
|
|
|
|
spinner.setAdapter((SpinnerAdapter) channelsSpinnerAdapter);
|
2021-11-02 06:38:17 +00:00
|
|
|
RadioGroup radioGroup = getBinding().f1852c;
|
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 WidgetGuildInviteSettings$onViewBound$1(this));
|
|
|
|
RadioGroup radioGroup2 = getBinding().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 WidgetGuildInviteSettings$onViewBound$2(this));
|
|
|
|
setOnItemSelected();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
|
|
public void onViewBoundOrOnResume() {
|
|
|
|
super.onViewBoundOrOnResume();
|
2021-10-15 06:18:26 +00:00
|
|
|
Observable<GuildInviteSettingsViewModel.ViewState> q = getViewModel().observeViewState().q();
|
|
|
|
m.checkNotNullExpressionValue(q, "viewModel.observeViewSta… .distinctUntilChanged()");
|
|
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle$default(q, this, null, 2, null), WidgetGuildInviteSettings.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetGuildInviteSettings$onViewBoundOrOnResume$1(this), 62, (Object) null);
|
2021-08-27 06:37:59 +00:00
|
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle$default(getViewModel().observeEvents(), this, null, 2, null), WidgetGuildInviteSettings.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetGuildInviteSettings$onViewBoundOrOnResume$2(this), 62, (Object) null);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|