551 lines
28 KiB
Java
551 lines
28 KiB
Java
package com.discord.widgets.settings.premium;
|
|
|
|
import android.content.Context;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.ImageView;
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.TextView;
|
|
import androidx.cardview.widget.CardView;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import c.a.k.b;
|
|
import c.d.b.a.a;
|
|
import com.discord.api.application.Application;
|
|
import com.discord.api.premium.SubscriptionInterval;
|
|
import com.discord.app.AppViewFlipper;
|
|
import com.discord.databinding.ViewGiftEntitlementListItemBinding;
|
|
import com.discord.databinding.ViewGiftSkuListItemBinding;
|
|
import com.discord.models.domain.ModelEntitlement;
|
|
import com.discord.models.domain.ModelGift;
|
|
import com.discord.models.domain.ModelSku;
|
|
import com.discord.models.domain.premium.SubscriptionPlanType;
|
|
import com.discord.utilities.color.ColorCompat;
|
|
import com.discord.utilities.drawable.DrawableCompat;
|
|
import com.discord.utilities.gifting.GiftingUtils;
|
|
import com.discord.utilities.icon.IconUtils;
|
|
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.premium.PremiumUtils;
|
|
import com.discord.utilities.resources.StringResourceUtilsKt;
|
|
import com.discord.utilities.time.ClockFactory;
|
|
import com.discord.utilities.view.text.LinkifiedTextView;
|
|
import com.facebook.drawee.view.SimpleDraweeView;
|
|
import com.google.android.material.button.MaterialButton;
|
|
import d0.z.d.m;
|
|
import java.util.List;
|
|
import kotlin.Pair;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.functions.Function2;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
/* compiled from: WidgetSettingsGiftingAdapter.kt */
|
|
public final class WidgetSettingsGiftingAdapter extends MGRecyclerAdapterSimple<GiftItem> {
|
|
private Function1<? super String, Unit> onClickCopyListener = WidgetSettingsGiftingAdapter$onClickCopyListener$1.INSTANCE;
|
|
private Function2<? super Long, ? super Long, Unit> onClickSkuListener = WidgetSettingsGiftingAdapter$onClickSkuListener$1.INSTANCE;
|
|
private Function2<? super Long, ? super Long, Unit> onGenerateClickListener = WidgetSettingsGiftingAdapter$onGenerateClickListener$1.INSTANCE;
|
|
private Function1<? super ModelGift, Unit> onRevokeClickListener = WidgetSettingsGiftingAdapter$onRevokeClickListener$1.INSTANCE;
|
|
|
|
/* compiled from: WidgetSettingsGiftingAdapter.kt */
|
|
public static final class EntitlementListItem extends MGRecyclerViewHolder<WidgetSettingsGiftingAdapter, GiftItem> {
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final int VIEW_INDEX_CODE = 0;
|
|
private static final int VIEW_INDEX_GENERATE = 1;
|
|
private final ViewGiftEntitlementListItemBinding binding;
|
|
|
|
/* compiled from: WidgetSettingsGiftingAdapter.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public EntitlementListItem(WidgetSettingsGiftingAdapter widgetSettingsGiftingAdapter) {
|
|
super(2131558755, widgetSettingsGiftingAdapter);
|
|
m.checkNotNullParameter(widgetSettingsGiftingAdapter, "adapter");
|
|
View view = this.itemView;
|
|
int i = 2131363355;
|
|
TextView textView = (TextView) view.findViewById(2131363355);
|
|
if (textView != null) {
|
|
i = 2131363356;
|
|
RelativeLayout relativeLayout = (RelativeLayout) view.findViewById(2131363356);
|
|
if (relativeLayout != null) {
|
|
FrameLayout frameLayout = (FrameLayout) view;
|
|
i = 2131363358;
|
|
MaterialButton materialButton = (MaterialButton) view.findViewById(2131363358);
|
|
if (materialButton != null) {
|
|
i = 2131363359;
|
|
View findViewById = view.findViewById(2131363359);
|
|
if (findViewById != null) {
|
|
i = 2131363360;
|
|
AppViewFlipper appViewFlipper = (AppViewFlipper) view.findViewById(2131363360);
|
|
if (appViewFlipper != null) {
|
|
i = 2131363361;
|
|
MaterialButton materialButton2 = (MaterialButton) view.findViewById(2131363361);
|
|
if (materialButton2 != null) {
|
|
i = 2131363362;
|
|
LinkifiedTextView linkifiedTextView = (LinkifiedTextView) view.findViewById(2131363362);
|
|
if (linkifiedTextView != null) {
|
|
ViewGiftEntitlementListItemBinding viewGiftEntitlementListItemBinding = new ViewGiftEntitlementListItemBinding(frameLayout, textView, relativeLayout, frameLayout, materialButton, findViewById, appViewFlipper, materialButton2, linkifiedTextView);
|
|
m.checkNotNullExpressionValue(viewGiftEntitlementListItemBinding, "ViewGiftEntitlementListItemBinding.bind(itemView)");
|
|
this.binding = viewGiftEntitlementListItemBinding;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(i)));
|
|
}
|
|
|
|
public static final /* synthetic */ WidgetSettingsGiftingAdapter access$getAdapter$p(EntitlementListItem entitlementListItem) {
|
|
return (WidgetSettingsGiftingAdapter) entitlementListItem.adapter;
|
|
}
|
|
|
|
public void onConfigure(int i, GiftItem giftItem) {
|
|
int i2;
|
|
m.checkNotNullParameter(giftItem, "data");
|
|
super.onConfigure(i, (int) giftItem);
|
|
if (m.areEqual(giftItem.getExpanded(), Boolean.FALSE)) {
|
|
View view = this.itemView;
|
|
m.checkNotNullExpressionValue(view, "itemView");
|
|
View view2 = this.itemView;
|
|
m.checkNotNullExpressionValue(view2, "itemView");
|
|
ViewGroup.LayoutParams layoutParams = view2.getLayoutParams();
|
|
layoutParams.height = 0;
|
|
view.setLayoutParams(layoutParams);
|
|
return;
|
|
}
|
|
View view3 = this.itemView;
|
|
m.checkNotNullExpressionValue(view3, "itemView");
|
|
View view4 = this.itemView;
|
|
m.checkNotNullExpressionValue(view4, "itemView");
|
|
ViewGroup.LayoutParams layoutParams2 = view4.getLayoutParams();
|
|
layoutParams2.height = -2;
|
|
view3.setLayoutParams(layoutParams2);
|
|
View view5 = this.itemView;
|
|
m.checkNotNullExpressionValue(view5, "itemView");
|
|
Context context = view5.getContext();
|
|
if (giftItem.getEntitlement() != null && giftItem.isLastItem() != null) {
|
|
if (giftItem.getGift() != null) {
|
|
AppViewFlipper appViewFlipper = this.binding.g;
|
|
m.checkNotNullExpressionValue(appViewFlipper, "binding.giftEntitlementFlipper");
|
|
appViewFlipper.setDisplayedChild(0);
|
|
boolean areEqual = m.areEqual(giftItem.getWasCopied(), Boolean.TRUE);
|
|
MaterialButton materialButton = this.binding.e;
|
|
m.checkNotNullExpressionValue(materialButton, "binding.giftEntitlementCopy");
|
|
View view6 = this.itemView;
|
|
m.checkNotNullExpressionValue(view6, "itemView");
|
|
materialButton.setText(b.i(view6, areEqual ? 2131887625 : 2131887627, new Object[0], null, 4));
|
|
RelativeLayout relativeLayout = this.binding.f1655c;
|
|
if (areEqual) {
|
|
m.checkNotNullExpressionValue(context, "context");
|
|
i2 = DrawableCompat.getThemedDrawableRes$default(context, 2130969333, 0, 2, (Object) null);
|
|
} else {
|
|
m.checkNotNullExpressionValue(context, "context");
|
|
i2 = DrawableCompat.getThemedDrawableRes$default(context, 2130969898, 0, 2, (Object) null);
|
|
}
|
|
relativeLayout.setBackgroundResource(i2);
|
|
this.binding.e.setOnClickListener(new WidgetSettingsGiftingAdapter$EntitlementListItem$onConfigure$3(this, giftItem));
|
|
GiftingUtils giftingUtils = GiftingUtils.INSTANCE;
|
|
CharSequence timeString = giftingUtils.getTimeString(giftItem.getGift().getExpiresDiff(ClockFactory.get().currentTimeMillis()), context);
|
|
LinkifiedTextView linkifiedTextView = this.binding.i;
|
|
m.checkNotNullExpressionValue(linkifiedTextView, "binding.giftEntitlementRevoke");
|
|
b.l(linkifiedTextView, 2131889092, new Object[]{timeString}, new WidgetSettingsGiftingAdapter$EntitlementListItem$onConfigure$4(this, giftItem));
|
|
TextView textView = this.binding.b;
|
|
m.checkNotNullExpressionValue(textView, "binding.giftEntitlementCode");
|
|
textView.setText(giftingUtils.generateGiftUrl(giftItem.getGift().getCode()));
|
|
} else {
|
|
AppViewFlipper appViewFlipper2 = this.binding.g;
|
|
m.checkNotNullExpressionValue(appViewFlipper2, "binding.giftEntitlementFlipper");
|
|
appViewFlipper2.setDisplayedChild(1);
|
|
this.binding.h.setOnClickListener(new WidgetSettingsGiftingAdapter$EntitlementListItem$onConfigure$5(this, giftItem));
|
|
}
|
|
View view7 = this.binding.f;
|
|
m.checkNotNullExpressionValue(view7, "binding.giftEntitlementDivider");
|
|
view7.setVisibility(giftItem.isLastItem().booleanValue() ^ true ? 0 : 8);
|
|
if (giftItem.isLastItem().booleanValue()) {
|
|
FrameLayout frameLayout = this.binding.d;
|
|
View view8 = this.itemView;
|
|
m.checkNotNullExpressionValue(view8, "itemView");
|
|
Context context2 = view8.getContext();
|
|
m.checkNotNullExpressionValue(context2, "itemView.context");
|
|
frameLayout.setBackgroundResource(DrawableCompat.getThemedDrawableRes$default(context2, 2130969895, 0, 2, (Object) null));
|
|
return;
|
|
}
|
|
FrameLayout frameLayout2 = this.binding.d;
|
|
View view9 = this.itemView;
|
|
m.checkNotNullExpressionValue(view9, "itemView");
|
|
frameLayout2.setBackgroundColor(ColorCompat.getThemedColor(view9.getContext(), 2130969893));
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetSettingsGiftingAdapter.kt */
|
|
public static final class GiftItem implements MGRecyclerDataPayload {
|
|
public static final Companion Companion = new Companion(null);
|
|
public static final int TYPE_GIFT = 2;
|
|
public static final int TYPE_NO_GIFTS = 0;
|
|
public static final int TYPE_SKU = 1;
|
|
private final Integer copies;
|
|
private final ModelEntitlement entitlement;
|
|
private final Boolean expanded;
|
|
private final ModelGift gift;
|
|
private final Boolean isLastItem;
|
|
private final String key;
|
|
private final Long planId;
|
|
private final ModelSku sku;
|
|
private final int type;
|
|
private final int typeInt;
|
|
private final Boolean wasCopied;
|
|
|
|
/* compiled from: WidgetSettingsGiftingAdapter.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
public GiftItem(int i, ModelGift modelGift, ModelEntitlement modelEntitlement, Boolean bool, ModelSku modelSku, Integer num, Long l, Boolean bool2, Boolean bool3) {
|
|
this.typeInt = i;
|
|
this.gift = modelGift;
|
|
this.entitlement = modelEntitlement;
|
|
this.expanded = bool;
|
|
this.sku = modelSku;
|
|
this.copies = num;
|
|
this.planId = l;
|
|
this.isLastItem = bool2;
|
|
this.wasCopied = bool3;
|
|
this.type = i;
|
|
int type = getType();
|
|
String str = "";
|
|
if (type != 0) {
|
|
Long l2 = null;
|
|
if (type == 1) {
|
|
str = String.valueOf(modelSku != null ? Long.valueOf(modelSku.getId()) : l2);
|
|
} else if (type == 2) {
|
|
str = String.valueOf(modelEntitlement != null ? Long.valueOf(modelEntitlement.getId()) : l2);
|
|
}
|
|
}
|
|
this.key = str;
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ GiftItem(int i, ModelGift modelGift, ModelEntitlement modelEntitlement, Boolean bool, ModelSku modelSku, Integer num, Long l, Boolean bool2, Boolean bool3, int i2, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(i, (i2 & 2) != 0 ? null : modelGift, (i2 & 4) != 0 ? null : modelEntitlement, (i2 & 8) != 0 ? null : bool, (i2 & 16) != 0 ? null : modelSku, (i2 & 32) != 0 ? null : num, (i2 & 64) != 0 ? null : l, (i2 & 128) != 0 ? null : bool2, (i2 & 256) == 0 ? bool3 : null);
|
|
}
|
|
|
|
public static /* synthetic */ GiftItem copy$default(GiftItem giftItem, int i, ModelGift modelGift, ModelEntitlement modelEntitlement, Boolean bool, ModelSku modelSku, Integer num, Long l, Boolean bool2, Boolean bool3, int i2, Object obj) {
|
|
return giftItem.copy((i2 & 1) != 0 ? giftItem.typeInt : i, (i2 & 2) != 0 ? giftItem.gift : modelGift, (i2 & 4) != 0 ? giftItem.entitlement : modelEntitlement, (i2 & 8) != 0 ? giftItem.expanded : bool, (i2 & 16) != 0 ? giftItem.sku : modelSku, (i2 & 32) != 0 ? giftItem.copies : num, (i2 & 64) != 0 ? giftItem.planId : l, (i2 & 128) != 0 ? giftItem.isLastItem : bool2, (i2 & 256) != 0 ? giftItem.wasCopied : bool3);
|
|
}
|
|
|
|
public final int component1() {
|
|
return this.typeInt;
|
|
}
|
|
|
|
public final ModelGift component2() {
|
|
return this.gift;
|
|
}
|
|
|
|
public final ModelEntitlement component3() {
|
|
return this.entitlement;
|
|
}
|
|
|
|
public final Boolean component4() {
|
|
return this.expanded;
|
|
}
|
|
|
|
public final ModelSku component5() {
|
|
return this.sku;
|
|
}
|
|
|
|
public final Integer component6() {
|
|
return this.copies;
|
|
}
|
|
|
|
public final Long component7() {
|
|
return this.planId;
|
|
}
|
|
|
|
public final Boolean component8() {
|
|
return this.isLastItem;
|
|
}
|
|
|
|
public final Boolean component9() {
|
|
return this.wasCopied;
|
|
}
|
|
|
|
public final GiftItem copy(int i, ModelGift modelGift, ModelEntitlement modelEntitlement, Boolean bool, ModelSku modelSku, Integer num, Long l, Boolean bool2, Boolean bool3) {
|
|
return new GiftItem(i, modelGift, modelEntitlement, bool, modelSku, num, l, bool2, bool3);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof GiftItem)) {
|
|
return false;
|
|
}
|
|
GiftItem giftItem = (GiftItem) obj;
|
|
return this.typeInt == giftItem.typeInt && m.areEqual(this.gift, giftItem.gift) && m.areEqual(this.entitlement, giftItem.entitlement) && m.areEqual(this.expanded, giftItem.expanded) && m.areEqual(this.sku, giftItem.sku) && m.areEqual(this.copies, giftItem.copies) && m.areEqual(this.planId, giftItem.planId) && m.areEqual(this.isLastItem, giftItem.isLastItem) && m.areEqual(this.wasCopied, giftItem.wasCopied);
|
|
}
|
|
|
|
public final Integer getCopies() {
|
|
return this.copies;
|
|
}
|
|
|
|
public final ModelEntitlement getEntitlement() {
|
|
return this.entitlement;
|
|
}
|
|
|
|
public final Boolean getExpanded() {
|
|
return this.expanded;
|
|
}
|
|
|
|
public final ModelGift getGift() {
|
|
return this.gift;
|
|
}
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
|
|
public String getKey() {
|
|
return this.key;
|
|
}
|
|
|
|
public final Long getPlanId() {
|
|
return this.planId;
|
|
}
|
|
|
|
public final ModelSku getSku() {
|
|
return this.sku;
|
|
}
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
|
|
public int getType() {
|
|
return this.type;
|
|
}
|
|
|
|
public final int getTypeInt() {
|
|
return this.typeInt;
|
|
}
|
|
|
|
public final Boolean getWasCopied() {
|
|
return this.wasCopied;
|
|
}
|
|
|
|
public int hashCode() {
|
|
int i = this.typeInt * 31;
|
|
ModelGift modelGift = this.gift;
|
|
int i2 = 0;
|
|
int hashCode = (i + (modelGift != null ? modelGift.hashCode() : 0)) * 31;
|
|
ModelEntitlement modelEntitlement = this.entitlement;
|
|
int hashCode2 = (hashCode + (modelEntitlement != null ? modelEntitlement.hashCode() : 0)) * 31;
|
|
Boolean bool = this.expanded;
|
|
int hashCode3 = (hashCode2 + (bool != null ? bool.hashCode() : 0)) * 31;
|
|
ModelSku modelSku = this.sku;
|
|
int hashCode4 = (hashCode3 + (modelSku != null ? modelSku.hashCode() : 0)) * 31;
|
|
Integer num = this.copies;
|
|
int hashCode5 = (hashCode4 + (num != null ? num.hashCode() : 0)) * 31;
|
|
Long l = this.planId;
|
|
int hashCode6 = (hashCode5 + (l != null ? l.hashCode() : 0)) * 31;
|
|
Boolean bool2 = this.isLastItem;
|
|
int hashCode7 = (hashCode6 + (bool2 != null ? bool2.hashCode() : 0)) * 31;
|
|
Boolean bool3 = this.wasCopied;
|
|
if (bool3 != null) {
|
|
i2 = bool3.hashCode();
|
|
}
|
|
return hashCode7 + i2;
|
|
}
|
|
|
|
public final Boolean isLastItem() {
|
|
return this.isLastItem;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("GiftItem(typeInt=");
|
|
K.append(this.typeInt);
|
|
K.append(", gift=");
|
|
K.append(this.gift);
|
|
K.append(", entitlement=");
|
|
K.append(this.entitlement);
|
|
K.append(", expanded=");
|
|
K.append(this.expanded);
|
|
K.append(", sku=");
|
|
K.append(this.sku);
|
|
K.append(", copies=");
|
|
K.append(this.copies);
|
|
K.append(", planId=");
|
|
K.append(this.planId);
|
|
K.append(", isLastItem=");
|
|
K.append(this.isLastItem);
|
|
K.append(", wasCopied=");
|
|
K.append(this.wasCopied);
|
|
K.append(")");
|
|
return K.toString();
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetSettingsGiftingAdapter.kt */
|
|
public static final class NoGiftsListItem extends MGRecyclerViewHolder<WidgetSettingsGiftingAdapter, GiftItem> {
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public NoGiftsListItem(WidgetSettingsGiftingAdapter widgetSettingsGiftingAdapter) {
|
|
super(2131558778, widgetSettingsGiftingAdapter);
|
|
m.checkNotNullParameter(widgetSettingsGiftingAdapter, "adapter");
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetSettingsGiftingAdapter.kt */
|
|
public static final class SkuListItem extends MGRecyclerViewHolder<WidgetSettingsGiftingAdapter, GiftItem> {
|
|
private final ViewGiftSkuListItemBinding binding;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public SkuListItem(WidgetSettingsGiftingAdapter widgetSettingsGiftingAdapter) {
|
|
super(2131558757, widgetSettingsGiftingAdapter);
|
|
m.checkNotNullParameter(widgetSettingsGiftingAdapter, "adapter");
|
|
View view = this.itemView;
|
|
int i = 2131363371;
|
|
ImageView imageView = (ImageView) view.findViewById(2131363371);
|
|
if (imageView != null) {
|
|
i = 2131363372;
|
|
TextView textView = (TextView) view.findViewById(2131363372);
|
|
if (textView != null) {
|
|
i = 2131363373;
|
|
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(2131363373);
|
|
if (simpleDraweeView != null) {
|
|
i = 2131363374;
|
|
TextView textView2 = (TextView) view.findViewById(2131363374);
|
|
if (textView2 != null) {
|
|
ViewGiftSkuListItemBinding viewGiftSkuListItemBinding = new ViewGiftSkuListItemBinding((CardView) view, imageView, textView, simpleDraweeView, textView2);
|
|
m.checkNotNullExpressionValue(viewGiftSkuListItemBinding, "ViewGiftSkuListItemBinding.bind(itemView)");
|
|
this.binding = viewGiftSkuListItemBinding;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(i)));
|
|
}
|
|
|
|
public static final /* synthetic */ WidgetSettingsGiftingAdapter access$getAdapter$p(SkuListItem skuListItem) {
|
|
return (WidgetSettingsGiftingAdapter) skuListItem.adapter;
|
|
}
|
|
|
|
public void onConfigure(int i, GiftItem giftItem) {
|
|
CharSequence charSequence;
|
|
String e;
|
|
m.checkNotNullParameter(giftItem, "data");
|
|
super.onConfigure(i, (int) giftItem);
|
|
if (giftItem.getSku() != null && giftItem.getCopies() != null && giftItem.getExpanded() != null) {
|
|
TextView textView = this.binding.e;
|
|
m.checkNotNullExpressionValue(textView, "binding.giftSkuName");
|
|
textView.setText(giftItem.getSku().getName());
|
|
String str = null;
|
|
SubscriptionPlanType from = giftItem.getPlanId() != null ? SubscriptionPlanType.Companion.from(giftItem.getPlanId().longValue()) : null;
|
|
TextView textView2 = this.binding.e;
|
|
m.checkNotNullExpressionValue(textView2, "binding.giftSkuName");
|
|
if (from != null) {
|
|
Pair pair = from.getInterval() == SubscriptionInterval.MONTHLY ? new Pair(2131889104, 2131755128) : new Pair(2131889105, 2131755129);
|
|
int intValue = ((Number) pair.component1()).intValue();
|
|
int intValue2 = ((Number) pair.component2()).intValue();
|
|
View view = this.itemView;
|
|
m.checkNotNullExpressionValue(view, "itemView");
|
|
charSequence = b.c(view, intValue, new Object[0], new WidgetSettingsGiftingAdapter$SkuListItem$onConfigure$1(this, giftItem, intValue2, 1));
|
|
} else {
|
|
charSequence = giftItem.getSku().getName();
|
|
}
|
|
textView2.setText(charSequence);
|
|
TextView textView3 = this.binding.f1657c;
|
|
m.checkNotNullExpressionValue(textView3, "binding.giftSkuCopies");
|
|
textView3.setText(StringResourceUtilsKt.getI18nPluralString(a.x(this.itemView, "itemView", "itemView.context"), 2131755125, giftItem.getCopies().intValue(), giftItem.getCopies()));
|
|
this.binding.b.setImageResource(giftItem.getExpanded().booleanValue() ? 2131231528 : 2131231532);
|
|
PremiumUtils premiumUtils = PremiumUtils.INSTANCE;
|
|
if (premiumUtils.isNitroSku(giftItem.getSku())) {
|
|
this.binding.d.setImageResource(premiumUtils.getNitroGiftIcon(giftItem.getSku()));
|
|
} else {
|
|
Application application = giftItem.getSku().getApplication();
|
|
if (!(application == null || (e = application.e()) == null)) {
|
|
str = IconUtils.getApplicationIcon$default(giftItem.getSku().getApplicationId(), e, 0, 4, null);
|
|
}
|
|
this.binding.d.setImageURI(str);
|
|
}
|
|
this.itemView.setOnClickListener(new WidgetSettingsGiftingAdapter$SkuListItem$onConfigure$2(this, giftItem));
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public WidgetSettingsGiftingAdapter(RecyclerView recyclerView) {
|
|
super(recyclerView, false, 2, null);
|
|
m.checkNotNullParameter(recyclerView, "recycler");
|
|
}
|
|
|
|
public static final /* synthetic */ Function1 access$getOnClickCopyListener$p(WidgetSettingsGiftingAdapter widgetSettingsGiftingAdapter) {
|
|
return widgetSettingsGiftingAdapter.onClickCopyListener;
|
|
}
|
|
|
|
public static final /* synthetic */ Function2 access$getOnClickSkuListener$p(WidgetSettingsGiftingAdapter widgetSettingsGiftingAdapter) {
|
|
return widgetSettingsGiftingAdapter.onClickSkuListener;
|
|
}
|
|
|
|
public static final /* synthetic */ Function2 access$getOnGenerateClickListener$p(WidgetSettingsGiftingAdapter widgetSettingsGiftingAdapter) {
|
|
return widgetSettingsGiftingAdapter.onGenerateClickListener;
|
|
}
|
|
|
|
public static final /* synthetic */ Function1 access$getOnRevokeClickListener$p(WidgetSettingsGiftingAdapter widgetSettingsGiftingAdapter) {
|
|
return widgetSettingsGiftingAdapter.onRevokeClickListener;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setOnClickCopyListener$p(WidgetSettingsGiftingAdapter widgetSettingsGiftingAdapter, Function1 function1) {
|
|
widgetSettingsGiftingAdapter.onClickCopyListener = function1;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setOnClickSkuListener$p(WidgetSettingsGiftingAdapter widgetSettingsGiftingAdapter, Function2 function2) {
|
|
widgetSettingsGiftingAdapter.onClickSkuListener = function2;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setOnGenerateClickListener$p(WidgetSettingsGiftingAdapter widgetSettingsGiftingAdapter, Function2 function2) {
|
|
widgetSettingsGiftingAdapter.onGenerateClickListener = function2;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setOnRevokeClickListener$p(WidgetSettingsGiftingAdapter widgetSettingsGiftingAdapter, Function1 function1) {
|
|
widgetSettingsGiftingAdapter.onRevokeClickListener = function1;
|
|
}
|
|
|
|
public final void configure(List<GiftItem> list, Function2<? super Long, ? super Long, Unit> function2, Function1<? super String, Unit> function1, Function1<? super ModelGift, Unit> function12, Function2<? super Long, ? super Long, Unit> function22) {
|
|
m.checkNotNullParameter(list, "giftItems");
|
|
m.checkNotNullParameter(function2, "onClickSkuListener");
|
|
m.checkNotNullParameter(function1, "onClickCopyListener");
|
|
m.checkNotNullParameter(function12, "onRevokeClickListener");
|
|
m.checkNotNullParameter(function22, "onGenerateClickListener");
|
|
setData(list);
|
|
this.onClickSkuListener = function2;
|
|
this.onClickCopyListener = function1;
|
|
this.onRevokeClickListener = function12;
|
|
this.onGenerateClickListener = function22;
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public MGRecyclerViewHolder<WidgetSettingsGiftingAdapter, GiftItem> onCreateViewHolder(ViewGroup viewGroup, int i) {
|
|
m.checkNotNullParameter(viewGroup, "parent");
|
|
if (i == 0) {
|
|
return new NoGiftsListItem(this);
|
|
}
|
|
if (i == 1) {
|
|
return new SkuListItem(this);
|
|
}
|
|
if (i == 2) {
|
|
return new EntitlementListItem(this);
|
|
}
|
|
throw invalidViewTypeException(i);
|
|
}
|
|
}
|