discord-jadx/app/src/main/java/com/discord/widgets/settings/premium/WidgetSettingsGiftingOutbou...

177 lines
11 KiB
Java

package com.discord.widgets.settings.premium;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.ListAdapter;
import androidx.recyclerview.widget.RecyclerView;
import c.a.k.b;
import com.discord.databinding.ViewGiftOutboundPromoListItemBinding;
import com.discord.utilities.icon.IconUtils;
import com.discord.utilities.images.MGImages;
import com.discord.utilities.time.TimeUtils;
import com.discord.utilities.view.recycler.SimpleItemCallback;
import com.discord.widgets.settings.premium.ClaimStatus;
import com.discord.widgets.settings.premium.SettingsGiftingViewModel;
import com.facebook.drawee.view.SimpleDraweeView;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.card.MaterialCardView;
import d0.z.d.m;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
/* compiled from: WidgetSettingsGiftingOutboundPromosAdapter.kt */
public final class WidgetSettingsGiftingOutboundPromosAdapter extends ListAdapter<SettingsGiftingViewModel.OutboundPromoItem, OutboundPromoViewHolder> {
public static final Companion Companion = new Companion(null);
private static final SimpleItemCallback<SettingsGiftingViewModel.OutboundPromoItem> DIFF_CALLBACK = new SimpleItemCallback<>(WidgetSettingsGiftingOutboundPromosAdapter$Companion$DIFF_CALLBACK$1.INSTANCE);
private final Function1<SettingsGiftingViewModel.OutboundPromoItem, Unit> onButtonClick;
private final Function1<SettingsGiftingViewModel.OutboundPromoItem, Unit> onMoreDetailsClick;
/* compiled from: WidgetSettingsGiftingOutboundPromosAdapter.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
/* compiled from: WidgetSettingsGiftingOutboundPromosAdapter.kt */
public static final class OutboundPromoViewHolder extends RecyclerView.ViewHolder {
private final ViewGiftOutboundPromoListItemBinding binding;
private SettingsGiftingViewModel.OutboundPromoItem boundItem;
private final Function1<SettingsGiftingViewModel.OutboundPromoItem, Unit> onButtonClick;
private final Function1<SettingsGiftingViewModel.OutboundPromoItem, Unit> onMoreDetailsClick;
/* JADX DEBUG: Multi-variable search result rejected for r10v0, resolved type: kotlin.jvm.functions.Function1<? super com.discord.widgets.settings.premium.SettingsGiftingViewModel$OutboundPromoItem, kotlin.Unit> */
/* JADX DEBUG: Multi-variable search result rejected for r11v0, resolved type: kotlin.jvm.functions.Function1<? super com.discord.widgets.settings.premium.SettingsGiftingViewModel$OutboundPromoItem, kotlin.Unit> */
/* JADX WARN: Multi-variable type inference failed */
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public OutboundPromoViewHolder(ViewGroup viewGroup, Function1<? super SettingsGiftingViewModel.OutboundPromoItem, Unit> function1, Function1<? super SettingsGiftingViewModel.OutboundPromoItem, Unit> function12) {
super(LayoutInflater.from(viewGroup.getContext()).inflate(2131558756, viewGroup, false));
m.checkNotNullParameter(viewGroup, "parent");
m.checkNotNullParameter(function1, "onMoreDetailsClick");
m.checkNotNullParameter(function12, "onButtonClick");
this.onMoreDetailsClick = function1;
this.onButtonClick = function12;
View view = this.itemView;
int i = 2131363349;
MaterialButton materialButton = (MaterialButton) view.findViewById(2131363349);
if (materialButton != null) {
i = 2131363350;
TextView textView = (TextView) view.findViewById(2131363350);
if (textView != null) {
i = 2131363351;
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(2131363351);
if (simpleDraweeView != null) {
i = 2131363352;
TextView textView2 = (TextView) view.findViewById(2131363352);
if (textView2 != null) {
i = 2131363353;
TextView textView3 = (TextView) view.findViewById(2131363353);
if (textView3 != null) {
ViewGiftOutboundPromoListItemBinding viewGiftOutboundPromoListItemBinding = new ViewGiftOutboundPromoListItemBinding((MaterialCardView) view, materialButton, textView, simpleDraweeView, textView2, textView3);
textView2.setOnClickListener(new WidgetSettingsGiftingOutboundPromosAdapter$OutboundPromoViewHolder$$special$$inlined$also$lambda$1(this));
materialButton.setOnClickListener(new WidgetSettingsGiftingOutboundPromosAdapter$OutboundPromoViewHolder$$special$$inlined$also$lambda$2(this));
m.checkNotNullExpressionValue(viewGiftOutboundPromoListItemBinding, "ViewGiftOutboundPromoLis…nClick(boundItem) }\n }");
this.binding = viewGiftOutboundPromoListItemBinding;
return;
}
}
}
}
}
throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(i)));
}
public static final /* synthetic */ SettingsGiftingViewModel.OutboundPromoItem access$getBoundItem$p(OutboundPromoViewHolder outboundPromoViewHolder) {
SettingsGiftingViewModel.OutboundPromoItem outboundPromoItem = outboundPromoViewHolder.boundItem;
if (outboundPromoItem == null) {
m.throwUninitializedPropertyAccessException("boundItem");
}
return outboundPromoItem;
}
public static final /* synthetic */ Function1 access$getOnButtonClick$p(OutboundPromoViewHolder outboundPromoViewHolder) {
return outboundPromoViewHolder.onButtonClick;
}
public static final /* synthetic */ Function1 access$getOnMoreDetailsClick$p(OutboundPromoViewHolder outboundPromoViewHolder) {
return outboundPromoViewHolder.onMoreDetailsClick;
}
public static final /* synthetic */ void access$setBoundItem$p(OutboundPromoViewHolder outboundPromoViewHolder, SettingsGiftingViewModel.OutboundPromoItem outboundPromoItem) {
outboundPromoViewHolder.boundItem = outboundPromoItem;
}
public final void bindTo(SettingsGiftingViewModel.OutboundPromoItem outboundPromoItem) {
m.checkNotNullParameter(outboundPromoItem, "item");
this.boundItem = outboundPromoItem;
SimpleDraweeView simpleDraweeView = this.binding.d;
m.checkNotNullExpressionValue(simpleDraweeView, "binding.giftPromoImage");
IconUtils.setIcon$default(simpleDraweeView, outboundPromoItem.getImageUrl(), 0, (Function1) null, new MGImages.DistinctChangeDetector(), 12, (Object) null);
TextView textView = this.binding.f;
m.checkNotNullExpressionValue(textView, "binding.giftPromoTitle");
textView.setText(outboundPromoItem.getTitle());
ClaimStatus claimStatus = outboundPromoItem.getClaimStatus();
if (claimStatus instanceof ClaimStatus.Unclaimed) {
long f = ((ClaimStatus.Unclaimed) outboundPromoItem.getClaimStatus()).getClaimBy().f();
TimeUtils timeUtils = TimeUtils.INSTANCE;
View view = this.itemView;
m.checkNotNullExpressionValue(view, "itemView");
Context context = view.getContext();
m.checkNotNullExpressionValue(context, "itemView.context");
String renderUtcDate = timeUtils.renderUtcDate(f, context, 1);
TextView textView2 = this.binding.f1656c;
m.checkNotNullExpressionValue(textView2, "binding.giftPromoDescription");
b.m(textView2, 2131891379, new Object[]{renderUtcDate}, null, 4);
MaterialButton materialButton = this.binding.b;
m.checkNotNullExpressionValue(materialButton, "binding.giftPromoButton");
b.m(materialButton, 2131892601, new Object[0], null, 4);
} else if (claimStatus instanceof ClaimStatus.Claimed) {
long f2 = ((ClaimStatus.Claimed) outboundPromoItem.getClaimStatus()).getRedeemBy().f();
TimeUtils timeUtils2 = TimeUtils.INSTANCE;
View view2 = this.itemView;
m.checkNotNullExpressionValue(view2, "itemView");
Context context2 = view2.getContext();
m.checkNotNullExpressionValue(context2, "itemView.context");
String renderUtcDate2 = timeUtils2.renderUtcDate(f2, context2, 1);
TextView textView3 = this.binding.f1656c;
m.checkNotNullExpressionValue(textView3, "binding.giftPromoDescription");
b.m(textView3, 2131891378, new Object[]{renderUtcDate2}, null, 4);
MaterialButton materialButton2 = this.binding.b;
m.checkNotNullExpressionValue(materialButton2, "binding.giftPromoButton");
b.m(materialButton2, 2131891864, new Object[0], null, 4);
}
}
}
/* JADX DEBUG: Multi-variable search result rejected for r2v0, resolved type: kotlin.jvm.functions.Function1<? super com.discord.widgets.settings.premium.SettingsGiftingViewModel$OutboundPromoItem, kotlin.Unit> */
/* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: kotlin.jvm.functions.Function1<? super com.discord.widgets.settings.premium.SettingsGiftingViewModel$OutboundPromoItem, kotlin.Unit> */
/* JADX WARN: Multi-variable type inference failed */
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public WidgetSettingsGiftingOutboundPromosAdapter(Function1<? super SettingsGiftingViewModel.OutboundPromoItem, Unit> function1, Function1<? super SettingsGiftingViewModel.OutboundPromoItem, Unit> function12) {
super(DIFF_CALLBACK);
m.checkNotNullParameter(function1, "onMoreDetailsClick");
m.checkNotNullParameter(function12, "onButtonClick");
this.onMoreDetailsClick = function1;
this.onButtonClick = function12;
}
public void onBindViewHolder(OutboundPromoViewHolder outboundPromoViewHolder, int i) {
m.checkNotNullParameter(outboundPromoViewHolder, "holder");
SettingsGiftingViewModel.OutboundPromoItem item = getItem(i);
m.checkNotNullExpressionValue(item, "getItem(position)");
outboundPromoViewHolder.bindTo(item);
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public OutboundPromoViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
m.checkNotNullParameter(viewGroup, "parent");
return new OutboundPromoViewHolder(viewGroup, this.onMoreDetailsClick, this.onButtonClick);
}
}