discord-jadx/app/src/main/java/com/discord/widgets/guilds/profile/WidgetGuildProfileSheet.java

1017 lines
64 KiB
Java

package com.discord.widgets.guilds.profile;
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.cardview.widget.CardView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentViewModelLazyKt;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import c.a.d.h0;
import c.a.d.j0;
import c.a.d.o;
import c.a.k.b;
import c.d.b.a.a;
import com.discord.app.AppBottomSheet;
import com.discord.app.AppViewFlipper;
import com.discord.databinding.WidgetChannelsListActionsChangeNicknameBinding;
import com.discord.databinding.WidgetGuildHubProfileActionsBinding;
import com.discord.databinding.WidgetGuildProfileActionsBinding;
import com.discord.databinding.WidgetGuildProfileSheetBinding;
import com.discord.models.domain.emoji.Emoji;
import com.discord.utilities.color.ColorCompat;
import com.discord.utilities.color.ColorCompatKt;
import com.discord.utilities.icon.IconUtils;
import com.discord.utilities.images.MGImages;
import com.discord.utilities.resources.StringResourceUtilsKt;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.utilities.string.StringUtilsKt;
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.discord.widgets.guilds.invite.WidgetGuildInviteShare;
import com.discord.widgets.guilds.leave.WidgetLeaveGuildDialog;
import com.discord.widgets.guilds.profile.WidgetGuildProfileSheetViewModel;
import com.facebook.drawee.view.SimpleDraweeView;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.textfield.TextInputLayout;
import d0.g0.t;
import d0.z.d.a0;
import d0.z.d.m;
import java.util.List;
import java.util.Objects;
import kotlin.Lazy;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.reflect.KProperty;
/* compiled from: WidgetGuildProfileSheet.kt */
public final class WidgetGuildProfileSheet extends AppBottomSheet {
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.V(WidgetGuildProfileSheet.class, "binding", "getBinding()Lcom/discord/databinding/WidgetGuildProfileSheetBinding;", 0)};
public static final Companion Companion = new Companion(null);
private static final int LOADED_VIEW_INDEX = 1;
private static final int LOADING_VIEW_INDEX = 0;
private static final int NUM_ROWS_EMOJIS = 2;
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetGuildProfileSheet$binding$2.INSTANCE, null, 2, null);
private Long channelId;
private AlertDialog dialog;
private final WidgetGuildProfileSheetEmojisAdapter emojisAdapter;
private WidgetGuildProfileActionsBinding guildActionBinding;
private WidgetGuildHubProfileActionsBinding guildHubActionBinding;
private final Lazy viewModel$delegate;
/* compiled from: WidgetGuildProfileSheet.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public static /* synthetic */ void show$default(Companion companion, FragmentManager fragmentManager, boolean z2, long j, long j2, int i, Object obj) {
if ((i & 8) != 0) {
j2 = 0;
}
companion.show(fragmentManager, z2, j, j2);
}
public final void show(FragmentManager fragmentManager, boolean z2, long j, long j2) {
m.checkNotNullParameter(fragmentManager, "fragmentManager");
WidgetGuildProfileSheet widgetGuildProfileSheet = new WidgetGuildProfileSheet();
Bundle bundle = new Bundle();
bundle.putLong("com.discord.intent.extra.EXTRA_GUILD_ID", j);
bundle.putLong("com.discord.intent.extra.EXTRA_CHANNEL_ID", j2);
bundle.putBoolean("com.discord.intent.extra.EXTRA_VIEWING_GUILD", z2);
widgetGuildProfileSheet.setArguments(bundle);
widgetGuildProfileSheet.show(fragmentManager, WidgetGuildProfileSheet.class.getName());
}
}
public final /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
WidgetGuildProfileSheetViewModel.Banner.Type.values();
int[] iArr = new int[2];
$EnumSwitchMapping$0 = iArr;
iArr[WidgetGuildProfileSheetViewModel.Banner.Type.BANNER.ordinal()] = 1;
iArr[WidgetGuildProfileSheetViewModel.Banner.Type.SPLASH.ordinal()] = 2;
}
}
public WidgetGuildProfileSheet() {
super(false, 1, null);
WidgetGuildProfileSheet$viewModel$2 widgetGuildProfileSheet$viewModel$2 = new WidgetGuildProfileSheet$viewModel$2(this);
h0 h0Var = new h0(this);
this.viewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(WidgetGuildProfileSheetViewModel.class), new WidgetGuildProfileSheet$appViewModels$$inlined$viewModels$1(h0Var), new j0(widgetGuildProfileSheet$viewModel$2));
this.emojisAdapter = new WidgetGuildProfileSheetEmojisAdapter();
}
public static final /* synthetic */ Unit access$dismissAlert(WidgetGuildProfileSheet widgetGuildProfileSheet) {
return widgetGuildProfileSheet.dismissAlert();
}
public static final /* synthetic */ Bundle access$getArgumentsOrDefault$p(WidgetGuildProfileSheet widgetGuildProfileSheet) {
return widgetGuildProfileSheet.getArgumentsOrDefault();
}
public static final /* synthetic */ WidgetGuildProfileActionsBinding access$getGuildActionBinding$p(WidgetGuildProfileSheet widgetGuildProfileSheet) {
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding = widgetGuildProfileSheet.guildActionBinding;
if (widgetGuildProfileActionsBinding == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
return widgetGuildProfileActionsBinding;
}
public static final /* synthetic */ WidgetGuildHubProfileActionsBinding access$getGuildHubActionBinding$p(WidgetGuildProfileSheet widgetGuildProfileSheet) {
WidgetGuildHubProfileActionsBinding widgetGuildHubProfileActionsBinding = widgetGuildProfileSheet.guildHubActionBinding;
if (widgetGuildHubProfileActionsBinding == null) {
m.throwUninitializedPropertyAccessException("guildHubActionBinding");
}
return widgetGuildHubProfileActionsBinding;
}
public static final /* synthetic */ WidgetGuildProfileSheetViewModel access$getViewModel$p(WidgetGuildProfileSheet widgetGuildProfileSheet) {
return widgetGuildProfileSheet.getViewModel();
}
public static final /* synthetic */ void access$handleEvent(WidgetGuildProfileSheet widgetGuildProfileSheet, WidgetGuildProfileSheetViewModel.Event event) {
widgetGuildProfileSheet.handleEvent(event);
}
public static final /* synthetic */ void access$handleViewState(WidgetGuildProfileSheet widgetGuildProfileSheet, WidgetGuildProfileSheetViewModel.ViewState viewState) {
widgetGuildProfileSheet.handleViewState(viewState);
}
public static final /* synthetic */ void access$launchInvite(WidgetGuildProfileSheet widgetGuildProfileSheet, long j) {
widgetGuildProfileSheet.launchInvite(j);
}
public static final /* synthetic */ void access$setGuildActionBinding$p(WidgetGuildProfileSheet widgetGuildProfileSheet, WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding) {
widgetGuildProfileSheet.guildActionBinding = widgetGuildProfileActionsBinding;
}
public static final /* synthetic */ void access$setGuildHubActionBinding$p(WidgetGuildProfileSheet widgetGuildProfileSheet, WidgetGuildHubProfileActionsBinding widgetGuildHubProfileActionsBinding) {
widgetGuildProfileSheet.guildHubActionBinding = widgetGuildHubProfileActionsBinding;
}
public static final /* synthetic */ void access$showChangeNicknameDialog(WidgetGuildProfileSheet widgetGuildProfileSheet, long j, String str) {
widgetGuildProfileSheet.showChangeNicknameDialog(j, str);
}
public static final /* synthetic */ void access$showLeaveServerDialog(WidgetGuildProfileSheet widgetGuildProfileSheet, long j) {
widgetGuildProfileSheet.showLeaveServerDialog(j);
}
private final void configureBottomActions(long j, Long l, WidgetGuildProfileSheetViewModel.BottomActions bottomActions) {
boolean showUploadEmoji = bottomActions.getShowUploadEmoji();
boolean showJoinServer = bottomActions.getShowJoinServer();
boolean showViewServer = bottomActions.getShowViewServer();
int i = 8;
if (showUploadEmoji || showJoinServer || showViewServer) {
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding = this.guildActionBinding;
if (widgetGuildProfileActionsBinding == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
LinearLayout linearLayout = widgetGuildProfileActionsBinding.f1820c;
m.checkNotNullExpressionValue(linearLayout, "guildActionBinding.guildProfileSheetBottomActions");
linearLayout.setVisibility(0);
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding2 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding2 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
MaterialButton materialButton = widgetGuildProfileActionsBinding2.v;
materialButton.setVisibility(showUploadEmoji ? 0 : 8);
setOnClickAndDismissListener(materialButton, new WidgetGuildProfileSheet$configureBottomActions$$inlined$apply$lambda$1(this, showUploadEmoji, j));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding3 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding3 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
MaterialButton materialButton2 = widgetGuildProfileActionsBinding3.n;
materialButton2.setVisibility(showJoinServer ? 0 : 8);
setOnClickAndDismissListener(materialButton2, new WidgetGuildProfileSheet$configureBottomActions$$inlined$apply$lambda$2(this, showJoinServer, j));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding4 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding4 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
MaterialButton materialButton3 = widgetGuildProfileActionsBinding4.w;
if (showViewServer) {
i = 0;
}
materialButton3.setVisibility(i);
setOnClickAndDismissListener(materialButton3, new WidgetGuildProfileSheet$configureBottomActions$$inlined$apply$lambda$3(this, showViewServer, j, l));
m.checkNotNullExpressionValue(materialButton3, "guildActionBinding.guild…dId, channelId) }\n }");
return;
}
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding5 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding5 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
LinearLayout linearLayout2 = widgetGuildProfileActionsBinding5.f1820c;
m.checkNotNullExpressionValue(linearLayout2, "guildActionBinding.guildProfileSheetBottomActions");
linearLayout2.setVisibility(8);
}
private final void configureEmojis(WidgetGuildProfileSheetViewModel.EmojisData emojisData) {
boolean isPremium = emojisData.isPremium();
boolean isExpanded = emojisData.isExpanded();
List<Emoji> emojis = emojisData.getEmojis();
int size = emojis.size();
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding = this.guildActionBinding;
if (widgetGuildProfileActionsBinding == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
TextView textView = widgetGuildProfileActionsBinding.l;
m.checkNotNullExpressionValue(textView, "guildActionBinding.guildProfileSheetEmojisCount");
Resources resources = getResources();
m.checkNotNullExpressionValue(resources, "resources");
textView.setText(StringResourceUtilsKt.getQuantityString(resources, 2131755076, 2131891538, size, Integer.valueOf(size)));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding2 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding2 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
ImageView imageView = widgetGuildProfileActionsBinding2.f1821s;
m.checkNotNullExpressionValue(imageView, "guildActionBinding.guild…PremiumUpsellDotSeparator");
imageView.setVisibility(isPremium ^ true ? 0 : 8);
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding3 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding3 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
TextView textView2 = widgetGuildProfileActionsBinding3.t;
m.checkNotNullExpressionValue(textView2, "guildActionBinding.guild…ileSheetPremiumUpsellText");
textView2.setVisibility(isPremium ^ true ? 0 : 8);
if (size != 0) {
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding4 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding4 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
CardView cardView = widgetGuildProfileActionsBinding4.k;
m.checkNotNullExpressionValue(cardView, "guildActionBinding.guildProfileSheetEmojisCard");
cardView.setVisibility(0);
int maxEmojisPerRow = maxEmojisPerRow();
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding5 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding5 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
RecyclerView recyclerView = widgetGuildProfileActionsBinding5.j;
m.checkNotNullExpressionValue(recyclerView, "guildActionBinding.guildProfileSheetEmojis");
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
Objects.requireNonNull(layoutManager, "null cannot be cast to non-null type androidx.recyclerview.widget.GridLayoutManager");
((GridLayoutManager) layoutManager).setSpanCount(maxEmojisPerRow);
this.emojisAdapter.setData(emojis, isExpanded ? emojis.size() : maxEmojisPerRow * 2);
return;
}
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding6 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding6 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
CardView cardView2 = widgetGuildProfileActionsBinding6.k;
m.checkNotNullExpressionValue(cardView2, "guildActionBinding.guildProfileSheetEmojisCard");
cardView2.setVisibility(8);
}
private final void configureGuildActions(long j, WidgetGuildProfileSheetViewModel.Actions actions) {
if (actions == null) {
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding = this.guildActionBinding;
if (widgetGuildProfileActionsBinding == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
LinearLayout linearLayout = widgetGuildProfileActionsBinding.a;
m.checkNotNullExpressionValue(linearLayout, "guildActionBinding.root");
linearLayout.setVisibility(8);
return;
}
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding2 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding2 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
LinearLayout linearLayout2 = widgetGuildProfileActionsBinding2.a;
m.checkNotNullExpressionValue(linearLayout2, "guildActionBinding.root");
linearLayout2.setVisibility(0);
boolean isUnread = actions.isUnread();
boolean canManageChannels = actions.getCanManageChannels();
boolean canChangeNickname = actions.getCanChangeNickname();
String nick = actions.getNick();
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding3 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding3 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
CardView cardView = widgetGuildProfileActionsBinding3.q;
m.checkNotNullExpressionValue(cardView, "guildActionBinding.guild…fileSheetMarkAsReadAction");
cardView.setVisibility(isUnread ? 0 : 8);
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding4 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding4 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
widgetGuildProfileActionsBinding4.p.setOnClickListener(new WidgetGuildProfileSheet$configureGuildActions$1(this, j));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding5 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding5 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
CardView cardView2 = widgetGuildProfileActionsBinding5.u;
m.checkNotNullExpressionValue(cardView2, "guildActionBinding.guildProfileSheetPrimaryActions");
cardView2.setVisibility(canManageChannels ? 0 : 8);
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding6 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding6 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
TextView textView = widgetGuildProfileActionsBinding6.g;
textView.setVisibility(canManageChannels ? 0 : 8);
setOnClickAndDismissListener(textView, new WidgetGuildProfileSheet$configureGuildActions$$inlined$apply$lambda$1(textView, this, canManageChannels, j));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding7 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding7 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
TextView textView2 = widgetGuildProfileActionsBinding7.h;
textView2.setVisibility(canManageChannels ? 0 : 8);
setOnClickAndDismissListener(textView2, new WidgetGuildProfileSheet$configureGuildActions$$inlined$apply$lambda$2(textView2, this, canManageChannels, j));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding8 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding8 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
View view = widgetGuildProfileActionsBinding8.e;
view.setVisibility(canChangeNickname ? 0 : 8);
setOnClickAndDismissListener(view, new WidgetGuildProfileSheet$configureGuildActions$$inlined$apply$lambda$3(this, canChangeNickname, j, nick));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding9 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding9 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
TextView textView3 = widgetGuildProfileActionsBinding9.r;
textView3.setVisibility(true ^ (nick == null || nick.length() == 0) ? 0 : 8);
textView3.setText(nick);
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding10 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding10 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
CheckedSetting checkedSetting = widgetGuildProfileActionsBinding10.b;
checkedSetting.setChecked(actions.isAllowDMChecked());
checkedSetting.setOnCheckedListener(new WidgetGuildProfileSheet$configureGuildActions$$inlined$apply$lambda$4(this, actions, j));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding11 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding11 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
CheckedSetting checkedSetting2 = widgetGuildProfileActionsBinding11.m;
checkedSetting2.setChecked(actions.getHideMutedChannels());
checkedSetting2.setOnCheckedListener(new WidgetGuildProfileSheet$configureGuildActions$$inlined$apply$lambda$5(this, actions, j));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding12 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding12 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
View view2 = widgetGuildProfileActionsBinding12.o;
view2.setVisibility(actions.getCanLeaveGuild() ? 0 : 8);
setOnClickAndDismissListener(view2, new WidgetGuildProfileSheet$configureGuildActions$$inlined$apply$lambda$6(this, actions, j));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding13 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding13 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
CardView cardView3 = widgetGuildProfileActionsBinding13.i;
m.checkNotNullExpressionValue(cardView3, "guildActionBinding.guild…fileSheetDeveloperActions");
cardView3.setVisibility(actions.isDeveloper() ? 0 : 8);
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding14 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding14 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
widgetGuildProfileActionsBinding14.f.setOnClickListener(new WidgetGuildProfileSheet$configureGuildActions$9(this, j));
}
private final void configureGuildBanner(WidgetGuildProfileSheetViewModel.Banner banner) {
String str;
if (banner.getHash() != null) {
int ordinal = banner.getType().ordinal();
if (ordinal == 0) {
str = IconUtils.INSTANCE.getBannerForGuild(Long.valueOf(banner.getGuildId()), banner.getHash(), Integer.valueOf(getResources().getDimensionPixelSize(2131165681)));
} else if (ordinal == 1) {
str = IconUtils.INSTANCE.getGuildSplashUrl(banner.getGuildId(), banner.getHash(), Integer.valueOf(getResources().getDimensionPixelSize(2131165681)));
} else {
throw new NoWhenBranchMatchedException();
}
SimpleDraweeView simpleDraweeView = getBinding().b;
m.checkNotNullExpressionValue(simpleDraweeView, "binding.guildProfileSheetBanner");
MGImages.setImage$default(simpleDraweeView, str, 0, 0, false, null, null, 124, null);
SimpleDraweeView simpleDraweeView2 = getBinding().b;
m.checkNotNullExpressionValue(simpleDraweeView2, "binding.guildProfileSheetBanner");
simpleDraweeView2.setVisibility(0);
constrainIconToBanner();
return;
}
SimpleDraweeView simpleDraweeView3 = getBinding().b;
m.checkNotNullExpressionValue(simpleDraweeView3, "binding.guildProfileSheetBanner");
simpleDraweeView3.setVisibility(8);
constrainIconToParent();
}
/* JADX WARNING: Removed duplicated region for block: B:11:0x004a */
/* JADX WARNING: Removed duplicated region for block: B:12:0x0064 */
private final void configureGuildContent(String str, String str2, Integer num) {
TextView textView = getBinding().o;
m.checkNotNullExpressionValue(textView, "binding.guildProfileSheetName");
textView.setText(str);
if (str2 != null) {
if (str2.length() > 0) {
TextView textView2 = getBinding().f;
m.checkNotNullExpressionValue(textView2, "binding.guildProfileSheetDescription");
textView2.setText(str2);
TextView textView3 = getBinding().f;
m.checkNotNullExpressionValue(textView3, "binding.guildProfileSheetDescription");
textView3.setVisibility(0);
if (num == null) {
getBinding().h.setImageResource(num.intValue());
ImageView imageView = getBinding().h;
m.checkNotNullExpressionValue(imageView, "binding.guildProfileSheetGuildVerifiedPremiumIcon");
imageView.setVisibility(0);
return;
}
ImageView imageView2 = getBinding().h;
m.checkNotNullExpressionValue(imageView2, "binding.guildProfileSheetGuildVerifiedPremiumIcon");
imageView2.setVisibility(8);
return;
}
}
TextView textView4 = getBinding().f;
m.checkNotNullExpressionValue(textView4, "binding.guildProfileSheetDescription");
textView4.setVisibility(8);
if (num == null) {
}
}
private final void configureGuildHubActions(long j, WidgetGuildProfileSheetViewModel.Actions actions) {
if (actions != null) {
WidgetGuildHubProfileActionsBinding widgetGuildHubProfileActionsBinding = this.guildHubActionBinding;
if (widgetGuildHubProfileActionsBinding == null) {
m.throwUninitializedPropertyAccessException("guildHubActionBinding");
}
widgetGuildHubProfileActionsBinding.f1810c.setOnClickListener(new WidgetGuildProfileSheet$configureGuildHubActions$1(this, j));
WidgetGuildHubProfileActionsBinding widgetGuildHubProfileActionsBinding2 = this.guildHubActionBinding;
if (widgetGuildHubProfileActionsBinding2 == null) {
m.throwUninitializedPropertyAccessException("guildHubActionBinding");
}
widgetGuildHubProfileActionsBinding2.b.setOnClickListener(new WidgetGuildProfileSheet$configureGuildHubActions$2(this, j, actions));
String nick = actions.getNick();
if (nick != null) {
WidgetGuildHubProfileActionsBinding widgetGuildHubProfileActionsBinding3 = this.guildHubActionBinding;
if (widgetGuildHubProfileActionsBinding3 == null) {
m.throwUninitializedPropertyAccessException("guildHubActionBinding");
}
TextView textView = widgetGuildHubProfileActionsBinding3.e;
m.checkNotNullExpressionValue(textView, "guildHubActionBinding.guildProfileSheetNickname");
textView.setText(nick);
}
WidgetGuildHubProfileActionsBinding widgetGuildHubProfileActionsBinding4 = this.guildHubActionBinding;
if (widgetGuildHubProfileActionsBinding4 == null) {
m.throwUninitializedPropertyAccessException("guildHubActionBinding");
}
TextView textView2 = widgetGuildHubProfileActionsBinding4.d;
textView2.setVisibility(actions.getCanLeaveGuild() ? 0 : 8);
setOnClickAndDismissListener(textView2, new WidgetGuildProfileSheet$configureGuildHubActions$$inlined$apply$lambda$1(this, actions, j));
}
}
private final void configureGuildIcon(long j, String str, String str2) {
String forGuild$default = IconUtils.getForGuild$default(Long.valueOf(j), str, null, true, Integer.valueOf(IconUtils.getMediaProxySize(getResources().getDimensionPixelSize(2131165298))), 4, null);
if (forGuild$default != null) {
TextView textView = getBinding().k;
m.checkNotNullExpressionValue(textView, "binding.guildProfileSheetIconName");
textView.setVisibility(8);
SimpleDraweeView simpleDraweeView = getBinding().i;
m.checkNotNullExpressionValue(simpleDraweeView, "binding.guildProfileSheetIcon");
IconUtils.setIcon$default(simpleDraweeView, forGuild$default, 0, (Function1) null, (MGImages.ChangeDetector) null, 28, (Object) null);
return;
}
SimpleDraweeView simpleDraweeView2 = getBinding().i;
m.checkNotNullExpressionValue(simpleDraweeView2, "binding.guildProfileSheetIcon");
IconUtils.setIcon$default(simpleDraweeView2, "asset://asset/images/default_icon_selected.jpg", 0, (Function1) null, (MGImages.ChangeDetector) null, 28, (Object) null);
TextView textView2 = getBinding().k;
m.checkNotNullExpressionValue(textView2, "binding.guildProfileSheetIconName");
textView2.setVisibility(0);
TextView textView3 = getBinding().k;
m.checkNotNullExpressionValue(textView3, "binding.guildProfileSheetIconName");
textView3.setText(str2);
}
private final void configureMemberCount(Integer num, Integer num2) {
if (num != null) {
LinearLayout linearLayout = getBinding().q;
m.checkNotNullExpressionValue(linearLayout, "binding.guildProfileSheetOnlineCount");
linearLayout.setVisibility(0);
TextView textView = getBinding().r;
m.checkNotNullExpressionValue(textView, "binding.guildProfileSheetOnlineCountText");
int intValue = num.intValue();
LinearLayout linearLayout2 = getBinding().q;
m.checkNotNullExpressionValue(linearLayout2, "binding.guildProfileSheetOnlineCount");
Context context = linearLayout2.getContext();
m.checkNotNullExpressionValue(context, "binding.guildProfileSheetOnlineCount.context");
b.m(textView, 2131890514, new Object[]{StringUtilsKt.format(intValue, context)}, null, 4);
} else {
LinearLayout linearLayout3 = getBinding().q;
m.checkNotNullExpressionValue(linearLayout3, "binding.guildProfileSheetOnlineCount");
linearLayout3.setVisibility(8);
}
if (num2 != null) {
LinearLayout linearLayout4 = getBinding().m;
m.checkNotNullExpressionValue(linearLayout4, "binding.guildProfileSheetMemberCount");
linearLayout4.setVisibility(0);
Resources resources = getResources();
m.checkNotNullExpressionValue(resources, "resources");
Context requireContext = requireContext();
m.checkNotNullExpressionValue(requireContext, "requireContext()");
CharSequence quantityString = StringResourceUtilsKt.getQuantityString(resources, requireContext, 2131755194, num2.intValue(), num2);
TextView textView2 = getBinding().n;
m.checkNotNullExpressionValue(textView2, "binding.guildProfileSheetMemberCountText");
b.m(textView2, 2131890515, new Object[]{quantityString}, null, 4);
return;
}
LinearLayout linearLayout5 = getBinding().m;
m.checkNotNullExpressionValue(linearLayout5, "binding.guildProfileSheetMemberCount");
linearLayout5.setVisibility(8);
}
private final void configureTabItems(long j, WidgetGuildProfileSheetViewModel.TabItems tabItems, boolean z2) {
int i = 8;
if (tabItems == null || z2) {
LinearLayout linearLayout = getBinding().t;
m.checkNotNullExpressionValue(linearLayout, "binding.guildProfileSheetTabItems");
linearLayout.setVisibility(8);
View view = getBinding().e;
m.checkNotNullExpressionValue(view, "binding.guildProfileShee…entContainerBottomDivider");
view.setVisibility(8);
return;
}
boolean canAccessSettings = tabItems.getCanAccessSettings();
boolean ableToInstantInvite = tabItems.getAbleToInstantInvite();
int premiumSubscriptionCount = tabItems.getPremiumSubscriptionCount();
LinearLayout linearLayout2 = getBinding().t;
m.checkNotNullExpressionValue(linearLayout2, "binding.guildProfileSheetTabItems");
linearLayout2.setVisibility(0);
View view2 = getBinding().e;
m.checkNotNullExpressionValue(view2, "binding.guildProfileShee…entContainerBottomDivider");
view2.setVisibility(0);
int themedColor = ColorCompat.getThemedColor(this, 2130968949);
MaterialButton materialButton = getBinding().f1822c;
Resources resources = materialButton.getResources();
m.checkNotNullExpressionValue(resources, "resources");
materialButton.setText(StringResourceUtilsKt.getQuantityString(resources, 2131755247, 2131892226, premiumSubscriptionCount, Integer.valueOf(premiumSubscriptionCount)));
materialButton.setTextColor(themedColor);
setOnClickAndDismissListener(materialButton, new WidgetGuildProfileSheet$configureTabItems$$inlined$apply$lambda$1(this, premiumSubscriptionCount, themedColor, j));
MaterialButton materialButton2 = getBinding().p;
ColorCompatKt.setDrawableColor(materialButton2, themedColor);
materialButton2.setTextColor(themedColor);
setOnClickAndDismissListener(materialButton2, new WidgetGuildProfileSheet$configureTabItems$$inlined$apply$lambda$2(this, themedColor, j));
MaterialButton materialButton3 = getBinding().f1823s;
materialButton3.setVisibility(canAccessSettings ? 0 : 8);
ColorCompatKt.setDrawableColor(materialButton3, themedColor);
materialButton3.setTextColor(themedColor);
setOnClickAndDismissListener(materialButton3, new WidgetGuildProfileSheet$configureTabItems$$inlined$apply$lambda$3(this, canAccessSettings, themedColor, j));
MaterialButton materialButton4 = getBinding().l;
if (ableToInstantInvite) {
i = 0;
}
materialButton4.setVisibility(i);
ColorCompatKt.setDrawableColor(materialButton4, themedColor);
materialButton4.setTextColor(themedColor);
setOnClickAndDismissListener(materialButton4, new WidgetGuildProfileSheet$configureTabItems$$inlined$apply$lambda$4(this, ableToInstantInvite, themedColor, j));
m.checkNotNullExpressionValue(materialButton4, "binding.guildProfileShee…Invite(guildId) }\n }");
}
/* JADX WARNING: Removed duplicated region for block: B:98:0x02a9 */
/* JADX WARNING: Removed duplicated region for block: B:99:0x02af */
private final void configureUI(WidgetGuildProfileSheetViewModel.ViewState.Loaded loaded) {
WidgetGuildProfileSheetViewModel.Actions actions;
WidgetGuildProfileSheetViewModel.TabItems tabItems;
int i;
int i2;
long component1 = loaded.component1();
String component2 = loaded.component2();
String component3 = loaded.component3();
String component4 = loaded.component4();
String component5 = loaded.component5();
Integer component6 = loaded.component6();
WidgetGuildProfileSheetViewModel.Banner component7 = loaded.component7();
Integer component8 = loaded.component8();
Integer component9 = loaded.component9();
WidgetGuildProfileSheetViewModel.TabItems component10 = loaded.component10();
WidgetGuildProfileSheetViewModel.Actions component11 = loaded.component11();
WidgetGuildProfileSheetViewModel.EmojisData component12 = loaded.component12();
WidgetGuildProfileSheetViewModel.BottomActions component13 = loaded.component13();
boolean component14 = loaded.component14();
if (!component14 || this.guildHubActionBinding != null) {
actions = component11;
if (!component14 && this.guildActionBinding == null) {
View inflate = getBinding().v.inflate();
LinearLayout linearLayout = (LinearLayout) inflate.findViewById(2131363462);
if (linearLayout != null) {
CheckedSetting checkedSetting = (CheckedSetting) inflate.findViewById(2131363464);
if (checkedSetting != null) {
LinearLayout linearLayout2 = (LinearLayout) inflate.findViewById(2131363467);
if (linearLayout2 != null) {
LinearLayout linearLayout3 = (LinearLayout) inflate;
LinearLayout linearLayout4 = (LinearLayout) inflate.findViewById(2131363469);
if (linearLayout4 != null) {
TextView textView = (TextView) inflate.findViewById(2131363473);
if (textView != null) {
TextView textView2 = (TextView) inflate.findViewById(2131363474);
if (textView2 != null) {
TextView textView3 = (TextView) inflate.findViewById(2131363475);
if (textView3 != null) {
CardView cardView = (CardView) inflate.findViewById(2131363477);
if (cardView != null) {
RecyclerView recyclerView = (RecyclerView) inflate.findViewById(2131363479);
if (recyclerView != null) {
tabItems = component10;
i = 2131363480;
CardView cardView2 = (CardView) inflate.findViewById(2131363480);
if (cardView2 != null) {
i = 2131363481;
TextView textView4 = (TextView) inflate.findViewById(2131363481);
if (textView4 != null) {
i = 2131363484;
CheckedSetting checkedSetting2 = (CheckedSetting) inflate.findViewById(2131363484);
if (checkedSetting2 != null) {
MaterialButton materialButton = (MaterialButton) inflate.findViewById(2131363490);
if (materialButton != null) {
i = 2131363491;
TextView textView5 = (TextView) inflate.findViewById(2131363491);
if (textView5 != null) {
i = 2131363492;
TextView textView6 = (TextView) inflate.findViewById(2131363492);
if (textView6 != null) {
CardView cardView3 = (CardView) inflate.findViewById(2131363493);
if (cardView3 != null) {
i = 2131363497;
TextView textView7 = (TextView) inflate.findViewById(2131363497);
if (textView7 != null) {
i = 2131363501;
ImageView imageView = (ImageView) inflate.findViewById(2131363501);
if (imageView != null) {
i = 2131363502;
TextView textView8 = (TextView) inflate.findViewById(2131363502);
if (textView8 != null) {
CardView cardView4 = (CardView) inflate.findViewById(2131363503);
if (cardView4 != null) {
i = 2131363504;
CardView cardView5 = (CardView) inflate.findViewById(2131363504);
if (cardView5 != null) {
i = 2131363507;
MaterialButton materialButton2 = (MaterialButton) inflate.findViewById(2131363507);
if (materialButton2 != null) {
i = 2131363508;
MaterialButton materialButton3 = (MaterialButton) inflate.findViewById(2131363508);
if (materialButton3 != null) {
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding = new WidgetGuildProfileActionsBinding(linearLayout3, linearLayout, checkedSetting, linearLayout2, linearLayout3, linearLayout4, textView, textView2, textView3, cardView, recyclerView, cardView2, textView4, checkedSetting2, materialButton, textView5, textView6, cardView3, textView7, imageView, textView8, cardView4, cardView5, materialButton2, materialButton3);
m.checkNotNullExpressionValue(widgetGuildProfileActionsBinding, "WidgetGuildProfileActionsBinding.bind(view)");
this.guildActionBinding = widgetGuildProfileActionsBinding;
if (widgetGuildProfileActionsBinding == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
m.checkNotNullExpressionValue(recyclerView, "guildActionBinding.guildProfileSheetEmojis");
recyclerView.setAdapter(this.emojisAdapter);
configureGuildIcon(component1, component4, component3);
configureGuildBanner(component7);
configureGuildContent(component2, component5, component6);
configureMemberCount(component8, component9);
configureTabItems(component1, tabItems, component14);
if (!component14) {
configureGuildHubActions(component1, actions);
return;
}
configureGuildActions(component1, actions);
configureEmojis(component12);
configureBottomActions(component1, this.channelId, component13);
return;
}
}
}
} else {
i = 2131363503;
}
}
}
}
} else {
i = 2131363493;
}
}
}
} else {
i = 2131363490;
}
}
}
}
} else {
i = 2131363479;
}
} else {
i = 2131363477;
}
} else {
i = 2131363475;
}
} else {
i = 2131363474;
}
} else {
i = 2131363473;
}
} else {
i = 2131363469;
}
} else {
i = 2131363467;
}
} else {
i = 2131363464;
}
} else {
i = 2131363462;
}
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i)));
}
} else {
View inflate2 = getBinding().u.inflate();
actions = component11;
LinearLayout linearLayout5 = (LinearLayout) inflate2.findViewById(2131363462);
if (linearLayout5 != null) {
LinearLayout linearLayout6 = (LinearLayout) inflate2;
LinearLayout linearLayout7 = (LinearLayout) inflate2.findViewById(2131363469);
if (linearLayout7 != null) {
i2 = 2131363488;
TextView textView9 = (TextView) inflate2.findViewById(2131363488);
if (textView9 != null) {
CardView cardView6 = (CardView) inflate2.findViewById(2131363489);
if (cardView6 != null) {
TextView textView10 = (TextView) inflate2.findViewById(2131363491);
if (textView10 != null) {
TextView textView11 = (TextView) inflate2.findViewById(2131363497);
if (textView11 != null) {
CardView cardView7 = (CardView) inflate2.findViewById(2131363504);
if (cardView7 != null) {
WidgetGuildHubProfileActionsBinding widgetGuildHubProfileActionsBinding = new WidgetGuildHubProfileActionsBinding(linearLayout6, linearLayout5, linearLayout6, linearLayout7, textView9, cardView6, textView10, textView11, cardView7);
m.checkNotNullExpressionValue(widgetGuildHubProfileActionsBinding, "WidgetGuildHubProfileActionsBinding.bind(view)");
this.guildHubActionBinding = widgetGuildHubProfileActionsBinding;
} else {
i2 = 2131363504;
}
} else {
i2 = 2131363497;
}
} else {
i2 = 2131363491;
}
} else {
i2 = 2131363489;
}
}
} else {
i2 = 2131363469;
}
} else {
i2 = 2131363462;
}
throw new NullPointerException("Missing required view with ID: ".concat(inflate2.getResources().getResourceName(i2)));
}
tabItems = component10;
configureGuildIcon(component1, component4, component3);
configureGuildBanner(component7);
configureGuildContent(component2, component5, component6);
configureMemberCount(component8, component9);
configureTabItems(component1, tabItems, component14);
if (!component14) {
}
}
private final void constrainIconToBanner() {
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(getBinding().d);
CardView cardView = getBinding().j;
m.checkNotNullExpressionValue(cardView, "binding.guildProfileSheetIconCard");
constraintSet.clear(cardView.getId(), 3);
CardView cardView2 = getBinding().j;
m.checkNotNullExpressionValue(cardView2, "binding.guildProfileSheetIconCard");
constraintSet.clear(cardView2.getId(), 4);
CardView cardView3 = getBinding().j;
m.checkNotNullExpressionValue(cardView3, "binding.guildProfileSheetIconCard");
int id2 = cardView3.getId();
SimpleDraweeView simpleDraweeView = getBinding().b;
m.checkNotNullExpressionValue(simpleDraweeView, "binding.guildProfileSheetBanner");
constraintSet.connect(id2, 3, simpleDraweeView.getId(), 4);
CardView cardView4 = getBinding().j;
m.checkNotNullExpressionValue(cardView4, "binding.guildProfileSheetIconCard");
int id3 = cardView4.getId();
SimpleDraweeView simpleDraweeView2 = getBinding().b;
m.checkNotNullExpressionValue(simpleDraweeView2, "binding.guildProfileSheetBanner");
constraintSet.connect(id3, 4, simpleDraweeView2.getId(), 4);
constraintSet.applyTo(getBinding().d);
}
private final void constrainIconToParent() {
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(getBinding().d);
CardView cardView = getBinding().j;
m.checkNotNullExpressionValue(cardView, "binding.guildProfileSheetIconCard");
constraintSet.clear(cardView.getId(), 3);
CardView cardView2 = getBinding().j;
m.checkNotNullExpressionValue(cardView2, "binding.guildProfileSheetIconCard");
constraintSet.clear(cardView2.getId(), 4);
CardView cardView3 = getBinding().j;
m.checkNotNullExpressionValue(cardView3, "binding.guildProfileSheetIconCard");
int id2 = cardView3.getId();
ConstraintLayout constraintLayout = getBinding().d;
m.checkNotNullExpressionValue(constraintLayout, "binding.guildProfileSheetConstraintLayout");
int id3 = constraintLayout.getId();
CardView cardView4 = getBinding().j;
m.checkNotNullExpressionValue(cardView4, "binding.guildProfileSheetIconCard");
ViewGroup.LayoutParams layoutParams = cardView4.getLayoutParams();
if (!(layoutParams instanceof ViewGroup.MarginLayoutParams)) {
layoutParams = null;
}
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) layoutParams;
constraintSet.connect(id2, 3, id3, 3, marginLayoutParams != null ? marginLayoutParams.topMargin : 0);
constraintSet.applyTo(getBinding().d);
}
private final Unit dismissAlert() {
Unit unit;
AlertDialog alertDialog = this.dialog;
if (alertDialog != null) {
alertDialog.dismiss();
unit = Unit.a;
} else {
unit = null;
}
hideKeyboard(getView());
return unit;
}
private final WidgetGuildProfileSheetBinding getBinding() {
return (WidgetGuildProfileSheetBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
}
private final WidgetGuildProfileSheetViewModel getViewModel() {
return (WidgetGuildProfileSheetViewModel) this.viewModel$delegate.getValue();
}
private final void handleDismissAndShowToast(WidgetGuildProfileSheetViewModel.Event.DismissAndShowToast dismissAndShowToast) {
o.i(this, dismissAndShowToast.getStringRes(), 0, 4);
dismiss();
}
private final void handleEvent(WidgetGuildProfileSheetViewModel.Event event) {
if (event instanceof WidgetGuildProfileSheetViewModel.Event.DismissAndShowToast) {
handleDismissAndShowToast((WidgetGuildProfileSheetViewModel.Event.DismissAndShowToast) event);
}
}
private final void handleViewState(WidgetGuildProfileSheetViewModel.ViewState viewState) {
if (viewState instanceof WidgetGuildProfileSheetViewModel.ViewState.Loading) {
showLoadingView();
} else if (viewState instanceof WidgetGuildProfileSheetViewModel.ViewState.Invalid) {
dismiss();
} else if (viewState instanceof WidgetGuildProfileSheetViewModel.ViewState.Loaded) {
updateView((WidgetGuildProfileSheetViewModel.ViewState.Loaded) viewState);
} else {
throw new NoWhenBranchMatchedException();
}
}
private final void launchInvite(long j) {
WidgetGuildInviteShare.Companion companion = WidgetGuildInviteShare.Companion;
Context context = getContext();
if (context != null) {
m.checkNotNullExpressionValue(context, "context ?: return");
FragmentManager parentFragmentManager = getParentFragmentManager();
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
WidgetGuildInviteShare.Companion.launch$default(companion, context, parentFragmentManager, j, null, false, "Guild Profile", 24, null);
}
}
private final int maxEmojisPerRow() {
Resources resources = getResources();
m.checkNotNullExpressionValue(resources, "resources");
int i = resources.getDisplayMetrics().widthPixels;
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding = this.guildActionBinding;
if (widgetGuildProfileActionsBinding == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
CardView cardView = widgetGuildProfileActionsBinding.k;
m.checkNotNullExpressionValue(cardView, "guildActionBinding.guildProfileSheetEmojisCard");
int contentPaddingLeft = cardView.getContentPaddingLeft();
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding2 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding2 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
CardView cardView2 = widgetGuildProfileActionsBinding2.k;
m.checkNotNullExpressionValue(cardView2, "guildActionBinding.guildProfileSheetEmojisCard");
int contentPaddingRight = cardView2.getContentPaddingRight() + contentPaddingLeft;
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding3 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding3 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
LinearLayout linearLayout = widgetGuildProfileActionsBinding3.d;
m.checkNotNullExpressionValue(linearLayout, "guildActionBinding.guild…ofileSheetBottomContainer");
int paddingStart = linearLayout.getPaddingStart();
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding4 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding4 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
LinearLayout linearLayout2 = widgetGuildProfileActionsBinding4.d;
m.checkNotNullExpressionValue(linearLayout2, "guildActionBinding.guild…ofileSheetBottomContainer");
return ((i - contentPaddingRight) - (linearLayout2.getPaddingEnd() + paddingStart)) / getResources().getDimensionPixelSize(2131165397);
}
public static final void show(FragmentManager fragmentManager, boolean z2, long j, long j2) {
Companion.show(fragmentManager, z2, j, j2);
}
private final void showChangeNicknameDialog(long j, String str) {
int i = 0;
View inflate = getLayoutInflater().inflate(2131558902, (ViewGroup) null, false);
int i2 = 2131362417;
MaterialButton materialButton = (MaterialButton) inflate.findViewById(2131362417);
if (materialButton != null) {
i2 = 2131362418;
TextInputLayout textInputLayout = (TextInputLayout) inflate.findViewById(2131362418);
if (textInputLayout != null) {
i2 = 2131362419;
TextView textView = (TextView) inflate.findViewById(2131362419);
if (textView != null) {
i2 = 2131362420;
MaterialButton materialButton2 = (MaterialButton) inflate.findViewById(2131362420);
if (materialButton2 != null) {
LinearLayout linearLayout = (LinearLayout) inflate;
WidgetChannelsListActionsChangeNicknameBinding widgetChannelsListActionsChangeNicknameBinding = new WidgetChannelsListActionsChangeNicknameBinding(linearLayout, materialButton, textInputLayout, textView, materialButton2);
m.checkNotNullExpressionValue(widgetChannelsListActionsChangeNicknameBinding, "WidgetChannelsListAction…outInflater, null, false)");
materialButton.setOnClickListener(new WidgetGuildProfileSheet$showChangeNicknameDialog$1(this));
m.checkNotNullExpressionValue(textInputLayout, "binding.channelsListActionsChangeNicknameEditText");
ViewExtensions.setText(textInputLayout, str);
m.checkNotNullExpressionValue(textInputLayout, "binding.channelsListActionsChangeNicknameEditText");
ViewExtensions.setSelectionEnd(textInputLayout);
materialButton2.setOnClickListener(new WidgetGuildProfileSheet$showChangeNicknameDialog$2(this, j, widgetChannelsListActionsChangeNicknameBinding));
m.checkNotNullExpressionValue(textView, "binding.channelsListActionsChangeNicknameReset");
if (!(!(str == null || t.isBlank(str)))) {
i = 8;
}
textView.setVisibility(i);
textView.setOnClickListener(new WidgetGuildProfileSheet$showChangeNicknameDialog$3(this, j));
m.checkNotNullExpressionValue(linearLayout, "binding.root");
AlertDialog create = new AlertDialog.Builder(linearLayout.getContext()).setView(linearLayout).create();
create.show();
this.dialog = create;
return;
}
}
}
}
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i2)));
}
private final void showLeaveServerDialog(long j) {
WidgetLeaveGuildDialog.Companion companion = WidgetLeaveGuildDialog.Companion;
FragmentManager parentFragmentManager = getParentFragmentManager();
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
companion.show(parentFragmentManager, j);
dismissAlert();
}
private final void showLoadingView() {
AppViewFlipper appViewFlipper = getBinding().g;
m.checkNotNullExpressionValue(appViewFlipper, "binding.guildProfileSheetFlipper");
appViewFlipper.setDisplayedChild(0);
}
private final void updateView(WidgetGuildProfileSheetViewModel.ViewState.Loaded loaded) {
AppViewFlipper appViewFlipper = getBinding().g;
m.checkNotNullExpressionValue(appViewFlipper, "binding.guildProfileSheetFlipper");
appViewFlipper.setDisplayedChild(1);
configureUI(loaded);
}
@Override // com.discord.app.AppBottomSheet
public int getContentViewResId() {
return 2131559067;
}
@Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment
public void onViewCreated(View view, Bundle bundle) {
m.checkNotNullParameter(view, "view");
super.onViewCreated(view, bundle);
this.channelId = Long.valueOf(getArgumentsOrDefault().getLong("com.discord.intent.extra.EXTRA_CHANNEL_ID"));
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(getViewModel().observeViewState(), this, null, 2, null), WidgetGuildProfileSheet.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetGuildProfileSheet$onViewCreated$1(this), 62, (Object) null);
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(getViewModel().observeEvents(), this, null, 2, null), WidgetGuildProfileSheet.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetGuildProfileSheet$onViewCreated$2(this), 62, (Object) null);
this.emojisAdapter.setOnClickEmoji(new WidgetGuildProfileSheet$onViewCreated$3(this));
}
}