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

1066 lines
73 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 b.a.d.f0;
import b.a.d.h0;
import b.a.k.b;
import b.d.b.a.a;
import com.discord.R;
import com.discord.app.AppBottomSheet;
import com.discord.app.AppViewFlipper;
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.models.user.MeUser;
import com.discord.utilities.color.ColorCompat;
import com.discord.utilities.color.ColorCompatKt;
import com.discord.utilities.dimen.DimenUtils;
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.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.discord.widgets.stage.start.StageEventsGuildsFeatureFlag;
import com.facebook.drawee.view.SimpleDraweeView;
import com.google.android.material.button.MaterialButton;
import d0.g;
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.b0(WidgetGuildProfileSheet.class, "binding", "getBinding()Lcom/discord/databinding/WidgetGuildProfileSheetBinding;", 0)};
public static final Companion Companion = new Companion(null);
private static final String EXTRA_FROM_UPSELL = "EXTRA_FROM_UPSELL";
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 final Lazy fromGuildEventUpsell$delegate;
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, boolean z3, int i, Object obj) {
companion.show(fragmentManager, z2, j, (i & 8) != 0 ? 0 : j2, (i & 16) != 0 ? false : z3);
}
public final void show(FragmentManager fragmentManager, boolean z2, long j, long j2, boolean z3) {
m.checkNotNullParameter(fragmentManager, "fragmentManager");
WidgetGuildProfileSheet widgetGuildProfileSheet = new WidgetGuildProfileSheet();
Bundle I = a.I("com.discord.intent.extra.EXTRA_GUILD_ID", j);
I.putLong("com.discord.intent.extra.EXTRA_CHANNEL_ID", j2);
I.putBoolean("com.discord.intent.extra.EXTRA_VIEWING_GUILD", z2);
I.putBoolean(WidgetGuildProfileSheet.EXTRA_FROM_UPSELL, z3);
widgetGuildProfileSheet.setArguments(I);
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);
f0 f0Var = new f0(this);
this.viewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(WidgetGuildProfileSheetViewModel.class), new WidgetGuildProfileSheet$appViewModels$$inlined$viewModels$1(f0Var), new h0(widgetGuildProfileSheet$viewModel$2));
this.fromGuildEventUpsell$delegate = g.lazy(new WidgetGuildProfileSheet$fromGuildEventUpsell$2(this));
this.emojisAdapter = new WidgetGuildProfileSheetEmojisAdapter();
}
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$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.e;
m.checkNotNullExpressionValue(linearLayout, "guildActionBinding.guildProfileSheetBottomActions");
linearLayout.setVisibility(0);
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding2 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding2 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
View view = widgetGuildProfileActionsBinding2.f2408z;
view.setVisibility(showUploadEmoji ? 0 : 8);
setOnClickAndDismissListener(view, new WidgetGuildProfileSheet$configureBottomActions$$inlined$apply$lambda$1(this, showUploadEmoji, j));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding3 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding3 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
MaterialButton materialButton = widgetGuildProfileActionsBinding3.r;
materialButton.setVisibility(showJoinServer ? 0 : 8);
setOnClickAndDismissListener(materialButton, new WidgetGuildProfileSheet$configureBottomActions$$inlined$apply$lambda$2(materialButton, this, showJoinServer, j));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding4 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding4 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
View view2 = widgetGuildProfileActionsBinding4.A;
if (showViewServer) {
i = 0;
}
view2.setVisibility(i);
setOnClickAndDismissListener(view2, new WidgetGuildProfileSheet$configureBottomActions$$inlined$apply$lambda$3(this, showViewServer, j, l));
m.checkNotNullExpressionValue(view2, "guildActionBinding.guild…dId, channelId) }\n }");
return;
}
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding5 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding5 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
LinearLayout linearLayout2 = widgetGuildProfileActionsBinding5.e;
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.o;
m.checkNotNullExpressionValue(textView, "guildActionBinding.guildProfileSheetEmojisCount");
Resources resources = getResources();
m.checkNotNullExpressionValue(resources, "resources");
textView.setText(StringResourceUtilsKt.getQuantityString(resources, (int) R.plurals.emojis_title_count, (int) R.string.no_emoji_title, size, Integer.valueOf(size)));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding2 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding2 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
ImageView imageView = widgetGuildProfileActionsBinding2.w;
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.f2406x;
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.n;
m.checkNotNullExpressionValue(cardView, "guildActionBinding.guildProfileSheetEmojisCard");
cardView.setVisibility(0);
int maxEmojisPerRow = maxEmojisPerRow();
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding5 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding5 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
RecyclerView recyclerView = widgetGuildProfileActionsBinding5.m;
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.n;
m.checkNotNullExpressionValue(cardView2, "guildActionBinding.guildProfileSheetEmojisCard");
cardView2.setVisibility(8);
}
private final void configureGuildActions(long j, long j2, WidgetGuildProfileSheetViewModel.Actions actions) {
if (actions == null) {
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding = this.guildActionBinding;
if (widgetGuildProfileActionsBinding == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
LinearLayout linearLayout = widgetGuildProfileActionsBinding.c;
m.checkNotNullExpressionValue(linearLayout, "guildActionBinding.guildProfileSheetActions");
linearLayout.setVisibility(8);
return;
}
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding2 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding2 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
LinearLayout linearLayout2 = widgetGuildProfileActionsBinding2.c;
m.checkNotNullExpressionValue(linearLayout2, "guildActionBinding.guildProfileSheetActions");
linearLayout2.setVisibility(0);
boolean isUnread = actions.isUnread();
boolean canManageChannels = actions.getCanManageChannels();
boolean canManageEvents = actions.getCanManageEvents();
String nick = actions.getNick();
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding3 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding3 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
CardView cardView = widgetGuildProfileActionsBinding3.u;
m.checkNotNullExpressionValue(cardView, "guildActionBinding.guild…fileSheetMarkAsReadAction");
cardView.setVisibility(isUnread ? 0 : 8);
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding4 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding4 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
widgetGuildProfileActionsBinding4.t.setOnClickListener(new WidgetGuildProfileSheet$configureGuildActions$1(this, j));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding5 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding5 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
CardView cardView2 = widgetGuildProfileActionsBinding5.f2407y;
m.checkNotNullExpressionValue(cardView2, "guildActionBinding.guildProfileSheetPrimaryActions");
cardView2.setVisibility(canManageChannels || (canManageEvents && StageEventsGuildsFeatureFlag.Companion.getINSTANCE().canGuildAccessStageEvents(j)) ? 0 : 8);
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding6 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding6 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
TextView textView = widgetGuildProfileActionsBinding6.h;
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.i;
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");
}
ConstraintLayout constraintLayout = widgetGuildProfileActionsBinding8.j;
constraintLayout.setVisibility(canManageEvents && StageEventsGuildsFeatureFlag.Companion.getINSTANCE().canGuildAccessStageEvents(j) ? 0 : 8);
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding9 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding9 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
TextView textView3 = widgetGuildProfileActionsBinding9.k;
m.checkNotNullExpressionValue(textView3, "guildActionBinding.guildProfileSheetCreateEventNew");
textView3.setVisibility(getFromGuildEventUpsell() ? 0 : 8);
setOnClickAndDismissListener(constraintLayout, new WidgetGuildProfileSheet$configureGuildActions$$inlined$apply$lambda$3(constraintLayout, this, canManageEvents, j));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding10 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding10 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
setOnClickAndDismissListener(widgetGuildProfileActionsBinding10.f2404b, new WidgetGuildProfileSheet$configureGuildActions$$inlined$apply$lambda$4(this, j));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding11 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding11 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
TextView textView4 = widgetGuildProfileActionsBinding11.v;
textView4.setVisibility(actions.getDisplayGuildIdentityRow() ? 0 : 8);
if (nick == null) {
nick = actions.getUsername();
}
textView4.setText(nick);
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding12 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding12 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
SimpleDraweeView simpleDraweeView = widgetGuildProfileActionsBinding12.p;
String guildAvatar = actions.getGuildAvatar();
simpleDraweeView.setVisibility((guildAvatar == null || guildAvatar.length() == 0) ^ true ? 0 : 8);
simpleDraweeView.setImageURI(IconUtils.INSTANCE.getForGuildMember(actions.getGuildAvatar(), j, j2, Integer.valueOf(DimenUtils.dpToPixels(16)), false));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding13 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding13 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
LinearLayout linearLayout3 = widgetGuildProfileActionsBinding13.B;
m.checkNotNullExpressionValue(linearLayout3, "guildActionBinding.perGuildIdentityContainer");
linearLayout3.setVisibility(actions.getDisplayGuildIdentityRow() ? 0 : 8);
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding14 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding14 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
CheckedSetting checkedSetting = widgetGuildProfileActionsBinding14.d;
checkedSetting.setChecked(actions.isAllowDMChecked());
checkedSetting.setOnCheckedListener(new WidgetGuildProfileSheet$configureGuildActions$$inlined$apply$lambda$5(this, actions, j));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding15 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding15 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
CheckedSetting checkedSetting2 = widgetGuildProfileActionsBinding15.q;
checkedSetting2.setChecked(actions.getHideMutedChannels());
checkedSetting2.setOnCheckedListener(new WidgetGuildProfileSheet$configureGuildActions$$inlined$apply$lambda$6(this, actions, j));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding16 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding16 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
View view = widgetGuildProfileActionsBinding16.f2405s;
view.setVisibility(actions.getCanLeaveGuild() ? 0 : 8);
setOnClickAndDismissListener(view, new WidgetGuildProfileSheet$configureGuildActions$$inlined$apply$lambda$7(this, actions, j));
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding17 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding17 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
CardView cardView3 = widgetGuildProfileActionsBinding17.l;
m.checkNotNullExpressionValue(cardView3, "guildActionBinding.guild…fileSheetDeveloperActions");
cardView3.setVisibility(actions.isDeveloper() ? 0 : 8);
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding18 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding18 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
widgetGuildProfileActionsBinding18.g.setOnClickListener(new WidgetGuildProfileSheet$configureGuildActions$11(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.getBannerForGuild$default(IconUtils.INSTANCE, Long.valueOf(banner.getGuildId()), banner.getHash(), Integer.valueOf(getResources().getDimensionPixelSize(R.dimen.nav_panel_width)), false, 8, null);
} else if (ordinal == 1) {
str = IconUtils.INSTANCE.getGuildSplashUrl(banner.getGuildId(), banner.getHash(), Integer.valueOf(getResources().getDimensionPixelSize(R.dimen.nav_panel_width)));
} else {
throw new NoWhenBranchMatchedException();
}
SimpleDraweeView simpleDraweeView = getBinding().f2410b;
m.checkNotNullExpressionValue(simpleDraweeView, "binding.guildProfileSheetBanner");
MGImages.setImage$default(simpleDraweeView, str, 0, 0, false, null, null, 124, null);
SimpleDraweeView simpleDraweeView2 = getBinding().f2410b;
m.checkNotNullExpressionValue(simpleDraweeView2, "binding.guildProfileSheetBanner");
simpleDraweeView2.setVisibility(0);
constrainIconToBanner();
return;
}
SimpleDraweeView simpleDraweeView3 = getBinding().f2410b;
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, long j2, WidgetGuildProfileSheetViewModel.Actions actions) {
if (actions != null) {
WidgetGuildHubProfileActionsBinding widgetGuildHubProfileActionsBinding = this.guildHubActionBinding;
if (widgetGuildHubProfileActionsBinding == null) {
m.throwUninitializedPropertyAccessException("guildHubActionBinding");
}
widgetGuildHubProfileActionsBinding.d.setOnClickListener(new WidgetGuildProfileSheet$configureGuildHubActions$1(this, j));
WidgetGuildHubProfileActionsBinding widgetGuildHubProfileActionsBinding2 = this.guildHubActionBinding;
if (widgetGuildHubProfileActionsBinding2 == null) {
m.throwUninitializedPropertyAccessException("guildHubActionBinding");
}
View view = widgetGuildHubProfileActionsBinding2.f2393b;
m.checkNotNullExpressionValue(view, "guildHubActionBinding.gu…rofileSheetChangeNickname");
setOnClickAndDismissListener(view, new WidgetGuildProfileSheet$configureGuildHubActions$2(j));
WidgetGuildHubProfileActionsBinding widgetGuildHubProfileActionsBinding3 = this.guildHubActionBinding;
if (widgetGuildHubProfileActionsBinding3 == null) {
m.throwUninitializedPropertyAccessException("guildHubActionBinding");
}
TextView textView = widgetGuildHubProfileActionsBinding3.f;
int i = 8;
textView.setVisibility(actions.getDisplayGuildIdentityRow() ? 0 : 8);
String nick = actions.getNick();
if (nick == null) {
nick = actions.getUsername();
}
textView.setText(nick);
WidgetGuildHubProfileActionsBinding widgetGuildHubProfileActionsBinding4 = this.guildHubActionBinding;
if (widgetGuildHubProfileActionsBinding4 == null) {
m.throwUninitializedPropertyAccessException("guildHubActionBinding");
}
SimpleDraweeView simpleDraweeView = widgetGuildHubProfileActionsBinding4.c;
String guildAvatar = actions.getGuildAvatar();
simpleDraweeView.setVisibility((guildAvatar == null || guildAvatar.length() == 0) ^ true ? 0 : 8);
simpleDraweeView.setImageURI(IconUtils.INSTANCE.getForGuildMember(actions.getGuildAvatar(), j, j2, Integer.valueOf(DimenUtils.dpToPixels(16)), false));
WidgetGuildHubProfileActionsBinding widgetGuildHubProfileActionsBinding5 = this.guildHubActionBinding;
if (widgetGuildHubProfileActionsBinding5 == null) {
m.throwUninitializedPropertyAccessException("guildHubActionBinding");
}
View view2 = widgetGuildHubProfileActionsBinding5.e;
if (actions.getCanLeaveGuild()) {
i = 0;
}
view2.setVisibility(i);
setOnClickAndDismissListener(view2, new WidgetGuildProfileSheet$configureGuildHubActions$$inlined$apply$lambda$1(this, actions, j));
WidgetGuildHubProfileActionsBinding widgetGuildHubProfileActionsBinding6 = this.guildHubActionBinding;
if (widgetGuildHubProfileActionsBinding6 == null) {
m.throwUninitializedPropertyAccessException("guildHubActionBinding");
}
TextView textView2 = widgetGuildHubProfileActionsBinding6.g;
textView2.setVisibility(0);
setOnClickAndDismissListener(textView2, new WidgetGuildProfileSheet$configureGuildHubActions$$inlined$apply$lambda$2(textView2, this, 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(R.dimen.avatar_size_xxlarge))), 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, IconUtils.DEFAULT_ICON_BLURPLE, 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.n(textView, R.string.instant_invite_guild_members_online, 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, (int) R.plurals.instant_invite_guild_members_total_count, num2.intValue(), num2);
TextView textView2 = getBinding().n;
m.checkNotNullExpressionValue(textView2, "binding.guildProfileSheetMemberCountText");
b.n(textView2, R.string.instant_invite_guild_members_total, 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, (int) R.attr.colorInteractiveNormal);
MaterialButton materialButton = getBinding().c;
Resources resources = materialButton.getResources();
m.checkNotNullExpressionValue(resources, "resources");
materialButton.setText(StringResourceUtilsKt.getQuantityString(resources, (int) R.plurals.premium_guild_perks_modal_header_subscription_count_subscriptions, (int) R.string.premium_guild_subscription, 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().f2411s;
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:125:0x0347 */
/* JADX WARNING: Removed duplicated region for block: B:126:0x0354 */
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();
MeUser component15 = loaded.component15();
if (!component14 || this.guildHubActionBinding != null) {
actions = component11;
if (!component14 && this.guildActionBinding == null) {
View inflate = getBinding().v.inflate();
LinearLayout linearLayout = (LinearLayout) inflate.findViewById(R.id.change_identity);
if (linearLayout != null) {
TextView textView = (TextView) inflate.findViewById(R.id.change_identity_header);
if (textView != null) {
LinearLayout linearLayout2 = (LinearLayout) inflate.findViewById(R.id.guild_profile_sheet_actions);
if (linearLayout2 != null) {
CheckedSetting checkedSetting = (CheckedSetting) inflate.findViewById(R.id.guild_profile_sheet_allow_dm);
if (checkedSetting != null) {
LinearLayout linearLayout3 = (LinearLayout) inflate.findViewById(R.id.guild_profile_sheet_bottom_actions);
if (linearLayout3 != null) {
LinearLayout linearLayout4 = (LinearLayout) inflate;
TextView textView2 = (TextView) inflate.findViewById(R.id.guild_profile_sheet_copy_id);
if (textView2 != null) {
TextView textView3 = (TextView) inflate.findViewById(R.id.guild_profile_sheet_create_category);
if (textView3 != null) {
TextView textView4 = (TextView) inflate.findViewById(R.id.guild_profile_sheet_create_channel);
if (textView4 != null) {
ConstraintLayout constraintLayout = (ConstraintLayout) inflate.findViewById(R.id.guild_profile_sheet_create_event);
if (constraintLayout != null) {
TextView textView5 = (TextView) inflate.findViewById(R.id.guild_profile_sheet_create_event_label);
if (textView5 != null) {
TextView textView6 = (TextView) inflate.findViewById(R.id.guild_profile_sheet_create_event_new);
if (textView6 != null) {
CardView cardView = (CardView) inflate.findViewById(R.id.guild_profile_sheet_developer_actions);
if (cardView != null) {
RecyclerView recyclerView = (RecyclerView) inflate.findViewById(R.id.guild_profile_sheet_emojis);
if (recyclerView != null) {
tabItems = component10;
i = R.id.guild_profile_sheet_emojis_card;
CardView cardView2 = (CardView) inflate.findViewById(R.id.guild_profile_sheet_emojis_card);
if (cardView2 != null) {
TextView textView7 = (TextView) inflate.findViewById(R.id.guild_profile_sheet_emojis_count);
if (textView7 != null) {
i = R.id.guild_profile_sheet_guild_avatar;
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) inflate.findViewById(R.id.guild_profile_sheet_guild_avatar);
if (simpleDraweeView != null) {
i = R.id.guild_profile_sheet_hide_muted_channels;
CheckedSetting checkedSetting2 = (CheckedSetting) inflate.findViewById(R.id.guild_profile_sheet_hide_muted_channels);
if (checkedSetting2 != null) {
MaterialButton materialButton = (MaterialButton) inflate.findViewById(R.id.guild_profile_sheet_join_server);
if (materialButton != null) {
i = R.id.guild_profile_sheet_leave_server;
TextView textView8 = (TextView) inflate.findViewById(R.id.guild_profile_sheet_leave_server);
if (textView8 != null) {
i = R.id.guild_profile_sheet_mark_as_read;
TextView textView9 = (TextView) inflate.findViewById(R.id.guild_profile_sheet_mark_as_read);
if (textView9 != null) {
CardView cardView3 = (CardView) inflate.findViewById(R.id.guild_profile_sheet_mark_as_read_action);
if (cardView3 != null) {
i = R.id.guild_profile_sheet_nickname;
TextView textView10 = (TextView) inflate.findViewById(R.id.guild_profile_sheet_nickname);
if (textView10 != null) {
i = R.id.guild_profile_sheet_premium_upsell_dot_separator;
ImageView imageView = (ImageView) inflate.findViewById(R.id.guild_profile_sheet_premium_upsell_dot_separator);
if (imageView != null) {
i = R.id.guild_profile_sheet_premium_upsell_text;
TextView textView11 = (TextView) inflate.findViewById(R.id.guild_profile_sheet_premium_upsell_text);
if (textView11 != null) {
CardView cardView4 = (CardView) inflate.findViewById(R.id.guild_profile_sheet_primary_actions);
if (cardView4 != null) {
i = R.id.guild_profile_sheet_secondary_actions;
CardView cardView5 = (CardView) inflate.findViewById(R.id.guild_profile_sheet_secondary_actions);
if (cardView5 != null) {
i = R.id.guild_profile_sheet_upload_emoji;
MaterialButton materialButton2 = (MaterialButton) inflate.findViewById(R.id.guild_profile_sheet_upload_emoji);
if (materialButton2 != null) {
MaterialButton materialButton3 = (MaterialButton) inflate.findViewById(R.id.guild_profile_sheet_view_server);
if (materialButton3 != null) {
i = R.id.per_guild_identity_container;
LinearLayout linearLayout5 = (LinearLayout) inflate.findViewById(R.id.per_guild_identity_container);
if (linearLayout5 != null) {
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding = new WidgetGuildProfileActionsBinding(linearLayout4, linearLayout, textView, linearLayout2, checkedSetting, linearLayout3, linearLayout4, textView2, textView3, textView4, constraintLayout, textView5, textView6, cardView, recyclerView, cardView2, textView7, simpleDraweeView, checkedSetting2, materialButton, textView8, textView9, cardView3, textView10, imageView, textView11, cardView4, cardView5, materialButton2, materialButton3, linearLayout5);
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, component15.getId(), actions);
return;
}
configureGuildActions(component1, component15.getId(), actions);
configureEmojis(component12);
configureBottomActions(component1, this.channelId, component13);
return;
}
} else {
i = R.id.guild_profile_sheet_view_server;
}
}
}
} else {
i = R.id.guild_profile_sheet_primary_actions;
}
}
}
}
} else {
i = R.id.guild_profile_sheet_mark_as_read_action;
}
}
}
} else {
i = R.id.guild_profile_sheet_join_server;
}
}
}
} else {
i = R.id.guild_profile_sheet_emojis_count;
}
}
} else {
i = R.id.guild_profile_sheet_emojis;
}
} else {
i = R.id.guild_profile_sheet_developer_actions;
}
} else {
i = R.id.guild_profile_sheet_create_event_new;
}
} else {
i = R.id.guild_profile_sheet_create_event_label;
}
} else {
i = R.id.guild_profile_sheet_create_event;
}
} else {
i = R.id.guild_profile_sheet_create_channel;
}
} else {
i = R.id.guild_profile_sheet_create_category;
}
} else {
i = R.id.guild_profile_sheet_copy_id;
}
} else {
i = R.id.guild_profile_sheet_bottom_actions;
}
} else {
i = R.id.guild_profile_sheet_allow_dm;
}
} else {
i = R.id.guild_profile_sheet_actions;
}
} else {
i = R.id.change_identity_header;
}
} else {
i = R.id.change_identity;
}
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i)));
}
} else {
View inflate2 = getBinding().u.inflate();
actions = component11;
LinearLayout linearLayout6 = (LinearLayout) inflate2.findViewById(R.id.guild_profile_sheet_actions);
if (linearLayout6 != null) {
LinearLayout linearLayout7 = (LinearLayout) inflate2;
LinearLayout linearLayout8 = (LinearLayout) inflate2.findViewById(R.id.guild_profile_sheet_change_nickname);
if (linearLayout8 != null) {
SimpleDraweeView simpleDraweeView2 = (SimpleDraweeView) inflate2.findViewById(R.id.guild_profile_sheet_guild_avatar);
if (simpleDraweeView2 != null) {
i2 = R.id.guild_profile_sheet_invite;
TextView textView12 = (TextView) inflate2.findViewById(R.id.guild_profile_sheet_invite);
if (textView12 != null) {
CardView cardView6 = (CardView) inflate2.findViewById(R.id.guild_profile_sheet_invite_action);
if (cardView6 != null) {
TextView textView13 = (TextView) inflate2.findViewById(R.id.guild_profile_sheet_leave_server);
if (textView13 != null) {
TextView textView14 = (TextView) inflate2.findViewById(R.id.guild_profile_sheet_nickname);
if (textView14 != null) {
TextView textView15 = (TextView) inflate2.findViewById(R.id.guild_profile_sheet_notifications);
if (textView15 != null) {
CardView cardView7 = (CardView) inflate2.findViewById(R.id.guild_profile_sheet_secondary_actions);
if (cardView7 != null) {
LinearLayout linearLayout9 = (LinearLayout) inflate2.findViewById(R.id.per_guild_identity_container);
if (linearLayout9 != null) {
WidgetGuildHubProfileActionsBinding widgetGuildHubProfileActionsBinding = new WidgetGuildHubProfileActionsBinding(linearLayout7, linearLayout6, linearLayout7, linearLayout8, simpleDraweeView2, textView12, cardView6, textView13, textView14, textView15, cardView7, linearLayout9);
m.checkNotNullExpressionValue(widgetGuildHubProfileActionsBinding, "WidgetGuildHubProfileActionsBinding.bind(view)");
this.guildHubActionBinding = widgetGuildHubProfileActionsBinding;
} else {
i2 = R.id.per_guild_identity_container;
}
} else {
i2 = R.id.guild_profile_sheet_secondary_actions;
}
} else {
i2 = R.id.guild_profile_sheet_notifications;
}
} else {
i2 = R.id.guild_profile_sheet_nickname;
}
} else {
i2 = R.id.guild_profile_sheet_leave_server;
}
} else {
i2 = R.id.guild_profile_sheet_invite_action;
}
}
} else {
i2 = R.id.guild_profile_sheet_guild_avatar;
}
} else {
i2 = R.id.guild_profile_sheet_change_nickname;
}
} else {
i2 = R.id.guild_profile_sheet_actions;
}
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().f2410b;
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().f2410b;
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();
ViewGroup.MarginLayoutParams marginLayoutParams = layoutParams instanceof ViewGroup.MarginLayoutParams ? (ViewGroup.MarginLayoutParams) layoutParams : null;
constraintSet.connect(id2, 3, id3, 3, marginLayoutParams == null ? 0 : marginLayoutParams.topMargin);
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 boolean getFromGuildEventUpsell() {
return ((Boolean) this.fromGuildEventUpsell$delegate.getValue()).booleanValue();
}
private final WidgetGuildProfileSheetViewModel getViewModel() {
return (WidgetGuildProfileSheetViewModel) this.viewModel$delegate.getValue();
}
private final void handleDismissAndShowToast(WidgetGuildProfileSheetViewModel.Event.DismissAndShowToast dismissAndShowToast) {
b.a.d.m.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, null, null, "Guild Profile", 120, 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.n;
m.checkNotNullExpressionValue(cardView, "guildActionBinding.guildProfileSheetEmojisCard");
int contentPaddingLeft = cardView.getContentPaddingLeft();
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding2 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding2 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
CardView cardView2 = widgetGuildProfileActionsBinding2.n;
m.checkNotNullExpressionValue(cardView2, "guildActionBinding.guildProfileSheetEmojisCard");
int contentPaddingRight = cardView2.getContentPaddingRight() + contentPaddingLeft;
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding3 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding3 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
LinearLayout linearLayout = widgetGuildProfileActionsBinding3.f;
m.checkNotNullExpressionValue(linearLayout, "guildActionBinding.guild…ofileSheetBottomContainer");
int paddingStart = linearLayout.getPaddingStart();
WidgetGuildProfileActionsBinding widgetGuildProfileActionsBinding4 = this.guildActionBinding;
if (widgetGuildProfileActionsBinding4 == null) {
m.throwUninitializedPropertyAccessException("guildActionBinding");
}
LinearLayout linearLayout2 = widgetGuildProfileActionsBinding4.f;
m.checkNotNullExpressionValue(linearLayout2, "guildActionBinding.guild…ofileSheetBottomContainer");
return ((i - contentPaddingRight) - (linearLayout2.getPaddingEnd() + paddingStart)) / getResources().getDimensionPixelSize(R.dimen.emoji_size);
}
public static final void show(FragmentManager fragmentManager, boolean z2, long j, long j2, boolean z3) {
Companion.show(fragmentManager, z2, j, j2, z3);
}
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 R.layout.widget_guild_profile_sheet;
}
@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.bindToComponentLifecycle$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.bindToComponentLifecycle$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));
}
}