小红书.apk(点击下载) / AlphaRedPacketDialog.java
package com.xingin.alpha.gift.redpacket;
import android.animation.Animator;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Space;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.baichuan.trade.common.adapter.ut.impl.AppMonitorUserTracker;
import com.meizu.cloud.pushsdk.notification.model.AdvanceSetting;
import com.uber.autodispose.b0;
import com.uber.autodispose.y;
import com.xingin.alpha.R$drawable;
import com.xingin.alpha.R$id;
import com.xingin.alpha.R$layout;
import com.xingin.alpha.R$string;
import com.xingin.alpha.api.service.AlphaGiftService;
import com.xingin.alpha.base.AlphaBaseCustomCenterDialog;
import com.xingin.alpha.bean.FollowBean;
import com.xingin.alpha.gift.bean.CoinBean;
import com.xingin.alpha.gift.bean.RedPacketPurchaseResultBean;
import com.xingin.android.mixim.msg.bean.business.RedPacketDescBean;
import com.xingin.android.xhscomm.event.Event;
import com.xingin.ui.textview.XYTextView;
import com.xingin.widgets.XYImageView;
import dp.p;
import dp.q;
import dw2.a0;
import dw2.r;
import el.g0;
import ja.b1;
import java.util.Objects;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.Pair;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Lambda;
import p000do.x;
import sy.f0;
import sy.h1;
import sy.v0;
import sy.z;
import t10.o;
import t10.p0;
import uo.s;
import uo.t;
import vn.a;
public final class AlphaRedPacketDialog extends AlphaBaseCustomCenterDialog implements vn.a {
public static final a Y = new a(null);
public Long A;
public boolean B;
public boolean C;
/* renamed from: J */
public boolean f42628J;
public boolean K;
public int L = 180;
public z M = z.UNKNOWN;
public final Lazy N = LazyKt__LazyJVMKt.lazy(b.f42636a);
public final vn.f O = new vn.f();
public Animation P;
public Animator Q;
public Animator R;
public Animator S;
public Animator T;
public Animator U;
public Animator V;
public Animator W;
public Animator X;
/* renamed from: t */
public String f42629t;
/* renamed from: u */
public Function0<Unit> f42630u = g.f42644a;
/* renamed from: v */
public Function0<Unit> f42631v = new c(this);
/* renamed from: w */
public int f42632w = -1;
/* renamed from: x */
public Long f42633x;
/* renamed from: y */
public Long f42634y;
/* renamed from: z */
public String f42635z;
public static final class a {
public a() {
}
public /* synthetic */ a(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
public static final class b extends Lambda implements Function0<AlphaRedPacketAmountAdapter> {
/* renamed from: a */
public static final b f42636a = new b();
public b() {
super(0);
}
/* renamed from: a */
public final AlphaRedPacketAmountAdapter invoke() {
return new AlphaRedPacketAmountAdapter();
}
}
public static final class c extends Lambda implements Function0<Unit> {
/* renamed from: a */
public final /* synthetic */ AlphaRedPacketDialog f42637a;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public c(AlphaRedPacketDialog alphaRedPacketDialog) {
super(0);
this.f42637a = alphaRedPacketDialog;
}
@Override // kotlin.jvm.functions.Function0
public final void invoke() {
if (this.f42637a.f42635z != null && this.f42637a.A != null) {
vn.f fVar = this.f42637a.O;
String valueOf = String.valueOf(this.f42637a.A);
String str = this.f42637a.f42635z;
Intrinsics.checkNotNull(str);
fVar.W0(valueOf, str);
fy.b.f78513a.p0(String.valueOf(this.f42637a.A), this.f42637a.T0(), String.valueOf(this.f42637a.f42635z));
}
}
}
public static final class d extends Lambda implements Function1<TextView, Unit> {
/* renamed from: a */
public final /* synthetic */ RedPacketDescBean f42638a;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public d(RedPacketDescBean redPacketDescBean) {
super(1);
this.f42638a = redPacketDescBean;
}
public final void a(TextView textView) {
Intrinsics.checkNotNullParameter(textView, "$this$showIf");
if (this.f42638a.getCondition() >= 2) {
textView.setText(this.f42638a.getConditionDesc());
}
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(TextView textView) {
a(textView);
return Unit.INSTANCE;
}
}
public static final class e extends Lambda implements Function1<TextView, Unit> {
/* renamed from: a */
public final /* synthetic */ AlphaRedPacketDialog f42639a;
/* renamed from: b */
public final /* synthetic */ RedPacketPurchaseResultBean f42640b;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public e(AlphaRedPacketDialog alphaRedPacketDialog, RedPacketPurchaseResultBean redPacketPurchaseResultBean) {
super(1);
this.f42639a = alphaRedPacketDialog;
this.f42640b = redPacketPurchaseResultBean;
}
public final void a(TextView textView) {
Intrinsics.checkNotNullParameter(textView, "$this$showIf");
AlphaRedPacketDialog alphaRedPacketDialog = this.f42639a;
alphaRedPacketDialog.B1(!alphaRedPacketDialog.u1(this.f42640b.e()));
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(TextView textView) {
a(textView);
return Unit.INSTANCE;
}
}
public static final class f extends Lambda implements Function2<Boolean, CoinBean, Unit> {
/* renamed from: a */
public final /* synthetic */ AlphaRedPacketDialog f42641a;
/* renamed from: b */
public final /* synthetic */ RedPacketPurchaseResultBean f42642b;
/* renamed from: c */
public final /* synthetic */ RedPacketPurchaseResultBean f42643c;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public f(AlphaRedPacketDialog alphaRedPacketDialog, RedPacketPurchaseResultBean redPacketPurchaseResultBean, RedPacketPurchaseResultBean redPacketPurchaseResultBean2) {
super(2);
this.f42641a = alphaRedPacketDialog;
this.f42642b = redPacketPurchaseResultBean;
this.f42643c = redPacketPurchaseResultBean2;
}
public final void a(boolean z14, CoinBean coinBean) {
s c14;
if (!(!z14 || coinBean == null || (c14 = t.f138147a.c()) == null)) {
c14.k(coinBean.getBalance());
}
if (this.f42641a.M.isAudience()) {
fy.b.f78513a.s0(String.valueOf(this.f42641a.A), this.f42641a.T0(), this.f42642b.e().getTotalCoins(), this.f42643c.b());
} else {
fy.d.f78950a.Q(String.valueOf(this.f42641a.A), this.f42641a.T0(), this.f42642b.e().getTotalCoins(), this.f42643c.b());
}
AlphaRedPacketDialog alphaRedPacketDialog = this.f42641a;
RedPacketPurchaseResultBean redPacketPurchaseResultBean = this.f42643c;
Intrinsics.checkNotNullExpressionValue(redPacketPurchaseResultBean, AdvanceSetting.NETWORK_TYPE);
alphaRedPacketDialog.G1(redPacketPurchaseResultBean);
}
@Override // kotlin.jvm.functions.Function2
public /* bridge */ /* synthetic */ Unit invoke(Boolean bool, CoinBean coinBean) {
a(bool.booleanValue(), coinBean);
return Unit.INSTANCE;
}
}
public static final class g extends Lambda implements Function0<Unit> {
/* renamed from: a */
public static final g f42644a = new g();
public g() {
super(0);
}
@Override // kotlin.jvm.functions.Function0
public final void invoke() {
}
}
public static final class h extends Lambda implements Function1<Bitmap, Unit> {
/* renamed from: a */
public final /* synthetic */ AlphaRedPacketDialog f42645a;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public h(AlphaRedPacketDialog alphaRedPacketDialog) {
super(1);
this.f42645a = alphaRedPacketDialog;
}
public final void a(Bitmap bitmap) {
Intrinsics.checkNotNullParameter(bitmap, AdvanceSetting.NETWORK_TYPE);
AlphaRedPacketDialog alphaRedPacketDialog = this.f42645a;
int i10 = R$id.eih;
View findViewById = alphaRedPacketDialog.findViewById(i10);
Intrinsics.checkNotNullExpressionValue(findViewById, "redPacketFrameLayout");
ViewGroup.LayoutParams layoutParams = findViewById.getLayoutParams();
Objects.requireNonNull(layoutParams, "null cannot be cast to non-null type android.view.ViewGroup.LayoutParams");
Resources system = Resources.getSystem();
Intrinsics.checkExpressionValueIsNotNull(system, "Resources.getSystem()");
layoutParams.height = (int) TypedValue.applyDimension(1, (float) 374, system.getDisplayMetrics());
findViewById.setLayoutParams(layoutParams);
this.f42645a.findViewById(i10).setBackground(new BitmapDrawable(this.f42645a.getContext().getResources(), bitmap));
Resources system2 = Resources.getSystem();
Intrinsics.checkExpressionValueIsNotNull(system2, "Resources.getSystem()");
p0.i((FrameLayout) this.f42645a.findViewById(R$id.f39729avatarFrameLayout), (int) TypedValue.applyDimension(1, (float) 88, system2.getDisplayMetrics()));
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(Bitmap bitmap) {
a(bitmap);
return Unit.INSTANCE;
}
}
public static final class i extends Lambda implements Function1<String, Unit> {
/* renamed from: a */
public static final i f42646a = new i();
public i() {
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(String str) {
invoke(str);
return Unit.INSTANCE;
}
public final void invoke(String str) {
Intrinsics.checkNotNullParameter(str, AdvanceSetting.NETWORK_TYPE);
Bundle bundle = new Bundle();
bundle.putString(AppMonitorUserTracker.USER_ID, str);
e30.c.e(new Event("com.xingin.xhs.user.dialog", bundle));
}
}
public static final class j implements Animation.AnimationListener {
/* renamed from: a */
public final /* synthetic */ AlphaRedPacketDialog f42647a;
/* renamed from: b */
public final /* synthetic */ boolean f42648b;
public j(AlphaRedPacketDialog alphaRedPacketDialog, boolean z14) {
this.f42647a = alphaRedPacketDialog;
this.f42648b = z14;
}
public void onAnimationEnd(Animation animation) {
if (this.f42647a.Q == null) {
AlphaRedPacketDialog alphaRedPacketDialog = this.f42647a;
dp.h hVar = dp.h.f69499a;
FrameLayout frameLayout = (FrameLayout) alphaRedPacketDialog.findViewById(R$id.f39729avatarFrameLayout);
Intrinsics.checkNotNullExpressionValue(frameLayout, "avatarFrameLayout");
alphaRedPacketDialog.Q = dp.h.b(hVar, frameLayout, 100, null, 4, null);
} else {
Animator animator = this.f42647a.Q;
if (animator != null) {
animator.cancel();
}
}
Animator animator2 = this.f42647a.Q;
if (animator2 != null) {
animator2.start();
}
bj2.l.q((TextView) this.f42647a.findViewById(R$id.eiw));
this.f42647a.I1(this.f42648b);
}
public void onAnimationRepeat(Animation animation) {
}
public void onAnimationStart(Animation animation) {
this.f42647a.f1();
}
}
public static final class k extends Lambda implements Function1<Bitmap, Unit> {
/* renamed from: a */
public final /* synthetic */ AlphaRedPacketDialog f42649a;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public k(AlphaRedPacketDialog alphaRedPacketDialog) {
super(1);
this.f42649a = alphaRedPacketDialog;
}
public final void a(Bitmap bitmap) {
Intrinsics.checkNotNullParameter(bitmap, AdvanceSetting.NETWORK_TYPE);
((Button) this.f42649a.findViewById(R$id.f39904sendToEmceeBtn)).setBackground(new BitmapDrawable(this.f42649a.getContext().getResources(), bitmap));
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(Bitmap bitmap) {
a(bitmap);
return Unit.INSTANCE;
}
}
public static final class l extends Lambda implements Function1<Bitmap, Unit> {
/* renamed from: a */
public final /* synthetic */ AlphaRedPacketDialog f42650a;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public l(AlphaRedPacketDialog alphaRedPacketDialog) {
super(1);
this.f42650a = alphaRedPacketDialog;
}
public final void a(Bitmap bitmap) {
Intrinsics.checkNotNullParameter(bitmap, AdvanceSetting.NETWORK_TYPE);
AlphaRedPacketDialog alphaRedPacketDialog = this.f42650a;
int i10 = R$id.eih;
View findViewById = alphaRedPacketDialog.findViewById(i10);
Intrinsics.checkNotNullExpressionValue(findViewById, "redPacketFrameLayout");
ViewGroup.LayoutParams layoutParams = findViewById.getLayoutParams();
Objects.requireNonNull(layoutParams, "null cannot be cast to non-null type android.view.ViewGroup.LayoutParams");
Resources system = Resources.getSystem();
Intrinsics.checkExpressionValueIsNotNull(system, "Resources.getSystem()");
layoutParams.height = (int) TypedValue.applyDimension(1, (float) 374, system.getDisplayMetrics());
findViewById.setLayoutParams(layoutParams);
this.f42650a.findViewById(i10).setBackground(new BitmapDrawable(this.f42650a.getContext().getResources(), bitmap));
Resources system2 = Resources.getSystem();
Intrinsics.checkExpressionValueIsNotNull(system2, "Resources.getSystem()");
p0.i((FrameLayout) this.f42650a.findViewById(R$id.f39729avatarFrameLayout), (int) TypedValue.applyDimension(1, (float) 88, system2.getDisplayMetrics()));
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(Bitmap bitmap) {
a(bitmap);
return Unit.INSTANCE;
}
}
public static final class m extends Lambda implements Function1<Bitmap, Unit> {
/* renamed from: a */
public final /* synthetic */ AlphaRedPacketDialog f42651a;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public m(AlphaRedPacketDialog alphaRedPacketDialog) {
super(1);
this.f42651a = alphaRedPacketDialog;
}
public final void a(Bitmap bitmap) {
Intrinsics.checkNotNullParameter(bitmap, AdvanceSetting.NETWORK_TYPE);
((AlphaRedPacketProgressBar) this.f42651a.findViewById(R$id.eiv)).setBackground(new BitmapDrawable(this.f42651a.getContext().getResources(), bitmap));
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(Bitmap bitmap) {
a(bitmap);
return Unit.INSTANCE;
}
}
public static final class n extends Lambda implements Function0<Unit> {
/* renamed from: a */
public final /* synthetic */ AlphaRedPacketDialog f42652a;
/* renamed from: b */
public final /* synthetic */ RedPacketPurchaseResultBean f42653b;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public n(AlphaRedPacketDialog alphaRedPacketDialog, RedPacketPurchaseResultBean redPacketPurchaseResultBean) {
super(0);
this.f42652a = alphaRedPacketDialog;
this.f42653b = redPacketPurchaseResultBean;
}
@Override // kotlin.jvm.functions.Function0
public final void invoke() {
this.f42652a.x1(this.f42653b);
}
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public AlphaRedPacketDialog(Context context, String str) {
super(context, false, false, true, false, null, 54, null);
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(str, "emceeId");
this.f42629t = str;
}
public static /* synthetic */ void O1(AlphaRedPacketDialog alphaRedPacketDialog, long j14, boolean z14, int i10, Object obj) {
if ((i10 & 2) != 0) {
z14 = true;
}
alphaRedPacketDialog.N1(j14, z14);
}
public static final void V0(Function2 function2, CoinBean coinBean) {
Intrinsics.checkNotNullParameter(function2, "$callback");
function2.invoke(Boolean.TRUE, coinBean);
}
public static final void W0(Function2 function2, Throwable th3) {
Intrinsics.checkNotNullParameter(function2, "$callback");
function2.invoke(Boolean.FALSE, null);
}
public static final void c1(AlphaRedPacketDialog alphaRedPacketDialog, RedPacketPurchaseResultBean redPacketPurchaseResultBean) {
Intrinsics.checkNotNullParameter(alphaRedPacketDialog, "this$0");
alphaRedPacketDialog.D(false);
if (redPacketPurchaseResultBean != null) {
alphaRedPacketDialog.j1(redPacketPurchaseResultBean);
}
}
public static final void d1(AlphaRedPacketDialog alphaRedPacketDialog, Throwable th3) {
Intrinsics.checkNotNullParameter(alphaRedPacketDialog, "this$0");
alphaRedPacketDialog.D(false);
th3.printStackTrace();
}
public static final void k1(RedPacketDescBean redPacketDescBean, View view) {
Intrinsics.checkNotNullParameter(redPacketDescBean, "$it");
Bundle bundle = new Bundle();
bundle.putString(AppMonitorUserTracker.USER_ID, redPacketDescBean.getSender().getUserId());
e30.c.e(new Event("com.xingin.xhs.user.dialog", bundle));
}
public static final void o1(AlphaRedPacketDialog alphaRedPacketDialog, View view) {
Intrinsics.checkNotNullParameter(alphaRedPacketDialog, "this$0");
alphaRedPacketDialog.dismiss();
}
public static final void q1(View view) {
}
public static final void r1(AlphaRedPacketDialog alphaRedPacketDialog, View view) {
Intrinsics.checkNotNullParameter(alphaRedPacketDialog, "this$0");
fy.b.f78513a.t0(String.valueOf(alphaRedPacketDialog.A), alphaRedPacketDialog.f42629t);
alphaRedPacketDialog.f42630u.invoke();
alphaRedPacketDialog.dismiss();
}
public static final void s1(AlphaRedPacketDialog alphaRedPacketDialog, View view) {
Intrinsics.checkNotNullParameter(alphaRedPacketDialog, "this$0");
alphaRedPacketDialog.f42631v.invoke();
alphaRedPacketDialog.f42628J = true;
}
public static final void t1(AlphaRedPacketDialog alphaRedPacketDialog, View view) {
Intrinsics.checkNotNullParameter(alphaRedPacketDialog, "this$0");
alphaRedPacketDialog.dismiss();
}
public static final void y1(AlphaRedPacketDialog alphaRedPacketDialog, RedPacketPurchaseResultBean redPacketPurchaseResultBean, RedPacketPurchaseResultBean redPacketPurchaseResultBean2) {
Intrinsics.checkNotNullParameter(alphaRedPacketDialog, "this$0");
Intrinsics.checkNotNullParameter(redPacketPurchaseResultBean, "$packetDesc");
Animator animator = alphaRedPacketDialog.S;
if (animator != null) {
animator.cancel();
}
dp.z zVar = dp.z.f69524a;
Long l14 = alphaRedPacketDialog.f42633x;
Intrinsics.checkNotNull(l14);
zVar.C(l14.longValue());
if (redPacketPurchaseResultBean2 != null) {
v0 v0Var = v0.f131783a;
v0Var.c("AlphaRedPacketDialog", null, "purchaseRedPacket status=" + redPacketPurchaseResultBean2.f() + " code=" + redPacketPurchaseResultBean2.a() + " msg=" + redPacketPurchaseResultBean2.c() + " red_packet.status=" + redPacketPurchaseResultBean2.e().getStatus());
if (redPacketPurchaseResultBean2.f() == 4) {
f0.d(f0.f131631a, redPacketPurchaseResultBean2.c(), 0, 2, null);
} else if (redPacketPurchaseResultBean2.f() == 2 || redPacketPurchaseResultBean2.f() == 1) {
alphaRedPacketDialog.U0(redPacketPurchaseResultBean2.f(), new f(alphaRedPacketDialog, redPacketPurchaseResultBean, redPacketPurchaseResultBean2));
} else {
f0.c(f0.f131631a, R$string.f40806alpha_operate_fail, 0, 2, null);
}
}
}
public static final void z1(AlphaRedPacketDialog alphaRedPacketDialog, Throwable th3) {
Intrinsics.checkNotNullParameter(alphaRedPacketDialog, "this$0");
alphaRedPacketDialog.D(false);
th3.printStackTrace();
}
@Override // vn.a
public void A0(String str) {
a.C2340a.b(this, str);
}
public final boolean A1() {
return !b1.f94179a.d1(this.f42635z);
}
@Override // com.xingin.alpha.base.AlphaBaseCustomDialog, com.xingin.alpha.base.AlphaBaseCustomCenterDialog
public Animator B() {
View x14 = x();
if (x14 != null) {
return dp.h.g(dp.h.f69499a, x14, 0, null, 0, 14, null);
}
return null;
}
public final void B1(boolean z14) {
int i10;
this.K = !z14;
int i14 = R$id.followBtn;
((TextView) findViewById(i14)).setEnabled(z14);
TextView textView = (TextView) findViewById(i14);
Context context = getContext();
if (((TextView) findViewById(i14)).isEnabled()) {
i10 = R$string.a08;
} else {
i10 = R$string.f40422alpha_already_follow;
}
textView.setText(context.getString(i10));
}
@Override // com.xingin.alpha.base.AlphaBaseCustomDialog, ll.i
public void D(boolean z14) {
super.D(z14);
if (!z14) {
this.f42634y = null;
}
}
public final void D1(z zVar) {
Intrinsics.checkNotNullParameter(zVar, "role");
this.M = zVar;
}
@Override // com.xingin.alpha.base.AlphaBaseCustomDialog
public void E() {
Window window = getWindow();
if (window != null) {
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.width = -1;
attributes.height = -1;
attributes.gravity = t();
window.setAttributes(attributes);
}
}
public final void E1(Function0<Unit> function0) {
Intrinsics.checkNotNullParameter(function0, "<set-?>");
this.f42630u = function0;
}
public final void G1(RedPacketPurchaseResultBean redPacketPurchaseResultBean) {
bj2.l.b((TextView) findViewById(R$id.bae));
h1();
if (((LinearLayout) findViewById(R$id.esu)) == null) {
((ViewStub) findViewById(R$id.f39709amountListView)).inflate();
n1();
}
boolean z14 = true;
if (ak.c.f3514a.q0() == 1) {
sy.d.b(sy.d.f131603a, "https://picasso-static.xiaohongshu.com/fe-platform/1c2c2fe1b666fc79e3145a2fe38be88a82efeb90.webp", 0, null, null, new h(this), 14, null);
} else {
int i10 = R$id.eih;
View findViewById = findViewById(i10);
Intrinsics.checkNotNullExpressionValue(findViewById, "redPacketFrameLayout");
ViewGroup.LayoutParams layoutParams = findViewById.getLayoutParams();
Objects.requireNonNull(layoutParams, "null cannot be cast to non-null type android.view.ViewGroup.LayoutParams");
Resources system = Resources.getSystem();
Intrinsics.checkExpressionValueIsNotNull(system, "Resources.getSystem()");
layoutParams.height = (int) TypedValue.applyDimension(1, (float) 310, system.getDisplayMetrics());
findViewById.setLayoutParams(layoutParams);
findViewById(i10).setBackground(ContextCompat.getDrawable(getContext(), R$drawable.alpha_bg_big_red_packet_list));
Resources system2 = Resources.getSystem();
Intrinsics.checkExpressionValueIsNotNull(system2, "Resources.getSystem()");
p0.i((FrameLayout) findViewById(R$id.f39729avatarFrameLayout), (int) TypedValue.applyDimension(1, (float) 24, system2.getDisplayMetrics()));
}
int i14 = R$id.dhr;
LinearLayout linearLayout = (LinearLayout) findViewById(i14);
Intrinsics.checkNotNullExpressionValue(linearLayout, "mineAmountLayout");
ImageView imageView = (ImageView) findViewById(R$id.dhq);
Intrinsics.checkNotNullExpressionValue(imageView, "mineAmountImage");
R0(true, linearLayout, imageView);
bj2.l.s((Space) findViewById(R$id.f7i), !A1(), null, 2, null);
LinearLayout linearLayout2 = (LinearLayout) findViewById(i14);
Intrinsics.checkNotNullExpressionValue(linearLayout2, "mineAmountLayout");
if (redPacketPurchaseResultBean.f() == 1) {
bj2.l.b(linearLayout2);
} else {
bj2.l.q(linearLayout2);
}
bj2.l.s((TextView) findViewById(R$id.b16), redPacketPurchaseResultBean.f() == 1, null, 2, null);
int i15 = R$id.dhs;
((XYTextView) findViewById(i15)).setTypeface(o.a("BEBAS.ttf", getContext()));
((XYTextView) findViewById(i15)).setText(String.valueOf(redPacketPurchaseResultBean.b()));
S0().setData(redPacketPurchaseResultBean.d());
S0().setOnItemClickListener(i.f42646a);
if (this.M == z.EMCEE || redPacketPurchaseResultBean.f() != 2) {
z14 = false;
}
View findViewById2 = findViewById(R$id.eih);
Animation animation = this.P;
if (animation == null) {
this.P = dp.h.f69499a.e();
} else if (animation != null) {
animation.cancel();
}
findViewById2.startAnimation(this.P);
findViewById2.getAnimation().setAnimationListener(new j(this, z14));
}
@Override // com.xingin.alpha.base.AlphaBaseCustomCenterDialog
public int H() {
return R$layout.f40083alpha_dialog_red_packet;
}
@Override // com.xingin.alpha.base.AlphaBaseCustomCenterDialog
public void I() {
}
public final void I1(boolean z14) {
LinearLayout linearLayout = (LinearLayout) findViewById(R$id.esu);
if (linearLayout != null) {
bj2.l.q(linearLayout);
Animator animator = this.V;
if (animator == null) {
this.V = dp.h.b(dp.h.f69499a, linearLayout, 100, null, 4, null);
} else if (animator != null) {
animator.cancel();
}
Animator animator2 = this.V;
if (animator2 != null) {
animator2.start();
}
}
if (z14) {
int i10 = R$id.f39904sendToEmceeBtn;
bj2.l.q((Button) findViewById(i10));
if (ak.c.f3514a.q0() == 1) {
sy.d.b(sy.d.f131603a, "https://picasso-static.xiaohongshu.com/fe-platform/03523b6eae227d0e393baaa2c0246cff69790908.png", 0, null, null, new k(this), 14, null);
} else {
((Button) findViewById(i10)).setBackground(ContextCompat.getDrawable(getContext(), R$drawable.alpha_bg_red_packet_btn));
}
Animator animator3 = this.U;
if (animator3 == null) {
dp.h hVar = dp.h.f69499a;
Button button = (Button) findViewById(i10);
Intrinsics.checkNotNullExpressionValue(button, "sendToEmceeBtn");
this.U = hVar.c(button);
} else if (animator3 != null) {
animator3.cancel();
}
Animator animator4 = this.U;
if (animator4 != null) {
animator4.start();
}
}
}
@Override // com.xingin.alpha.base.AlphaBaseCustomCenterDialog
public void J() {
((ConstraintLayout) findViewById(R$id.eio)).setOnClickListener(new dp.l(this));
findViewById(R$id.eih).setOnClickListener(p.f69513a);
((Button) findViewById(R$id.f39904sendToEmceeBtn)).setOnClickListener(new dp.n(this));
((TextView) findViewById(R$id.followBtn)).setOnClickListener(new dp.m(this));
((ImageView) findViewById(R$id.ado)).setOnClickListener(new dp.i(this));
}
public final void J1() {
RelativeLayout relativeLayout = (RelativeLayout) findViewById(R$id.esx);
if (relativeLayout != null) {
bj2.l.q(relativeLayout);
}
}
@Override // com.xingin.alpha.base.AlphaBaseCustomCenterDialog
public void K() {
Window window = getWindow();
if (window != null) {
window.setDimAmount(0.4f);
}
}
public final void K1(RedPacketPurchaseResultBean redPacketPurchaseResultBean) {
g1();
if (((RelativeLayout) findViewById(R$id.esx)) == null) {
l1();
} else {
J1();
}
int i10 = R$id.eiv;
ak.c cVar = ak.c.f3514a;
((AlphaRedPacketProgressBar) findViewById(i10)).setStyle(cVar.q0());
if (cVar.q0() == 1) {
sy.d dVar = sy.d.f131603a;
sy.d.b(dVar, "https://picasso-static.xiaohongshu.com/fe-platform/4ea5c50a271d80730c5e7c683d2cf8e593d344ba.webp", 0, null, null, new l(this), 14, null);
((AlphaRedPacketProgressBar) findViewById(i10)).setNeedDrawBgStyle(false);
sy.d.b(dVar, "https://picasso-static.xiaohongshu.com/fe-platform/62e08ae15fd9a32deaa198695b0b6af6d27da0da.png", 0, null, null, new m(this), 14, null);
} else {
int i14 = R$id.eih;
View findViewById = findViewById(i14);
Intrinsics.checkNotNullExpressionValue(findViewById, "redPacketFrameLayout");
ViewGroup.LayoutParams layoutParams = findViewById.getLayoutParams();
Objects.requireNonNull(layoutParams, "null cannot be cast to non-null type android.view.ViewGroup.LayoutParams");
Resources system = Resources.getSystem();
Intrinsics.checkExpressionValueIsNotNull(system, "Resources.getSystem()");
layoutParams.height = (int) TypedValue.applyDimension(1, (float) 310, system.getDisplayMetrics());
findViewById.setLayoutParams(layoutParams);
findViewById(i14).setBackground(ContextCompat.getDrawable(getContext(), R$drawable.alpha_bg_big_red_packet));
Resources system2 = Resources.getSystem();
Intrinsics.checkExpressionValueIsNotNull(system2, "Resources.getSystem()");
p0.i((FrameLayout) findViewById(R$id.f39729avatarFrameLayout), (int) TypedValue.applyDimension(1, (float) 24, system2.getDisplayMetrics()));
((AlphaRedPacketProgressBar) findViewById(i10)).setNeedDrawBgStyle(true);
((AlphaRedPacketProgressBar) findViewById(i10)).setBackground(null);
}
int i15 = R$id.eiu;
LinearLayout linearLayout = (LinearLayout) findViewById(i15);
Intrinsics.checkNotNullExpressionValue(linearLayout, "redPocketAmountLayout");
ImageView imageView = (ImageView) findViewById(R$id.eit);
Intrinsics.checkNotNullExpressionValue(imageView, "redPocketAmountImage");
R0(true, linearLayout, imageView);
int i16 = R$id.eis;
((XYTextView) findViewById(i16)).setTypeface(o.a("BEBAS.ttf", getContext()));
((XYTextView) findViewById(i16)).setText(String.valueOf(redPacketPurchaseResultBean.e().getTotalCoins()));
Animator animator = this.R;
if (animator == null) {
dp.h hVar = dp.h.f69499a;
LinearLayout linearLayout2 = (LinearLayout) findViewById(i15);
Intrinsics.checkNotNullExpressionValue(linearLayout2, "redPocketAmountLayout");
AlphaRedPacketProgressBar alphaRedPacketProgressBar = (AlphaRedPacketProgressBar) findViewById(i10);
Intrinsics.checkNotNullExpressionValue(alphaRedPacketProgressBar, "redPocketProgressBar");
this.R = hVar.i(linearLayout2, alphaRedPacketProgressBar);
} else if (animator != null) {
animator.cancel();
}
Animator animator2 = this.R;
if (animator2 != null) {
animator2.start();
}
((AlphaRedPacketProgressBar) findViewById(i10)).setTotalSecond(this.L);
((AlphaRedPacketProgressBar) findViewById(i10)).setOnClickListener(new n(this, redPacketPurchaseResultBean));
if (redPacketPurchaseResultBean.e().getStatus() == 2 && redPacketPurchaseResultBean.f() == 3) {
N1(redPacketPurchaseResultBean.e().getId(), false);
}
}
public final void M1(String str) {
Intrinsics.checkNotNullParameter(str, "emceeId");
this.f42629t = str;
Pair<Long, Long> p14 = dp.z.f69524a.p(null);
Long second = p14.getSecond();
int longValue = second != null ? (int) second.longValue() : 0;
Long first = p14.getFirst();
S1(longValue, first != null ? first.longValue() : 0);
show();
}
public final void N1(long j14, boolean z14) {
Long l14;
if (((RelativeLayout) findViewById(R$id.esx)) != null && (l14 = this.f42633x) != null && j14 == l14.longValue()) {
((AlphaRedPacketProgressBar) findViewById(R$id.eiv)).i(z14);
}
}
public final void P1(long j14, String str) {
Intrinsics.checkNotNullParameter(str, "emceeId");
this.f42634y = Long.valueOf(j14);
this.f42629t = str;
show();
}
public final void R0(boolean z14, LinearLayout linearLayout, ImageView imageView) {
if (z14) {
linearLayout.removeView(imageView);
Resources system = Resources.getSystem();
Intrinsics.checkExpressionValueIsNotNull(system, "Resources.getSystem()");
bj2.l.k(imageView, (int) TypedValue.applyDimension(1, (float) 0, system.getDisplayMetrics()));
Resources system2 = Resources.getSystem();
Intrinsics.checkExpressionValueIsNotNull(system2, "Resources.getSystem()");
bj2.l.j(imageView, (int) TypedValue.applyDimension(1, (float) 8, system2.getDisplayMetrics()));
linearLayout.addView(imageView, 0);
} else if (!Intrinsics.areEqual(((LinearLayout) findViewById(R$id.eiu)).getChildAt(1), imageView)) {
linearLayout.removeView(imageView);
Resources system3 = Resources.getSystem();
Intrinsics.checkExpressionValueIsNotNull(system3, "Resources.getSystem()");
bj2.l.k(imageView, (int) TypedValue.applyDimension(1, (float) 8, system3.getDisplayMetrics()));
Resources system4 = Resources.getSystem();
Intrinsics.checkExpressionValueIsNotNull(system4, "Resources.getSystem()");
bj2.l.j(imageView, (int) TypedValue.applyDimension(1, (float) 0, system4.getDisplayMetrics()));
linearLayout.addView(imageView, 1);
}
}
public final AlphaRedPacketAmountAdapter S0() {
return (AlphaRedPacketAmountAdapter) this.N.getValue();
}
public final void S1(int i10, long j14) {
Long l14;
RedPacketDescBean q14 = dp.z.f69524a.q();
boolean z14 = false;
if (q14 != null && j14 == q14.getId()) {
z14 = true;
}
if (z14) {
this.f42632w = i10;
}
if (((RelativeLayout) findViewById(R$id.esx)) != null && (l14 = this.f42633x) != null && j14 == l14.longValue()) {
((AlphaRedPacketProgressBar) findViewById(R$id.eiv)).setSecond(i10);
}
}
public final String T0() {
return this.f42629t;
}
public final void U0(int i10, Function2<? super Boolean, ? super CoinBean, Unit> function2) {
if (i10 != 2) {
function2.invoke(Boolean.TRUE, null);
return;
}
a0<CoinBean> u14 = cl.a.f12786a.d().getMyCoin().B(mi2.a.P()).u(gw2.a.a());
Intrinsics.checkNotNullExpressionValue(u14, "AlphaApiManager\n …dSchedulers.mainThread())");
com.uber.autodispose.a0 a0Var = com.uber.autodispose.a0.D;
Intrinsics.checkNotNullExpressionValue(a0Var, "UNBOUND");
Object d14 = u14.d(com.uber.autodispose.d.b(a0Var));
Intrinsics.checkExpressionValueIsNotNull(d14, "this.`as`(AutoDispose.autoDisposable(provider))");
((b0) d14).a(new dp.j(function2), new dp.k(function2));
}
public final void Z0() {
AlphaRedPacketProgressBar alphaRedPacketProgressBar;
if (((RelativeLayout) findViewById(R$id.esx)) == null) {
l1();
}
if (!(this.f42632w == -1 || (alphaRedPacketProgressBar = (AlphaRedPacketProgressBar) findViewById(R$id.eiv)) == null)) {
alphaRedPacketProgressBar.setSecond(this.f42632w);
}
Long l14 = this.f42634y;
hw2.c cVar = null;
if (l14 == null) {
dp.z zVar = dp.z.f69524a;
RedPacketDescBean q14 = zVar.q();
Long valueOf = q14 != null ? Long.valueOf(q14.getId()) : null;
if (valueOf == null) {
RedPacketDescBean r14 = zVar.r();
l14 = r14 != null ? Long.valueOf(r14.getId()) : null;
} else {
l14 = valueOf;
}
}
this.f42634y = null;
if (l14 != null) {
long longValue = l14.longValue();
D(true);
this.f42633x = Long.valueOf(longValue);
r W0 = AlphaGiftService.a.b(cl.a.f12786a.p(), longValue, null, 2, null).x1(mi2.a.P()).W0(gw2.a.a());
Intrinsics.checkNotNullExpressionValue(W0, "AlphaApiManager\n …dSchedulers.mainThread())");
Object n14 = W0.n(com.uber.autodispose.d.b(this));
Intrinsics.checkExpressionValueIsNotNull(n14, "this.`as`(AutoDispose.autoDisposable(provider))");
cVar = ((y) n14).a(new q(this), new dp.s(this));
}
if (cVar == null) {
dismiss();
}
}
@Override // com.xingin.alpha.base.AlphaBaseCustomDialog
public void dismiss() {
super.dismiss();
f1();
D(false);
this.f42634y = null;
Animation animation = this.P;
if (animation != null) {
animation.cancel();
}
Animator animator = this.Q;
if (animator != null) {
animator.cancel();
}
Animator animator2 = this.R;
if (animator2 != null) {
animator2.cancel();
}
Animator animator3 = this.S;
if (animator3 != null) {
animator3.cancel();
}
Animator animator4 = this.T;
if (animator4 != null) {
animator4.cancel();
}
Animator animator5 = this.U;
if (animator5 != null) {
animator5.cancel();
}
Animator animator6 = this.V;
if (animator6 != null) {
animator6.cancel();
}
Animator animator7 = this.W;
if (animator7 != null) {
animator7.cancel();
}
Animator animator8 = this.X;
if (animator8 != null) {
animator8.cancel();
}
}
public final void f1() {
h1();
g1();
bj2.l.b((FrameLayout) findViewById(R$id.f39729avatarFrameLayout));
bj2.l.b((TextView) findViewById(R$id.eiw));
}
public final void g1() {
LinearLayout linearLayout = (LinearLayout) findViewById(R$id.esu);
if (linearLayout != null) {
bj2.l.b(linearLayout);
}
Button button = (Button) findViewById(R$id.f39904sendToEmceeBtn);
if (button != null) {
bj2.l.b(button);
}
}
public final void h1() {
RelativeLayout relativeLayout = (RelativeLayout) findViewById(R$id.esx);
if (relativeLayout != null) {
bj2.l.b(relativeLayout);
}
AlphaRedPacketProgressBar alphaRedPacketProgressBar = (AlphaRedPacketProgressBar) findViewById(R$id.eiv);
if (alphaRedPacketProgressBar != null) {
alphaRedPacketProgressBar.f();
}
}
@Override // vn.a
public void h2(Throwable th3) {
Unit unit;
String message;
Intrinsics.checkNotNullParameter(th3, AdvanceSetting.NETWORK_TYPE);
IllegalStateException illegalStateException = th3 instanceof IllegalStateException ? (IllegalStateException) th3 : null;
if (illegalStateException == null || (message = illegalStateException.getMessage()) == null) {
unit = null;
} else {
f0.d(f0.f131631a, message, 0, 2, null);
unit = Unit.INSTANCE;
}
if (unit == null) {
f0.c(f0.f131631a, R$string.s_, 0, 2, null);
}
this.C = false;
this.f42628J = false;
}
@Override // vn.a
public void i1(FollowBean followBean) {
Object obj;
Intrinsics.checkNotNullParameter(followBean, "followBean");
f0.c(f0.f131631a, R$string.a0b, 0, 2, null);
if (this.f42628J) {
B1(false);
}
String str = this.f42635z;
if (str != null) {
ej2.a aVar = ej2.a.f72257b;
if (followBean.isSpam()) {
obj = new x(str, true);
} else {
obj = new p000do.f(str, true);
}
aVar.a(obj);
}
}
public final void j1(RedPacketPurchaseResultBean redPacketPurchaseResultBean) {
RedPacketDescBean e14 = redPacketPurchaseResultBean.e();
this.A = Long.valueOf(e14.getRoomId());
this.f42635z = e14.getSender().getUserId();
this.L = e14.getTotalSecond();
int i10 = R$id.avatarView;
((XYImageView) findViewById(i10)).o(e14.getSender().getAvatar(), g0.f72750a.p());
((XYImageView) findViewById(i10)).setOnClickListener(new dp.o(e14));
int i14 = R$id.f39729avatarFrameLayout;
bj2.l.q((FrameLayout) findViewById(i14));
bj2.l.r((TextView) findViewById(R$id.bae), A1(), new d(e14));
bj2.l.r((TextView) findViewById(R$id.followBtn), A1(), new e(this, redPacketPurchaseResultBean));
int i15 = R$id.eiw;
boolean z14 = true;
((TextView) findViewById(i15)).setText(getContext().getString(R$string.amg, h1.f131650a.f(e14.getSender().getNickname(), 13)));
bj2.l.q((TextView) findViewById(i15));
Animator animator = this.T;
if (animator == null) {
dp.h hVar = dp.h.f69499a;
FrameLayout frameLayout = (FrameLayout) findViewById(i14);
Intrinsics.checkNotNullExpressionValue(frameLayout, "avatarFrameLayout");
TextView textView = (TextView) findViewById(i15);
Intrinsics.checkNotNullExpressionValue(textView, "redPocketSender");
this.T = hVar.h(frameLayout, textView);
} else if (animator != null) {
animator.cancel();
}
Animator animator2 = this.T;
if (animator2 != null) {
animator2.start();
}
this.B = redPacketPurchaseResultBean.e().getStatus() == 3;
if (redPacketPurchaseResultBean.e().getStatus() == 1 || redPacketPurchaseResultBean.f() == 3) {
if (this.M.isAudience()) {
fy.b.f78513a.o0(String.valueOf(this.A), this.f42629t, redPacketPurchaseResultBean.e().getTotalCoins(), redPacketPurchaseResultBean.e().getStatus() != 1, redPacketPurchaseResultBean.e().getCondition());
} else {
fy.d dVar = fy.d.f78950a;
String valueOf = String.valueOf(this.A);
String str = this.f42629t;
int totalCoins = redPacketPurchaseResultBean.e().getTotalCoins();
if (redPacketPurchaseResultBean.e().getStatus() == 1) {
z14 = false;
}
dVar.O(valueOf, str, totalCoins, z14);
}
K1(redPacketPurchaseResultBean);
} else {
G1(redPacketPurchaseResultBean);
}
if (com.xingin.utils.core.c.t()) {
int i16 = R$id.eii;
bj2.l.q((TextView) findViewById(i16));
((TextView) findViewById(i16)).setText(String.valueOf(redPacketPurchaseResultBean.e().getId()));
int i17 = R$id.eid;
bj2.l.q((TextView) findViewById(i17));
((TextView) findViewById(i17)).setText(String.valueOf(redPacketPurchaseResultBean.e().getCondition()));
}
}
public final void l1() {
((ViewStub) findViewById(R$id.ghr)).inflate();
}
public final void n1() {
int i10 = R$id.eij;
((RecyclerView) findViewById(i10)).setAdapter(S0());
((RecyclerView) findViewById(i10)).setLayoutManager(new LinearLayoutManager(getContext()));
}
@Override // com.xingin.alpha.base.AlphaBaseCustomDialog
public void onAttachedToWindow() {
super.onAttachedToWindow();
vn.f fVar = this.O;
Context context = getContext();
Intrinsics.checkNotNullExpressionValue(context, "context");
fVar.i0(this, context);
}
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
this.O.onDetach();
}
@Override // com.xingin.alpha.base.AlphaBaseCustomDialog
public void onStart() {
super.onStart();
Z0();
}
public final boolean u1(RedPacketDescBean redPacketDescBean) {
return Intrinsics.areEqual(redPacketDescBean.getSender().getFstatus(), "follows") || Intrinsics.areEqual(redPacketDescBean.getSender().getFstatus(), "both");
}
@Override // vn.a
public void w4(Throwable th3) {
a.C2340a.a(this, th3);
}
public final void x1(RedPacketPurchaseResultBean redPacketPurchaseResultBean) {
if (!A1() || redPacketPurchaseResultBean.e().getCondition() != 2 || this.K) {
if (this.M.isAudience()) {
fy.b.f78513a.r0(String.valueOf(this.A), this.f42629t, redPacketPurchaseResultBean.e().getTotalCoins());
} else {
fy.d.f78950a.P(String.valueOf(this.A), this.f42629t, redPacketPurchaseResultBean.e().getTotalCoins());
}
Animator animator = this.S;
if (animator == null) {
dp.h hVar = dp.h.f69499a;
AlphaRedPacketProgressBar alphaRedPacketProgressBar = (AlphaRedPacketProgressBar) findViewById(R$id.eiv);
Intrinsics.checkNotNullExpressionValue(alphaRedPacketProgressBar, "redPocketProgressBar");
this.S = hVar.d(alphaRedPacketProgressBar);
} else if (animator != null) {
animator.cancel();
}
Animator animator2 = this.S;
if (animator2 != null) {
animator2.start();
}
AlphaGiftService p14 = cl.a.f12786a.p();
Long l14 = this.f42633x;
Intrinsics.checkNotNull(l14);
r W0 = AlphaGiftService.a.d(p14, l14.longValue(), null, null, 6, null).x1(mi2.a.P()).W0(gw2.a.a());
Intrinsics.checkNotNullExpressionValue(W0, "AlphaApiManager.giftServ…dSchedulers.mainThread())");
Object n14 = W0.n(com.uber.autodispose.d.b(this));
Intrinsics.checkExpressionValueIsNotNull(n14, "this.`as`(AutoDispose.autoDisposable(provider))");
((y) n14).a(new dp.t(this, redPacketPurchaseResultBean), new dp.r(this));
return;
}
f0.c(f0.f131631a, R$string.f40815alpha_red_packet_condition_follow_tips, 0, 2, null);
}
}