543 lines
27 KiB
Java
543 lines
27 KiB
Java
package com.discord.widgets.channels;
|
|
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.RadioButton;
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.TextView;
|
|
import androidx.activity.result.ActivityResultLauncher;
|
|
import androidx.activity.result.contract.ActivityResultContracts;
|
|
import androidx.appcompat.widget.SwitchCompat;
|
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
import androidx.fragment.app.Fragment;
|
|
import androidx.fragment.app.FragmentActivity;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import c.a.d.j;
|
|
import c.d.b.a.a;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import com.discord.R;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.api.permission.Permission;
|
|
import com.discord.api.role.GuildRole;
|
|
import com.discord.app.AppActivity;
|
|
import com.discord.app.AppFragment;
|
|
import com.discord.databinding.ViewCheckableRoleListItemThemedBinding;
|
|
import com.discord.databinding.WidgetCreateChannelBinding;
|
|
import com.discord.restapi.RestAPIParams;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.stores.StoreUser;
|
|
import com.discord.utilities.channel.ChannelSelector;
|
|
import com.discord.utilities.channel.GuildChannelIconUtilsKt;
|
|
import com.discord.utilities.guilds.RoleUtils;
|
|
import com.discord.utilities.mg_recycler.MGRecyclerAdapter;
|
|
import com.discord.utilities.mg_recycler.MGRecyclerAdapterSimple;
|
|
import com.discord.utilities.mg_recycler.MGRecyclerViewHolder;
|
|
import com.discord.utilities.mg_recycler.SingleTypePayload;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.stage.StageChannelUtils;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
import com.discord.views.CheckedSetting;
|
|
import com.discord.views.RadioManager;
|
|
import com.discord.widgets.channels.permissions.WidgetCreateChannelAddMember;
|
|
import com.google.android.material.textfield.TextInputLayout;
|
|
import d0.g;
|
|
import d0.t.n;
|
|
import d0.z.d.m;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
import java.util.Set;
|
|
import kotlin.Lazy;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.functions.Function3;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.reflect.KProperty;
|
|
import rx.Observable;
|
|
/* compiled from: WidgetCreateChannel.kt */
|
|
public final class WidgetCreateChannel extends AppFragment {
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.W(WidgetCreateChannel.class, "binding", "getBinding()Lcom/discord/databinding/WidgetCreateChannelBinding;", 0)};
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final String INTENT_CATEGORY_ID = "INTENT_CATEGORY_ID";
|
|
private static final String INTENT_GUILD_ID = "INTENT_GUILD_ID";
|
|
private static final String INTENT_PROVIDE_RESULT_ONLY = "INTENT_GUILD_ROLE_SUBSCRIPTION_CHANNEL";
|
|
private static final String INTENT_SHOULD_CHANNEL_DEFAULT_PRIVATE = "INTENT_SHOULD_CHANNEL_DEFAULT_PRIVATE";
|
|
private static final String INTENT_TYPE = "INTENT_TYPE";
|
|
private static final String RESULT_EXTRA_CHANNEL_ICON_RES_ID = "RESULT_EXTRA_CHANNEL_ICON_RES_ID";
|
|
private static final String RESULT_EXTRA_CHANNEL_ID = "RESULT_EXTRA_CHANNEL_ID";
|
|
private static final String RESULT_EXTRA_CHANNEL_NAME = "RESULT_EXTRA_CHANNEL_NAME";
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetCreateChannel$binding$2.INSTANCE, null, 2, null);
|
|
private final Lazy categoryId$delegate = g.lazy(new WidgetCreateChannel$categoryId$2(this));
|
|
private final Lazy guildId$delegate = g.lazy(new WidgetCreateChannel$guildId$2(this));
|
|
private final Lazy provideResultOnly$delegate = g.lazy(new WidgetCreateChannel$provideResultOnly$2(this));
|
|
private RolesAdapter rolesAdapter;
|
|
private final Lazy shouldChannelDefaultPrivate$delegate = g.lazy(new WidgetCreateChannel$shouldChannelDefaultPrivate$2(this));
|
|
private final Lazy type$delegate = g.lazy(new WidgetCreateChannel$type$2(this));
|
|
|
|
/* compiled from: WidgetCreateChannel.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public static /* synthetic */ void launch$default(Companion companion, Context context, ActivityResultLauncher activityResultLauncher, long j, int i, Long l, boolean z2, boolean z3, int i2, Object obj) {
|
|
companion.launch(context, activityResultLauncher, j, (i2 & 8) != 0 ? 0 : i, (i2 & 16) != 0 ? null : l, (i2 & 32) != 0 ? false : z2, (i2 & 64) != 0 ? false : z3);
|
|
}
|
|
|
|
public static /* synthetic */ void show$default(Companion companion, Context context, long j, int i, Long l, int i2, Object obj) {
|
|
int i3 = (i2 & 4) != 0 ? 0 : i;
|
|
if ((i2 & 8) != 0) {
|
|
l = null;
|
|
}
|
|
companion.show(context, j, i3, l);
|
|
}
|
|
|
|
public final void launch(Context context, ActivityResultLauncher<Intent> activityResultLauncher, long j, int i, Long l, boolean z2, boolean z3) {
|
|
m.checkNotNullParameter(context, "context");
|
|
m.checkNotNullParameter(activityResultLauncher, "launcher");
|
|
j jVar = j.g;
|
|
Intent intent = new Intent();
|
|
intent.putExtra(WidgetCreateChannel.INTENT_GUILD_ID, j);
|
|
intent.putExtra(WidgetCreateChannel.INTENT_TYPE, i);
|
|
intent.putExtra(WidgetCreateChannel.INTENT_CATEGORY_ID, l);
|
|
intent.putExtra(WidgetCreateChannel.INTENT_PROVIDE_RESULT_ONLY, z3);
|
|
intent.putExtra(WidgetCreateChannel.INTENT_SHOULD_CHANNEL_DEFAULT_PRIVATE, z2);
|
|
jVar.f(context, activityResultLauncher, WidgetCreateChannel.class, intent);
|
|
}
|
|
|
|
public final ActivityResultLauncher<Intent> registerForResult(AppFragment appFragment, Function3<? super Long, ? super String, ? super Integer, Unit> function3) {
|
|
m.checkNotNullParameter(appFragment, "fragment");
|
|
m.checkNotNullParameter(function3, "callback");
|
|
ActivityResultLauncher<Intent> registerForActivityResult = appFragment.registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new WidgetCreateChannel$Companion$registerForResult$1(function3));
|
|
m.checkNotNullExpressionValue(registerForActivityResult, "fragment.registerForActi… }\n }\n }");
|
|
return registerForActivityResult;
|
|
}
|
|
|
|
public final void show(Context context, long j, int i, Long l) {
|
|
m.checkNotNullParameter(context, "context");
|
|
Intent intent = new Intent();
|
|
intent.putExtra(WidgetCreateChannel.INTENT_GUILD_ID, j);
|
|
intent.putExtra(WidgetCreateChannel.INTENT_TYPE, i);
|
|
intent.putExtra(WidgetCreateChannel.INTENT_CATEGORY_ID, l);
|
|
j.d(context, WidgetCreateChannel.class, intent);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetCreateChannel.kt */
|
|
public static final class Model {
|
|
public static final Companion Companion = new Companion(null);
|
|
private final boolean canCreate;
|
|
private final boolean canCreateCommunityChannels;
|
|
private final boolean canManageRoles;
|
|
private final List<SingleTypePayload<GuildRole>> roleItems;
|
|
|
|
/* compiled from: WidgetCreateChannel.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public final Observable<Model> get(long j, Long l) {
|
|
StoreStream.Companion companion = StoreStream.Companion;
|
|
Observable g = Observable.g(StoreUser.observeMe$default(companion.getUsers(), false, 1, null), companion.getGuilds().observeGuild(j), companion.getPermissions().observePermissionsForGuild(j), companion.getPermissions().observePermissionsForChannel(l != null ? l.longValue() : 0), companion.getGuilds().observeSortedRoles(j), WidgetCreateChannel$Model$Companion$get$1.INSTANCE);
|
|
m.checkNotNullExpressionValue(g, "Observable\n .… }\n }");
|
|
Observable<Model> r = ObservableExtensionsKt.computationLatest(g).r();
|
|
m.checkNotNullExpressionValue(r, "Observable\n .… .distinctUntilChanged()");
|
|
return r;
|
|
}
|
|
}
|
|
|
|
private Model(boolean z2, boolean z3, boolean z4, List<SingleTypePayload<GuildRole>> list) {
|
|
this.canCreate = z2;
|
|
this.canManageRoles = z3;
|
|
this.canCreateCommunityChannels = z4;
|
|
this.roleItems = list;
|
|
}
|
|
|
|
public /* synthetic */ Model(boolean z2, boolean z3, boolean z4, List list, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(z2, z3, z4, list);
|
|
}
|
|
|
|
public final boolean getCanCreate() {
|
|
return this.canCreate;
|
|
}
|
|
|
|
public final boolean getCanCreateCommunityChannels() {
|
|
return this.canCreateCommunityChannels;
|
|
}
|
|
|
|
public final boolean getCanManageRoles() {
|
|
return this.canManageRoles;
|
|
}
|
|
|
|
public final List<SingleTypePayload<GuildRole>> getRoleItems() {
|
|
return this.roleItems;
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetCreateChannel.kt */
|
|
public static final class RolesAdapter extends MGRecyclerAdapterSimple<SingleTypePayload<GuildRole>> {
|
|
private final Map<Long, Integer> checkedRoles = new HashMap();
|
|
|
|
/* compiled from: WidgetCreateChannel.kt */
|
|
public static final class RoleListItem extends MGRecyclerViewHolder<RolesAdapter, SingleTypePayload<GuildRole>> {
|
|
private final ViewCheckableRoleListItemThemedBinding binding;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public RoleListItem(RolesAdapter rolesAdapter) {
|
|
super((int) R.layout.view_checkable_role_list_item_themed, rolesAdapter);
|
|
m.checkNotNullParameter(rolesAdapter, "adapter");
|
|
View view = this.itemView;
|
|
Objects.requireNonNull(view, "rootView");
|
|
CheckedSetting checkedSetting = (CheckedSetting) view;
|
|
ViewCheckableRoleListItemThemedBinding viewCheckableRoleListItemThemedBinding = new ViewCheckableRoleListItemThemedBinding(checkedSetting, checkedSetting);
|
|
m.checkNotNullExpressionValue(viewCheckableRoleListItemThemedBinding, "ViewCheckableRoleListIte…medBinding.bind(itemView)");
|
|
this.binding = viewCheckableRoleListItemThemedBinding;
|
|
}
|
|
|
|
public static final /* synthetic */ RolesAdapter access$getAdapter$p(RoleListItem roleListItem) {
|
|
return (RolesAdapter) roleListItem.adapter;
|
|
}
|
|
|
|
public static final /* synthetic */ ViewCheckableRoleListItemThemedBinding access$getBinding$p(RoleListItem roleListItem) {
|
|
return roleListItem.binding;
|
|
}
|
|
|
|
public void onConfigure(int i, SingleTypePayload<GuildRole> singleTypePayload) {
|
|
m.checkNotNullParameter(singleTypePayload, "data");
|
|
super.onConfigure(i, (int) singleTypePayload);
|
|
GuildRole data = singleTypePayload.getData();
|
|
boolean containsKey = ((RolesAdapter) this.adapter).getCheckedRoles().containsKey(Long.valueOf(data.getId()));
|
|
CheckedSetting checkedSetting = this.binding.b;
|
|
m.checkNotNullExpressionValue(checkedSetting, "binding.roleItemCheckedSetting");
|
|
checkedSetting.setChecked(containsKey);
|
|
this.binding.b.e(new WidgetCreateChannel$RolesAdapter$RoleListItem$onConfigure$1(this, data));
|
|
this.binding.b.setText(data.g());
|
|
CheckedSetting checkedSetting2 = this.binding.b;
|
|
m.checkNotNullExpressionValue(checkedSetting2, "binding.roleItemCheckedSetting");
|
|
Context context = checkedSetting2.getContext();
|
|
m.checkNotNullExpressionValue(context, "binding.roleItemCheckedSetting.context");
|
|
checkedSetting2.setTextColor(RoleUtils.getRoleColor$default(data, context, null, 2, null));
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public RolesAdapter(RecyclerView recyclerView) {
|
|
super(recyclerView, false, 2, null);
|
|
m.checkNotNullParameter(recyclerView, "recycler");
|
|
}
|
|
|
|
public static final /* synthetic */ void access$onRoleClicked(RolesAdapter rolesAdapter, boolean z2, int i, long j) {
|
|
rolesAdapter.onRoleClicked(z2, i, j);
|
|
}
|
|
|
|
private final void onRoleClicked(boolean z2, int i, long j) {
|
|
ArrayList<Number> arrayList = new ArrayList();
|
|
arrayList.add(Integer.valueOf(i));
|
|
if (z2) {
|
|
this.checkedRoles.put(Long.valueOf(j), Integer.valueOf(i));
|
|
} else {
|
|
this.checkedRoles.remove(Long.valueOf(j));
|
|
}
|
|
for (Number number : arrayList) {
|
|
int intValue = number.intValue();
|
|
if (intValue < getItemCount()) {
|
|
notifyItemChanged(intValue);
|
|
}
|
|
}
|
|
}
|
|
|
|
public final Map<Long, Integer> getCheckedRoles() {
|
|
return this.checkedRoles;
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public MGRecyclerViewHolder<?, SingleTypePayload<GuildRole>> onCreateViewHolder(ViewGroup viewGroup, int i) {
|
|
m.checkNotNullParameter(viewGroup, "parent");
|
|
return new RoleListItem(this);
|
|
}
|
|
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.util.List<com.discord.utilities.mg_recycler.SingleTypePayload<com.discord.api.role.GuildRole>>] */
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerAdapterSimple
|
|
public void setData(List<? extends SingleTypePayload<GuildRole>> list) {
|
|
m.checkNotNullParameter(list, "data");
|
|
super.setData(list);
|
|
this.checkedRoles.clear();
|
|
}
|
|
}
|
|
|
|
public WidgetCreateChannel() {
|
|
super(R.layout.widget_create_channel);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$configurePrivateRoles(WidgetCreateChannel widgetCreateChannel) {
|
|
widgetCreateChannel.configurePrivateRoles();
|
|
}
|
|
|
|
public static final /* synthetic */ void access$configureUI(WidgetCreateChannel widgetCreateChannel, Model model) {
|
|
widgetCreateChannel.configureUI(model);
|
|
}
|
|
|
|
public static final /* synthetic */ WidgetCreateChannelBinding access$getBinding$p(WidgetCreateChannel widgetCreateChannel) {
|
|
return widgetCreateChannel.getBinding();
|
|
}
|
|
|
|
public static final /* synthetic */ Long access$getCategoryId$p(WidgetCreateChannel widgetCreateChannel) {
|
|
return widgetCreateChannel.getCategoryId();
|
|
}
|
|
|
|
public static final /* synthetic */ int access$getChannelType$p(WidgetCreateChannel widgetCreateChannel) {
|
|
return widgetCreateChannel.getChannelType();
|
|
}
|
|
|
|
public static final /* synthetic */ long access$getGuildId$p(WidgetCreateChannel widgetCreateChannel) {
|
|
return widgetCreateChannel.getGuildId();
|
|
}
|
|
|
|
public static final /* synthetic */ List access$getPermissionOverwrites(WidgetCreateChannel widgetCreateChannel) {
|
|
return widgetCreateChannel.getPermissionOverwrites();
|
|
}
|
|
|
|
public static final /* synthetic */ void access$onChannelCreated(WidgetCreateChannel widgetCreateChannel, Channel channel) {
|
|
widgetCreateChannel.onChannelCreated(channel);
|
|
}
|
|
|
|
private final void configurePrivateRoles() {
|
|
boolean z2 = true;
|
|
int i = 0;
|
|
boolean z3 = getChannelType() != 13;
|
|
SwitchCompat switchCompat = getBinding().g;
|
|
m.checkNotNullExpressionValue(switchCompat, "binding.createChannelPrivateSwitch");
|
|
boolean isChecked = switchCompat.isChecked();
|
|
RelativeLayout relativeLayout = getBinding().e;
|
|
m.checkNotNullExpressionValue(relativeLayout, "binding.createChannelPrivateContainer");
|
|
relativeLayout.setVisibility(z3 ? 0 : 8);
|
|
View view = getBinding().j;
|
|
m.checkNotNullExpressionValue(view, "binding.createChannelRoleDivider");
|
|
view.setVisibility(z3 ? 0 : 8);
|
|
TextView textView = getBinding().k;
|
|
m.checkNotNullExpressionValue(textView, "binding.createChannelRoleHeader");
|
|
textView.setVisibility(z3 && isChecked ? 0 : 8);
|
|
RecyclerView recyclerView = getBinding().i;
|
|
m.checkNotNullExpressionValue(recyclerView, "binding.createChannelRoleAccessRecycler");
|
|
if (!z3 || !isChecked) {
|
|
z2 = false;
|
|
}
|
|
if (!z2) {
|
|
i = 8;
|
|
}
|
|
recyclerView.setVisibility(i);
|
|
}
|
|
|
|
private final void configureUI(Model model) {
|
|
if (model == null || !model.getCanCreate()) {
|
|
AppActivity appActivity = getAppActivity();
|
|
if (appActivity != null) {
|
|
appActivity.finish();
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
boolean z2 = true;
|
|
setActionBarDisplayHomeAsUpEnabled(true);
|
|
setActionBarTitle(getType() == 4 ? R.string.create_category : R.string.create_channel);
|
|
AppFragment.setActionBarOptionsMenu$default(this, R.menu.menu_channel_create, new WidgetCreateChannel$configureUI$1(this), null, 4, null);
|
|
ConstraintLayout constraintLayout = getBinding().b;
|
|
m.checkNotNullExpressionValue(constraintLayout, "binding.createChannelAnnouncementsContainer");
|
|
int i = 8;
|
|
constraintLayout.setVisibility(model.getCanCreateCommunityChannels() ? 0 : 8);
|
|
ConstraintLayout constraintLayout2 = getBinding().l;
|
|
m.checkNotNullExpressionValue(constraintLayout2, "binding.createChannelStageContainer");
|
|
if (!model.getCanCreateCommunityChannels() || !model.getCanManageRoles()) {
|
|
z2 = false;
|
|
}
|
|
if (z2) {
|
|
i = 0;
|
|
}
|
|
constraintLayout2.setVisibility(i);
|
|
RolesAdapter rolesAdapter = this.rolesAdapter;
|
|
if (rolesAdapter != null) {
|
|
rolesAdapter.setData(model.getRoleItems());
|
|
}
|
|
}
|
|
|
|
private final void finishActivity() {
|
|
AppFragment.hideKeyboard$default(this, null, 1, null);
|
|
AppActivity appActivity = getAppActivity();
|
|
if (appActivity != null) {
|
|
appActivity.finish();
|
|
}
|
|
}
|
|
|
|
private final WidgetCreateChannelBinding getBinding() {
|
|
return (WidgetCreateChannelBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
}
|
|
|
|
private final Long getCategoryId() {
|
|
return (Long) this.categoryId$delegate.getValue();
|
|
}
|
|
|
|
private final int getChannelType() {
|
|
if (getType() == 4) {
|
|
return 4;
|
|
}
|
|
RadioButton radioButton = getBinding().r;
|
|
m.checkNotNullExpressionValue(radioButton, "binding.createChannelVoiceRadio");
|
|
if (radioButton.isChecked()) {
|
|
return 2;
|
|
}
|
|
RadioButton radioButton2 = getBinding().f1782c;
|
|
m.checkNotNullExpressionValue(radioButton2, "binding.createChannelAnnouncementsRadio");
|
|
if (radioButton2.isChecked()) {
|
|
return 5;
|
|
}
|
|
RadioButton radioButton3 = getBinding().m;
|
|
m.checkNotNullExpressionValue(radioButton3, "binding.createChannelStageRadio");
|
|
return radioButton3.isChecked() ? 13 : 0;
|
|
}
|
|
|
|
private final long getGuildId() {
|
|
return ((Number) this.guildId$delegate.getValue()).longValue();
|
|
}
|
|
|
|
private final List<RestAPIParams.ChannelPermissionOverwrites> getPermissionOverwrites() {
|
|
Map<Long, Integer> checkedRoles;
|
|
Set<Long> keySet;
|
|
Map<Long, Integer> checkedRoles2;
|
|
Set<Long> keySet2;
|
|
if (getChannelType() != 13) {
|
|
SwitchCompat switchCompat = getBinding().g;
|
|
m.checkNotNullExpressionValue(switchCompat, "binding.createChannelPrivateSwitch");
|
|
if (switchCompat.isChecked()) {
|
|
RolesAdapter rolesAdapter = this.rolesAdapter;
|
|
if (!(rolesAdapter == null || (checkedRoles2 = rolesAdapter.getCheckedRoles()) == null || (keySet2 = checkedRoles2.keySet()) == null || !keySet2.contains(Long.valueOf(getGuildId())))) {
|
|
return null;
|
|
}
|
|
long j = (getChannelType() == 2 || getChannelType() == 13) ? Permission.CONNECT : Permission.VIEW_CHANNEL;
|
|
ArrayList arrayList = new ArrayList();
|
|
arrayList.add(RestAPIParams.ChannelPermissionOverwrites.Companion.createForRole(getGuildId(), 0L, Long.valueOf(j)));
|
|
RolesAdapter rolesAdapter2 = this.rolesAdapter;
|
|
if (!(rolesAdapter2 == null || (checkedRoles = rolesAdapter2.getCheckedRoles()) == null || (keySet = checkedRoles.keySet()) == null)) {
|
|
for (Number number : keySet) {
|
|
arrayList.add(RestAPIParams.ChannelPermissionOverwrites.Companion.createForRole(number.longValue(), Long.valueOf(j), 0L));
|
|
}
|
|
}
|
|
return arrayList;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
private final boolean getProvideResultOnly() {
|
|
return ((Boolean) this.provideResultOnly$delegate.getValue()).booleanValue();
|
|
}
|
|
|
|
private final boolean getShouldChannelDefaultPrivate() {
|
|
return ((Boolean) this.shouldChannelDefaultPrivate$delegate.getValue()).booleanValue();
|
|
}
|
|
|
|
private final int getType() {
|
|
return ((Number) this.type$delegate.getValue()).intValue();
|
|
}
|
|
|
|
private final void onChannelCreated(Channel channel) {
|
|
if (getProvideResultOnly()) {
|
|
FragmentActivity requireActivity = requireActivity();
|
|
Intent intent = new Intent();
|
|
intent.putExtra(RESULT_EXTRA_CHANNEL_ID, channel.h());
|
|
intent.putExtra(RESULT_EXTRA_CHANNEL_NAME, AnimatableValueParser.y0(channel));
|
|
intent.putExtra(RESULT_EXTRA_CHANNEL_ICON_RES_ID, GuildChannelIconUtilsKt.guildChannelIcon(channel));
|
|
requireActivity.setResult(-1, intent);
|
|
finishActivity();
|
|
return;
|
|
}
|
|
if (channel.A() == 0) {
|
|
ChannelSelector.selectChannel$default(ChannelSelector.Companion.getInstance(), channel, null, null, 6, null);
|
|
}
|
|
StoreStream.Companion companion = StoreStream.Companion;
|
|
boolean computeCanEditStageModerators = StageChannelUtils.computeCanEditStageModerators(companion.getPermissions(), companion.getGuilds(), companion.getUsers().getMe().getId(), getGuildId(), channel);
|
|
if (channel.A() == 13 && computeCanEditStageModerators) {
|
|
WidgetCreateChannelAddMember.Companion.create(requireContext(), channel.h());
|
|
}
|
|
finishActivity();
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
public void onViewBound(View view) {
|
|
m.checkNotNullParameter(view, "view");
|
|
super.onViewBound(view);
|
|
MGRecyclerAdapter.Companion companion = MGRecyclerAdapter.Companion;
|
|
RecyclerView recyclerView = getBinding().i;
|
|
m.checkNotNullExpressionValue(recyclerView, "binding.createChannelRoleAccessRecycler");
|
|
this.rolesAdapter = (RolesAdapter) companion.configure(new RolesAdapter(recyclerView));
|
|
getBinding().i.setHasFixedSize(false);
|
|
RecyclerView recyclerView2 = getBinding().i;
|
|
m.checkNotNullExpressionValue(recyclerView2, "binding.createChannelRoleAccessRecycler");
|
|
recyclerView2.setNestedScrollingEnabled(false);
|
|
SwitchCompat switchCompat = getBinding().g;
|
|
m.checkNotNullExpressionValue(switchCompat, "binding.createChannelPrivateSwitch");
|
|
switchCompat.setChecked(getShouldChannelDefaultPrivate());
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
public void onViewBoundOrOnResume() {
|
|
super.onViewBoundOrOnResume();
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(Model.Companion.get(getGuildId(), getCategoryId()), this, null, 2, null), WidgetCreateChannel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetCreateChannel$onViewBoundOrOnResume$1(this), 62, (Object) null);
|
|
int i = 0;
|
|
boolean z2 = true;
|
|
RadioManager radioManager = new RadioManager(n.listOf((Object[]) new RadioButton[]{getBinding().o, getBinding().r, getBinding().f1782c, getBinding().m}));
|
|
getBinding().n.setOnClickListener(new WidgetCreateChannel$onViewBoundOrOnResume$2(this, radioManager));
|
|
getBinding().q.setOnClickListener(new WidgetCreateChannel$onViewBoundOrOnResume$3(this, radioManager));
|
|
getBinding().b.setOnClickListener(new WidgetCreateChannel$onViewBoundOrOnResume$4(this, radioManager));
|
|
getBinding().l.setOnClickListener(new WidgetCreateChannel$onViewBoundOrOnResume$5(this, radioManager));
|
|
int type = getType();
|
|
if (type == 0) {
|
|
RadioButton radioButton = getBinding().o;
|
|
m.checkNotNullExpressionValue(radioButton, "binding.createChannelTextRadio");
|
|
radioManager.a(radioButton);
|
|
} else if (type == 2) {
|
|
RadioButton radioButton2 = getBinding().r;
|
|
m.checkNotNullExpressionValue(radioButton2, "binding.createChannelVoiceRadio");
|
|
radioManager.a(radioButton2);
|
|
} else if (type == 5) {
|
|
RadioButton radioButton3 = getBinding().f1782c;
|
|
m.checkNotNullExpressionValue(radioButton3, "binding.createChannelAnnouncementsRadio");
|
|
radioManager.a(radioButton3);
|
|
} else if (type == 13) {
|
|
RadioButton radioButton4 = getBinding().m;
|
|
m.checkNotNullExpressionValue(radioButton4, "binding.createChannelStageRadio");
|
|
radioManager.a(radioButton4);
|
|
}
|
|
configurePrivateRoles();
|
|
getBinding().e.setOnClickListener(new WidgetCreateChannel$onViewBoundOrOnResume$6(this));
|
|
LinearLayout linearLayout = getBinding().p;
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.createChannelTypeContainer");
|
|
if (getType() == 4) {
|
|
z2 = false;
|
|
}
|
|
if (!z2) {
|
|
i = 8;
|
|
}
|
|
linearLayout.setVisibility(i);
|
|
getBinding().h.setText(getType() == 4 ? R.string.private_category : R.string.private_channel);
|
|
getBinding().f.setText(getType() == 4 ? R.string.private_category_note : R.string.private_channel_note);
|
|
getBinding().k.setText(getType() == 4 ? R.string.form_label_category_permissions : R.string.form_label_channel_permissions);
|
|
TextInputLayout textInputLayout = getBinding().d;
|
|
m.checkNotNullExpressionValue(textInputLayout, "binding.createChannelNameLayout");
|
|
textInputLayout.setHint(getString(getType() == 4 ? R.string.category_name : R.string.form_label_channel_name));
|
|
}
|
|
}
|