2021-12-17 21:59:34 +00:00
|
|
|
package com.discord.widgets.settings.guildboost;
|
2021-08-03 07:33:18 +00:00
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.text.format.DateFormat;
|
|
|
|
import android.view.ContextThemeWrapper;
|
|
|
|
import android.view.MenuItem;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.ImageView;
|
|
|
|
import android.widget.LinearLayout;
|
|
|
|
import android.widget.PopupMenu;
|
|
|
|
import android.widget.RelativeLayout;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import androidx.annotation.StringRes;
|
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
2021-12-17 21:59:34 +00:00
|
|
|
import b.a.k.b;
|
|
|
|
import b.d.b.a.a;
|
2021-08-09 22:51:56 +00:00
|
|
|
import com.discord.R;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.databinding.ViewSettingsBoostedBoostListitemBinding;
|
|
|
|
import com.discord.databinding.ViewSettingsBoostedGuildListitemBinding;
|
|
|
|
import com.discord.databinding.ViewSettingsBoostedHeaderListitemBinding;
|
2021-12-17 21:59:34 +00:00
|
|
|
import com.discord.models.domain.ModelAppliedGuildBoost;
|
|
|
|
import com.discord.models.domain.ModelGuildBoostSlot;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.models.guild.Guild;
|
2021-08-09 22:51:56 +00:00
|
|
|
import com.discord.utilities.SnowflakeUtils;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.utilities.drawable.DrawableCompat;
|
|
|
|
import com.discord.utilities.icon.IconUtils;
|
|
|
|
import com.discord.utilities.images.MGImages;
|
|
|
|
import com.discord.utilities.mg_recycler.MGRecyclerAdapterSimple;
|
|
|
|
import com.discord.utilities.mg_recycler.MGRecyclerDataPayload;
|
|
|
|
import com.discord.utilities.mg_recycler.MGRecyclerViewHolder;
|
|
|
|
import com.discord.utilities.resources.StringResourceUtilsKt;
|
|
|
|
import com.discord.utilities.time.ClockFactory;
|
|
|
|
import com.discord.utilities.time.TimeUtils;
|
|
|
|
import com.discord.utilities.view.extensions.ViewExtensions;
|
2021-12-17 21:59:34 +00:00
|
|
|
import com.discord.views.guildboost.GuildBoostProgressView;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.facebook.drawee.view.SimpleDraweeView;
|
2021-11-02 06:38:17 +00:00
|
|
|
import d0.g0.t;
|
|
|
|
import d0.z.d.m;
|
2021-08-03 07:33:18 +00:00
|
|
|
import java.util.List;
|
|
|
|
import java.util.Objects;
|
|
|
|
import kotlin.Unit;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
|
|
|
import kotlin.jvm.functions.Function2;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
2021-12-17 21:59:34 +00:00
|
|
|
/* compiled from: WidgetSettingsGuildBoostSubscriptionAdapter.kt */
|
|
|
|
public final class WidgetSettingsGuildBoostSubscriptionAdapter extends MGRecyclerAdapterSimple<Item> {
|
2021-08-03 07:33:18 +00:00
|
|
|
private boolean canCancelBoosts;
|
|
|
|
private boolean canUncancelBoosts;
|
2021-12-17 21:59:34 +00:00
|
|
|
private Function2<? super Long, ? super Boolean, Unit> cancelListener = WidgetSettingsGuildBoostSubscriptionAdapter$cancelListener$1.INSTANCE;
|
|
|
|
private Function1<? super Long, Unit> subscribeListener = WidgetSettingsGuildBoostSubscriptionAdapter$subscribeListener$1.INSTANCE;
|
|
|
|
private Function2<? super ModelGuildBoostSlot, ? super Long, Unit> transferListener = WidgetSettingsGuildBoostSubscriptionAdapter$transferListener$1.INSTANCE;
|
2021-08-03 07:33:18 +00:00
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
/* compiled from: WidgetSettingsGuildBoostSubscriptionAdapter.kt */
|
|
|
|
public static final class GuildBoostListItem extends MGRecyclerViewHolder<WidgetSettingsGuildBoostSubscriptionAdapter, Item> {
|
|
|
|
private final ViewSettingsBoostedBoostListitemBinding binding;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public GuildBoostListItem(WidgetSettingsGuildBoostSubscriptionAdapter widgetSettingsGuildBoostSubscriptionAdapter) {
|
|
|
|
super((int) R.layout.view_settings_boosted_boost_listitem, widgetSettingsGuildBoostSubscriptionAdapter);
|
|
|
|
m.checkNotNullParameter(widgetSettingsGuildBoostSubscriptionAdapter, "adapter");
|
|
|
|
View view = this.itemView;
|
|
|
|
int i = R.id.boosted_boost_action;
|
|
|
|
TextView textView = (TextView) view.findViewById(R.id.boosted_boost_action);
|
|
|
|
if (textView != null) {
|
|
|
|
i = R.id.boosted_boost_cancelled;
|
|
|
|
ImageView imageView = (ImageView) view.findViewById(R.id.boosted_boost_cancelled);
|
|
|
|
if (imageView != null) {
|
|
|
|
i = R.id.boosted_boost_cooldown;
|
|
|
|
TextView textView2 = (TextView) view.findViewById(R.id.boosted_boost_cooldown);
|
|
|
|
if (textView2 != null) {
|
|
|
|
i = R.id.boosted_boost_date;
|
|
|
|
TextView textView3 = (TextView) view.findViewById(R.id.boosted_boost_date);
|
|
|
|
if (textView3 != null) {
|
|
|
|
ViewSettingsBoostedBoostListitemBinding viewSettingsBoostedBoostListitemBinding = new ViewSettingsBoostedBoostListitemBinding((RelativeLayout) view, textView, imageView, textView2, textView3);
|
|
|
|
m.checkNotNullExpressionValue(viewSettingsBoostedBoostListitemBinding, "ViewSettingsBoostedBoost…temBinding.bind(itemView)");
|
|
|
|
this.binding = viewSettingsBoostedBoostListitemBinding;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(i)));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ WidgetSettingsGuildBoostSubscriptionAdapter access$getAdapter$p(GuildBoostListItem guildBoostListItem) {
|
|
|
|
return (WidgetSettingsGuildBoostSubscriptionAdapter) guildBoostListItem.adapter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$showGuildBoostPopup(GuildBoostListItem guildBoostListItem, View view, boolean z2, boolean z3, boolean z4, Item.GuildBoostItem guildBoostItem) {
|
|
|
|
guildBoostListItem.showGuildBoostPopup(view, z2, z3, z4, guildBoostItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void showGuildBoostPopup(View view, boolean z2, boolean z3, boolean z4, Item.GuildBoostItem guildBoostItem) {
|
|
|
|
PopupMenu popupMenu = new PopupMenu(new ContextThemeWrapper(view.getContext(), (int) R.style.AppTheme_PopupMenu), view);
|
|
|
|
popupMenu.getMenuInflater().inflate(R.menu.menu_settings_premium_guild_sub, popupMenu.getMenu());
|
|
|
|
MenuItem findItem = popupMenu.getMenu().findItem(R.id.menu_settings_premium_guild_sub_transfer);
|
|
|
|
MenuItem findItem2 = popupMenu.getMenu().findItem(R.id.menu_settings_premium_guild_sub_cancel);
|
|
|
|
MenuItem findItem3 = popupMenu.getMenu().findItem(R.id.menu_settings_premium_guild_sub_uncancel);
|
|
|
|
boolean canceled = guildBoostItem.getBoostSlot().getCanceled();
|
|
|
|
m.checkNotNullExpressionValue(findItem, "transfer");
|
|
|
|
boolean z5 = true;
|
|
|
|
findItem.setVisible(!z2);
|
|
|
|
m.checkNotNullExpressionValue(findItem2, "cancel");
|
|
|
|
findItem2.setVisible(!canceled && z3);
|
|
|
|
m.checkNotNullExpressionValue(findItem3, "uncancel");
|
|
|
|
if (!canceled || !z4) {
|
|
|
|
z5 = false;
|
|
|
|
}
|
|
|
|
findItem3.setVisible(z5);
|
|
|
|
findItem.setOnMenuItemClickListener(new WidgetSettingsGuildBoostSubscriptionAdapter$GuildBoostListItem$showGuildBoostPopup$1(this, guildBoostItem));
|
|
|
|
findItem2.setOnMenuItemClickListener(new WidgetSettingsGuildBoostSubscriptionAdapter$GuildBoostListItem$showGuildBoostPopup$2(this, guildBoostItem));
|
|
|
|
findItem3.setOnMenuItemClickListener(new WidgetSettingsGuildBoostSubscriptionAdapter$GuildBoostListItem$showGuildBoostPopup$3(this, guildBoostItem));
|
|
|
|
popupMenu.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void onConfigure(int i, Item item) {
|
|
|
|
CharSequence charSequence;
|
|
|
|
String str;
|
|
|
|
char c;
|
|
|
|
int i2;
|
|
|
|
String str2;
|
|
|
|
String str3;
|
|
|
|
CharSequence charSequence2;
|
|
|
|
int i3;
|
|
|
|
String boostEndsAt;
|
|
|
|
m.checkNotNullParameter(item, "data");
|
|
|
|
super.onConfigure(i, (int) item);
|
|
|
|
if (item instanceof Item.GuildBoostItem) {
|
|
|
|
View view = this.itemView;
|
|
|
|
m.checkNotNullExpressionValue(view, "itemView");
|
|
|
|
Context context = view.getContext();
|
|
|
|
long currentTimeMillis = ClockFactory.get().currentTimeMillis();
|
|
|
|
Item.GuildBoostItem guildBoostItem = (Item.GuildBoostItem) item;
|
|
|
|
ModelGuildBoostSlot boostSlot = guildBoostItem.getBoostSlot();
|
|
|
|
ModelAppliedGuildBoost premiumGuildSubscription = boostSlot.getPremiumGuildSubscription();
|
|
|
|
boolean z2 = (premiumGuildSubscription != null ? Long.valueOf(premiumGuildSubscription.getGuildId()) : null) != null;
|
|
|
|
boolean z3 = boostSlot.getCooldownExpiresAtTimestamp() > currentTimeMillis;
|
|
|
|
ModelAppliedGuildBoost premiumGuildSubscription2 = boostSlot.getPremiumGuildSubscription();
|
|
|
|
Long valueOf = premiumGuildSubscription2 != null ? Long.valueOf((premiumGuildSubscription2.getId() >>> 22) + SnowflakeUtils.DISCORD_EPOCH) : null;
|
|
|
|
boolean canceled = boostSlot.getCanceled();
|
|
|
|
ImageView imageView = this.binding.c;
|
|
|
|
m.checkNotNullExpressionValue(imageView, "binding.boostedBoostCancelled");
|
|
|
|
imageView.setVisibility(canceled ? 0 : 8);
|
|
|
|
TextView textView = this.binding.e;
|
|
|
|
m.checkNotNullExpressionValue(textView, "binding.boostedBoostDate");
|
|
|
|
if (valueOf == null || (charSequence = DateFormat.format("MMMM dd, yyy", valueOf.longValue())) == null) {
|
|
|
|
charSequence = context.getString(R.string.premium_guild_subscription_unused_slot_description);
|
|
|
|
}
|
|
|
|
textView.setText(charSequence);
|
|
|
|
if (!canceled || (boostEndsAt = guildBoostItem.getBoostEndsAt()) == null) {
|
|
|
|
str = "context";
|
|
|
|
i2 = 0;
|
|
|
|
c = 1;
|
|
|
|
str2 = null;
|
|
|
|
} else {
|
|
|
|
m.checkNotNullExpressionValue(context, "context");
|
|
|
|
str = "context";
|
|
|
|
i2 = 0;
|
|
|
|
c = 1;
|
|
|
|
str2 = t.replace$default(b.h(context, R.string.premium_guild_subscription_pending_cancelation, new Object[]{TimeUtils.renderUtcDate$default(TimeUtils.INSTANCE, boostEndsAt, context, (String) null, (java.text.DateFormat) null, 0, 28, (Object) null)}, null, 4).toString(), "*", "", false, 4, (Object) null);
|
|
|
|
}
|
|
|
|
if (z3) {
|
|
|
|
long max = Math.max(boostSlot.getCooldownExpiresAtTimestamp() - currentTimeMillis, 0L);
|
|
|
|
long j = max / 86400000;
|
|
|
|
long j2 = max - (86400000 * j);
|
|
|
|
long j3 = j2 / 3600000;
|
|
|
|
str3 = str;
|
|
|
|
m.checkNotNullExpressionValue(context, str3);
|
|
|
|
Object[] objArr = new Object[3];
|
|
|
|
objArr[i2] = String.valueOf(j);
|
|
|
|
objArr[c] = String.valueOf(j3);
|
|
|
|
objArr[2] = String.valueOf((j2 - (3600000 * j3)) / 60000);
|
|
|
|
charSequence2 = b.h(context, R.string.premium_guild_cooldown_available_countdown, objArr, null, 4);
|
|
|
|
} else {
|
|
|
|
str3 = str;
|
|
|
|
charSequence2 = null;
|
|
|
|
}
|
|
|
|
if (str2 == null && charSequence2 == null) {
|
|
|
|
TextView textView2 = this.binding.d;
|
|
|
|
m.checkNotNullExpressionValue(textView2, "binding.boostedBoostCooldown");
|
|
|
|
textView2.setVisibility(8);
|
|
|
|
} else if (str2 != null && charSequence2 != null) {
|
|
|
|
TextView textView3 = this.binding.d;
|
|
|
|
m.checkNotNullExpressionValue(textView3, "binding.boostedBoostCooldown");
|
|
|
|
ViewExtensions.setTextAndVisibilityBy(textView3, charSequence2 + " - " + str2);
|
|
|
|
} else if (str2 != null && charSequence2 == null) {
|
|
|
|
TextView textView4 = this.binding.d;
|
|
|
|
m.checkNotNullExpressionValue(textView4, "binding.boostedBoostCooldown");
|
|
|
|
ViewExtensions.setTextAndVisibilityBy(textView4, str2);
|
|
|
|
} else if (str2 == null && charSequence2 != null) {
|
|
|
|
TextView textView5 = this.binding.d;
|
|
|
|
m.checkNotNullExpressionValue(textView5, "binding.boostedBoostCooldown");
|
|
|
|
ViewExtensions.setTextAndVisibilityBy(textView5, charSequence2);
|
|
|
|
}
|
2022-02-10 02:59:54 +00:00
|
|
|
TextView textView6 = this.binding.f2197b;
|
2021-12-17 21:59:34 +00:00
|
|
|
m.checkNotNullExpressionValue(textView6, "binding.boostedBoostAction");
|
|
|
|
textView6.setText((z2 || z3) ? "" : context.getString(R.string.premium_guild_subscription_select_server_button));
|
|
|
|
if (!z3 || (!canceled && WidgetSettingsGuildBoostSubscriptionAdapter.access$getCanCancelBoosts$p((WidgetSettingsGuildBoostSubscriptionAdapter) this.adapter)) || (canceled && WidgetSettingsGuildBoostSubscriptionAdapter.access$getCanUncancelBoosts$p((WidgetSettingsGuildBoostSubscriptionAdapter) this.adapter))) {
|
|
|
|
m.checkNotNullExpressionValue(context, str3);
|
|
|
|
i3 = DrawableCompat.getThemedDrawableRes$default(context, (int) R.attr.ic_overflow, i2, 2, (Object) null);
|
|
|
|
} else {
|
|
|
|
i3 = 0;
|
|
|
|
}
|
2022-02-10 02:59:54 +00:00
|
|
|
this.binding.f2197b.setCompoundDrawablesWithIntrinsicBounds(i2, i2, i3, i2);
|
|
|
|
this.binding.f2197b.setOnClickListener(new WidgetSettingsGuildBoostSubscriptionAdapter$GuildBoostListItem$onConfigure$2(this, z2, z3, item, boostSlot));
|
2021-12-17 21:59:34 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
throw new Exception("Incorrect List Item Type or null data");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: WidgetSettingsGuildBoostSubscriptionAdapter.kt */
|
|
|
|
public static final class GuildListItem extends MGRecyclerViewHolder<WidgetSettingsGuildBoostSubscriptionAdapter, Item> {
|
2021-08-03 07:33:18 +00:00
|
|
|
private final ViewSettingsBoostedGuildListitemBinding binding;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
2021-12-17 21:59:34 +00:00
|
|
|
public GuildListItem(WidgetSettingsGuildBoostSubscriptionAdapter widgetSettingsGuildBoostSubscriptionAdapter) {
|
|
|
|
super((int) R.layout.view_settings_boosted_guild_listitem, widgetSettingsGuildBoostSubscriptionAdapter);
|
|
|
|
m.checkNotNullParameter(widgetSettingsGuildBoostSubscriptionAdapter, "adapter");
|
2021-08-03 07:33:18 +00:00
|
|
|
View view = this.itemView;
|
2021-08-09 22:51:56 +00:00
|
|
|
int i = R.id.boosted_guild_banner;
|
|
|
|
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.boosted_guild_banner);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (simpleDraweeView != null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
i = R.id.boosted_guild_gradient;
|
|
|
|
View findViewById = view.findViewById(R.id.boosted_guild_gradient);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (findViewById != null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
i = R.id.boosted_guild_progress_view;
|
2021-12-17 21:59:34 +00:00
|
|
|
GuildBoostProgressView guildBoostProgressView = (GuildBoostProgressView) view.findViewById(R.id.boosted_guild_progress_view);
|
|
|
|
if (guildBoostProgressView != null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
i = R.id.boosted_sample_guild_count;
|
|
|
|
TextView textView = (TextView) view.findViewById(R.id.boosted_sample_guild_count);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (textView != null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
i = R.id.boosted_sample_guild_icon;
|
|
|
|
SimpleDraweeView simpleDraweeView2 = (SimpleDraweeView) view.findViewById(R.id.boosted_sample_guild_icon);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (simpleDraweeView2 != null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
i = R.id.boosted_sample_guild_name;
|
|
|
|
TextView textView2 = (TextView) view.findViewById(R.id.boosted_sample_guild_name);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (textView2 != null) {
|
2021-12-17 21:59:34 +00:00
|
|
|
ViewSettingsBoostedGuildListitemBinding viewSettingsBoostedGuildListitemBinding = new ViewSettingsBoostedGuildListitemBinding((LinearLayout) view, simpleDraweeView, findViewById, guildBoostProgressView, textView, simpleDraweeView2, textView2);
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(viewSettingsBoostedGuildListitemBinding, "ViewSettingsBoostedGuild…temBinding.bind(itemView)");
|
|
|
|
this.binding = viewSettingsBoostedGuildListitemBinding;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(i)));
|
|
|
|
}
|
|
|
|
|
|
|
|
public void onConfigure(int i, Item item) {
|
|
|
|
m.checkNotNullParameter(item, "data");
|
|
|
|
super.onConfigure(i, (int) item);
|
|
|
|
if (item instanceof Item.GuildItem) {
|
|
|
|
Item.GuildItem guildItem = (Item.GuildItem) item;
|
|
|
|
if (guildItem.getGuild() != null) {
|
|
|
|
View view = this.itemView;
|
|
|
|
m.checkNotNullExpressionValue(view, "itemView");
|
|
|
|
Context context = view.getContext();
|
|
|
|
if (guildItem.getGuild().getBanner() != null) {
|
2022-02-10 02:59:54 +00:00
|
|
|
SimpleDraweeView simpleDraweeView = this.binding.f2198b;
|
2021-08-03 07:33:18 +00:00
|
|
|
IconUtils iconUtils = IconUtils.INSTANCE;
|
|
|
|
Guild guild = guildItem.getGuild();
|
|
|
|
m.checkNotNullExpressionValue(context, "context");
|
2021-11-23 07:18:28 +00:00
|
|
|
simpleDraweeView.setImageURI(IconUtils.getBannerForGuild$default(iconUtils, guild, Integer.valueOf(context.getResources().getDimensionPixelSize(R.dimen.nav_panel_width)), false, 4, null));
|
2021-12-17 21:59:34 +00:00
|
|
|
View view2 = this.binding.c;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(view2, "binding.boostedGuildGradient");
|
|
|
|
view2.setVisibility(0);
|
|
|
|
} else {
|
2022-02-10 02:59:54 +00:00
|
|
|
SimpleDraweeView simpleDraweeView2 = this.binding.f2198b;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(context, "context");
|
2021-08-09 22:51:56 +00:00
|
|
|
simpleDraweeView2.setBackgroundResource(DrawableCompat.getThemedDrawableRes$default(context, (int) R.attr.bg_subscription_placeholder_pattern, 0, 2, (Object) null));
|
2021-12-17 21:59:34 +00:00
|
|
|
View view3 = this.binding.c;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(view3, "binding.boostedGuildGradient");
|
|
|
|
view3.setVisibility(8);
|
|
|
|
}
|
|
|
|
SimpleDraweeView simpleDraweeView3 = this.binding.f;
|
|
|
|
m.checkNotNullExpressionValue(simpleDraweeView3, "binding.boostedSampleGuildIcon");
|
|
|
|
IconUtils.setIcon$default(simpleDraweeView3, IconUtils.getForGuild$default(guildItem.getGuild(), null, false, null, 14, null), 0, (Function1) null, (MGImages.ChangeDetector) null, 28, (Object) null);
|
|
|
|
TextView textView = this.binding.g;
|
|
|
|
m.checkNotNullExpressionValue(textView, "binding.boostedSampleGuildName");
|
|
|
|
textView.setText(guildItem.getGuild().getName());
|
2021-12-17 21:59:34 +00:00
|
|
|
CharSequence i18nPluralString = StringResourceUtilsKt.getI18nPluralString(context, R.plurals.premium_guild_subscription_guild_subsription_subtitle_numSubscriptions, guildItem.getBoostCount(), Integer.valueOf(guildItem.getBoostCount()));
|
2021-08-03 07:33:18 +00:00
|
|
|
TextView textView2 = this.binding.e;
|
|
|
|
m.checkNotNullExpressionValue(textView2, "binding.boostedSampleGuildCount");
|
2021-08-09 22:51:56 +00:00
|
|
|
textView2.setText(b.h(context, R.string.premium_guild_subscription_guild_subsription_subtitle, new Object[]{i18nPluralString}, null, 4));
|
2022-02-17 09:52:29 +00:00
|
|
|
this.binding.d.a(guildItem.getGuild().getId(), guildItem.getGuild().getPremiumTier(), guildItem.getGuild().getPremiumSubscriptionCount());
|
2021-08-03 07:33:18 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
throw new Exception("Incorrect List Item Type or null data");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
/* compiled from: WidgetSettingsGuildBoostSubscriptionAdapter.kt */
|
|
|
|
public static final class HeaderListItem extends MGRecyclerViewHolder<WidgetSettingsGuildBoostSubscriptionAdapter, Item> {
|
2021-08-03 07:33:18 +00:00
|
|
|
private final ViewSettingsBoostedHeaderListitemBinding binding;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
2021-12-17 21:59:34 +00:00
|
|
|
public HeaderListItem(WidgetSettingsGuildBoostSubscriptionAdapter widgetSettingsGuildBoostSubscriptionAdapter) {
|
|
|
|
super((int) R.layout.view_settings_boosted_header_listitem, widgetSettingsGuildBoostSubscriptionAdapter);
|
|
|
|
m.checkNotNullParameter(widgetSettingsGuildBoostSubscriptionAdapter, "adapter");
|
2021-08-03 07:33:18 +00:00
|
|
|
View view = this.itemView;
|
|
|
|
Objects.requireNonNull(view, "rootView");
|
|
|
|
TextView textView = (TextView) view;
|
|
|
|
ViewSettingsBoostedHeaderListitemBinding viewSettingsBoostedHeaderListitemBinding = new ViewSettingsBoostedHeaderListitemBinding(textView, textView);
|
|
|
|
m.checkNotNullExpressionValue(viewSettingsBoostedHeaderListitemBinding, "ViewSettingsBoostedHeade…temBinding.bind(itemView)");
|
|
|
|
this.binding = viewSettingsBoostedHeaderListitemBinding;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void onConfigure(int i, Item item) {
|
|
|
|
m.checkNotNullParameter(item, "data");
|
|
|
|
super.onConfigure(i, (int) item);
|
|
|
|
if (item instanceof Item.HeaderItem) {
|
2022-02-10 02:59:54 +00:00
|
|
|
TextView textView = this.binding.f2199b;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(textView, "binding.boostedHeader");
|
|
|
|
View view = this.itemView;
|
|
|
|
m.checkNotNullExpressionValue(view, "itemView");
|
|
|
|
textView.setText(view.getContext().getString(((Item.HeaderItem) item).getHeaderStringId()));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
throw new Exception("Incorrect List Item Type or null data");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
/* compiled from: WidgetSettingsGuildBoostSubscriptionAdapter.kt */
|
2021-08-03 07:33:18 +00:00
|
|
|
public static abstract class Item implements MGRecyclerDataPayload {
|
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
public static final int TYPE_GUILD = 0;
|
2021-12-17 21:59:34 +00:00
|
|
|
public static final int TYPE_GUILD_BOOST = 1;
|
2021-08-03 07:33:18 +00:00
|
|
|
public static final int TYPE_HEADER = 2;
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
/* compiled from: WidgetSettingsGuildBoostSubscriptionAdapter.kt */
|
2021-08-03 07:33:18 +00:00
|
|
|
public static final class Companion {
|
|
|
|
private Companion() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
/* compiled from: WidgetSettingsGuildBoostSubscriptionAdapter.kt */
|
|
|
|
public static final class GuildBoostItem extends Item {
|
|
|
|
private final String boostEndsAt;
|
|
|
|
private final ModelGuildBoostSlot boostSlot;
|
|
|
|
private final String key;
|
|
|
|
private final int type = 1;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public GuildBoostItem(ModelGuildBoostSlot modelGuildBoostSlot, String str) {
|
|
|
|
super(null);
|
|
|
|
m.checkNotNullParameter(modelGuildBoostSlot, "boostSlot");
|
|
|
|
this.boostSlot = modelGuildBoostSlot;
|
|
|
|
this.boostEndsAt = str;
|
|
|
|
this.key = String.valueOf(modelGuildBoostSlot.getId());
|
|
|
|
}
|
|
|
|
|
|
|
|
public static /* synthetic */ GuildBoostItem copy$default(GuildBoostItem guildBoostItem, ModelGuildBoostSlot modelGuildBoostSlot, String str, int i, Object obj) {
|
|
|
|
if ((i & 1) != 0) {
|
|
|
|
modelGuildBoostSlot = guildBoostItem.boostSlot;
|
|
|
|
}
|
|
|
|
if ((i & 2) != 0) {
|
|
|
|
str = guildBoostItem.boostEndsAt;
|
|
|
|
}
|
|
|
|
return guildBoostItem.copy(modelGuildBoostSlot, str);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final ModelGuildBoostSlot component1() {
|
|
|
|
return this.boostSlot;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final String component2() {
|
|
|
|
return this.boostEndsAt;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final GuildBoostItem copy(ModelGuildBoostSlot modelGuildBoostSlot, String str) {
|
|
|
|
m.checkNotNullParameter(modelGuildBoostSlot, "boostSlot");
|
|
|
|
return new GuildBoostItem(modelGuildBoostSlot, str);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
if (this == obj) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!(obj instanceof GuildBoostItem)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
GuildBoostItem guildBoostItem = (GuildBoostItem) obj;
|
|
|
|
return m.areEqual(this.boostSlot, guildBoostItem.boostSlot) && m.areEqual(this.boostEndsAt, guildBoostItem.boostEndsAt);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final String getBoostEndsAt() {
|
|
|
|
return this.boostEndsAt;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final ModelGuildBoostSlot getBoostSlot() {
|
|
|
|
return this.boostSlot;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
|
|
|
|
public String getKey() {
|
|
|
|
return this.key;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
|
|
|
|
public int getType() {
|
|
|
|
return this.type;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
ModelGuildBoostSlot modelGuildBoostSlot = this.boostSlot;
|
|
|
|
int i = 0;
|
|
|
|
int hashCode = (modelGuildBoostSlot != null ? modelGuildBoostSlot.hashCode() : 0) * 31;
|
|
|
|
String str = this.boostEndsAt;
|
|
|
|
if (str != null) {
|
|
|
|
i = str.hashCode();
|
|
|
|
}
|
|
|
|
return hashCode + i;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
StringBuilder R = a.R("GuildBoostItem(boostSlot=");
|
|
|
|
R.append(this.boostSlot);
|
|
|
|
R.append(", boostEndsAt=");
|
|
|
|
return a.H(R, this.boostEndsAt, ")");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: WidgetSettingsGuildBoostSubscriptionAdapter.kt */
|
2021-08-03 07:33:18 +00:00
|
|
|
public static final class GuildItem extends Item {
|
2021-12-17 21:59:34 +00:00
|
|
|
private final int boostCount;
|
2021-08-03 07:33:18 +00:00
|
|
|
private final Guild guild;
|
|
|
|
private final String key;
|
|
|
|
private final int type;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public GuildItem(Guild guild, int i) {
|
|
|
|
super(null);
|
|
|
|
Long l = null;
|
|
|
|
this.guild = guild;
|
2021-12-17 21:59:34 +00:00
|
|
|
this.boostCount = i;
|
2021-08-03 07:33:18 +00:00
|
|
|
this.key = String.valueOf(guild != null ? Long.valueOf(guild.getId()) : l);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static /* synthetic */ GuildItem copy$default(GuildItem guildItem, Guild guild, int i, int i2, Object obj) {
|
|
|
|
if ((i2 & 1) != 0) {
|
|
|
|
guild = guildItem.guild;
|
|
|
|
}
|
|
|
|
if ((i2 & 2) != 0) {
|
2021-12-17 21:59:34 +00:00
|
|
|
i = guildItem.boostCount;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
return guildItem.copy(guild, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Guild component1() {
|
|
|
|
return this.guild;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final int component2() {
|
2021-12-17 21:59:34 +00:00
|
|
|
return this.boostCount;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final GuildItem copy(Guild guild, int i) {
|
|
|
|
return new GuildItem(guild, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
if (this == obj) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!(obj instanceof GuildItem)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
GuildItem guildItem = (GuildItem) obj;
|
2021-12-17 21:59:34 +00:00
|
|
|
return m.areEqual(this.guild, guildItem.guild) && this.boostCount == guildItem.boostCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final int getBoostCount() {
|
|
|
|
return this.boostCount;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final Guild getGuild() {
|
|
|
|
return this.guild;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
|
|
|
|
public String getKey() {
|
|
|
|
return this.key;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
|
|
|
|
public int getType() {
|
|
|
|
return this.type;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
Guild guild = this.guild;
|
2021-12-17 21:59:34 +00:00
|
|
|
return ((guild != null ? guild.hashCode() : 0) * 31) + this.boostCount;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
2021-11-05 06:48:17 +00:00
|
|
|
StringBuilder R = a.R("GuildItem(guild=");
|
|
|
|
R.append(this.guild);
|
2021-12-17 21:59:34 +00:00
|
|
|
R.append(", boostCount=");
|
|
|
|
return a.A(R, this.boostCount, ")");
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
/* compiled from: WidgetSettingsGuildBoostSubscriptionAdapter.kt */
|
2021-08-03 07:33:18 +00:00
|
|
|
public static final class HeaderItem extends Item {
|
|
|
|
private final int headerStringId;
|
|
|
|
private final String key;
|
|
|
|
private final int type = 2;
|
|
|
|
|
|
|
|
public HeaderItem(@StringRes int i) {
|
|
|
|
super(null);
|
|
|
|
this.headerStringId = i;
|
|
|
|
this.key = String.valueOf(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static /* synthetic */ HeaderItem copy$default(HeaderItem headerItem, int i, int i2, Object obj) {
|
|
|
|
if ((i2 & 1) != 0) {
|
|
|
|
i = headerItem.headerStringId;
|
|
|
|
}
|
|
|
|
return headerItem.copy(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final int component1() {
|
|
|
|
return this.headerStringId;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final HeaderItem copy(@StringRes int i) {
|
|
|
|
return new HeaderItem(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
if (this != obj) {
|
|
|
|
return (obj instanceof HeaderItem) && this.headerStringId == ((HeaderItem) obj).headerStringId;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final int getHeaderStringId() {
|
|
|
|
return this.headerStringId;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
|
|
|
|
public String getKey() {
|
|
|
|
return this.key;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
|
|
|
|
public int getType() {
|
|
|
|
return this.type;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
return this.headerStringId;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
2021-11-05 06:48:17 +00:00
|
|
|
return a.A(a.R("HeaderItem(headerStringId="), this.headerStringId, ")");
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private Item() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ Item(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
2021-12-17 21:59:34 +00:00
|
|
|
public WidgetSettingsGuildBoostSubscriptionAdapter(RecyclerView recyclerView) {
|
2021-08-03 07:33:18 +00:00
|
|
|
super(recyclerView, false, 2, null);
|
|
|
|
m.checkNotNullParameter(recyclerView, "recycler");
|
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
public static final /* synthetic */ boolean access$getCanCancelBoosts$p(WidgetSettingsGuildBoostSubscriptionAdapter widgetSettingsGuildBoostSubscriptionAdapter) {
|
|
|
|
return widgetSettingsGuildBoostSubscriptionAdapter.canCancelBoosts;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
public static final /* synthetic */ boolean access$getCanUncancelBoosts$p(WidgetSettingsGuildBoostSubscriptionAdapter widgetSettingsGuildBoostSubscriptionAdapter) {
|
|
|
|
return widgetSettingsGuildBoostSubscriptionAdapter.canUncancelBoosts;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
public static final /* synthetic */ Function2 access$getCancelListener$p(WidgetSettingsGuildBoostSubscriptionAdapter widgetSettingsGuildBoostSubscriptionAdapter) {
|
|
|
|
return widgetSettingsGuildBoostSubscriptionAdapter.cancelListener;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
public static final /* synthetic */ Function1 access$getSubscribeListener$p(WidgetSettingsGuildBoostSubscriptionAdapter widgetSettingsGuildBoostSubscriptionAdapter) {
|
|
|
|
return widgetSettingsGuildBoostSubscriptionAdapter.subscribeListener;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
public static final /* synthetic */ Function2 access$getTransferListener$p(WidgetSettingsGuildBoostSubscriptionAdapter widgetSettingsGuildBoostSubscriptionAdapter) {
|
|
|
|
return widgetSettingsGuildBoostSubscriptionAdapter.transferListener;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
public static final /* synthetic */ void access$setCanCancelBoosts$p(WidgetSettingsGuildBoostSubscriptionAdapter widgetSettingsGuildBoostSubscriptionAdapter, boolean z2) {
|
|
|
|
widgetSettingsGuildBoostSubscriptionAdapter.canCancelBoosts = z2;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
public static final /* synthetic */ void access$setCanUncancelBoosts$p(WidgetSettingsGuildBoostSubscriptionAdapter widgetSettingsGuildBoostSubscriptionAdapter, boolean z2) {
|
|
|
|
widgetSettingsGuildBoostSubscriptionAdapter.canUncancelBoosts = z2;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
public static final /* synthetic */ void access$setCancelListener$p(WidgetSettingsGuildBoostSubscriptionAdapter widgetSettingsGuildBoostSubscriptionAdapter, Function2 function2) {
|
|
|
|
widgetSettingsGuildBoostSubscriptionAdapter.cancelListener = function2;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
public static final /* synthetic */ void access$setSubscribeListener$p(WidgetSettingsGuildBoostSubscriptionAdapter widgetSettingsGuildBoostSubscriptionAdapter, Function1 function1) {
|
|
|
|
widgetSettingsGuildBoostSubscriptionAdapter.subscribeListener = function1;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
public static final /* synthetic */ void access$setTransferListener$p(WidgetSettingsGuildBoostSubscriptionAdapter widgetSettingsGuildBoostSubscriptionAdapter, Function2 function2) {
|
|
|
|
widgetSettingsGuildBoostSubscriptionAdapter.transferListener = function2;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
public final void configure(List<? extends Item> list, Function1<? super Long, Unit> function1, Function2<? super ModelGuildBoostSlot, ? super Long, Unit> function2, Function2<? super Long, ? super Boolean, Unit> function22, boolean z2, boolean z3) {
|
|
|
|
m.checkNotNullParameter(list, "guildBoostItems");
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullParameter(function1, "subscribeListener");
|
|
|
|
m.checkNotNullParameter(function2, "transferListener");
|
|
|
|
m.checkNotNullParameter(function22, "cancelListener");
|
|
|
|
setData(list);
|
|
|
|
this.subscribeListener = function1;
|
|
|
|
this.transferListener = function2;
|
|
|
|
this.cancelListener = function22;
|
|
|
|
this.canCancelBoosts = z2;
|
|
|
|
this.canUncancelBoosts = z3;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
2021-12-17 21:59:34 +00:00
|
|
|
public MGRecyclerViewHolder<WidgetSettingsGuildBoostSubscriptionAdapter, Item> onCreateViewHolder(ViewGroup viewGroup, int i) {
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullParameter(viewGroup, "parent");
|
|
|
|
if (i == 0) {
|
|
|
|
return new GuildListItem(this);
|
|
|
|
}
|
|
|
|
if (i == 1) {
|
2021-12-17 21:59:34 +00:00
|
|
|
return new GuildBoostListItem(this);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
if (i == 2) {
|
|
|
|
return new HeaderListItem(this);
|
|
|
|
}
|
|
|
|
throw invalidViewTypeException(i);
|
|
|
|
}
|
|
|
|
}
|