得物.apk(点击下载) / ArSpringFestivalHelper.java
package com.shizhuang.duapp.modules.mall_ar.utils;
import a.f;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.util.ArrayMap;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.view.ViewKt;
import androidx.lifecycle.LifecycleEventObserver;
import cd.i;
import com.afollestad.materialdialogs.DialogAction;
import com.afollestad.materialdialogs.MaterialDialog;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.shizhuang.duapp.R;
import com.shizhuang.duapp.common.extension.ViewExtensionKt;
import com.shizhuang.duapp.libs.duimageloaderview.DuImageLoaderView;
import com.shizhuang.duapp.libs.duimageloaderview.options.DuScaleType;
import com.shizhuang.duapp.modules.du_mall_common.utils.LayoutSize;
import com.shizhuang.duapp.modules.mall_ar.api.ProductFacadeV2;
import com.shizhuang.duapp.modules.mall_ar.dialogs.ArTigerPendantDialog;
import com.shizhuang.duapp.modules.mall_ar.model.TigerAvatarPendant;
import com.shizhuang.duapp.modules.router.ServiceManager;
import com.shizhuang.duapp.modules.share.PlatformClickListener;
import com.shizhuang.duapp.modules.share.ShareDialog;
import com.shizhuang.duapp.modules.share.callback.DuShareListener;
import com.shizhuang.duapp.modules.share.constance.SHARE_MEDIA;
import df.q;
import kotlin.Pair;
import kotlin.TuplesKt;
import kotlin.Unit;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.properties.ReadWriteProperty;
import kotlin.reflect.KProperty;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import pb1.g;
import pb1.m;
import td.j;
import td.s;
/* compiled from: ArSpringFestivalHelper.kt */
public final class ArSpringFestivalHelper {
public static ChangeQuickRedirect changeQuickRedirect;
@NotNull
public static final ReadWriteProperty k;
@NotNull
public static final ReadWriteProperty l;
@NotNull
public static final a m = new a(null);
@Nullable
/* renamed from: a reason: collision with root package name */
public Runnable f19157a;
@NotNull
public final Handler b = new Handler(Looper.getMainLooper());
@Nullable
/* renamed from: c reason: collision with root package name */
public String f19158c;
@Nullable
public String d;
@Nullable
public String e;
public boolean f;
@Nullable
/* renamed from: g reason: collision with root package name */
public ViewGroup f19159g;
@Nullable
/* renamed from: h reason: collision with root package name */
public ArTigerPendantDialog f19160h;
public boolean i;
public final LifecycleEventObserver j = new ArSpringFestivalHelper$observer$1(this);
/* compiled from: ArSpringFestivalHelper.kt */
public static final class a {
/* renamed from: a reason: collision with root package name */
public static final /* synthetic */ KProperty[] f19161a = {g.a.o(a.class, "hasShowDialog", "getHasShowDialog()Z", 0), g.a.o(a.class, "hasShared", "getHasShared()Z", 0)};
public static ChangeQuickRedirect changeQuickRedirect;
public a() {
}
public final boolean a() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 208839, new Class[0], Boolean.TYPE);
return ((Boolean) (proxy.isSupported ? proxy.result : ArSpringFestivalHelper.l.getValue(ArSpringFestivalHelper.m, f19161a[1]))).booleanValue();
}
public final boolean b() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 208837, new Class[0], Boolean.TYPE);
return ((Boolean) (proxy.isSupported ? proxy.result : ArSpringFestivalHelper.k.getValue(ArSpringFestivalHelper.m, f19161a[0]))).booleanValue();
}
@JvmStatic
public final boolean c(@NotNull String str) {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 208841, new Class[]{String.class}, Boolean.TYPE);
return proxy.isSupported ? ((Boolean) proxy.result).booleanValue() : Intrinsics.areEqual(str, "newyearevent");
}
public a(DefaultConstructorMarker defaultConstructorMarker) {
}
}
/* compiled from: ArSpringFestivalHelper.kt */
public static final class b extends s<TigerAvatarPendant> {
public static ChangeQuickRedirect changeQuickRedirect;
public final /* synthetic */ Function1 b;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public b(Function1 function1, Context context, Context context2) {
super(context2);
this.b = function1;
}
@Override // com.shizhuang.duapp.common.helper.net.facade.IViewHandler, td.a
public void onSuccess(Object obj) {
TigerAvatarPendant tigerAvatarPendant = (TigerAvatarPendant) obj;
if (!PatchProxy.proxy(new Object[]{tigerAvatarPendant}, this, changeQuickRedirect, false, 208846, new Class[]{TigerAvatarPendant.class}, Void.TYPE).isSupported) {
super.onSuccess(tigerAvatarPendant);
this.b.invoke(tigerAvatarPendant);
}
}
}
/* compiled from: ArSpringFestivalHelper.kt */
public static final class c implements PlatformClickListener {
public static ChangeQuickRedirect changeQuickRedirect;
/* renamed from: a reason: collision with root package name */
public final /* synthetic */ ArSpringFestivalHelper f19162a;
public final /* synthetic */ boolean b;
/* renamed from: c reason: collision with root package name */
public final /* synthetic */ ShareDialog f19163c;
public final /* synthetic */ ArTigerPendantDialog d;
public c(ArSpringFestivalHelper arSpringFestivalHelper, boolean z, ShareDialog shareDialog, ArTigerPendantDialog arTigerPendantDialog) {
this.f19162a = arSpringFestivalHelper;
this.b = z;
this.f19163c = shareDialog;
this.d = arTigerPendantDialog;
}
@Override // com.shizhuang.duapp.modules.share.PlatformClickListener
public final boolean onPlatformClick(int i, @NotNull ShareDialog shareDialog) {
Object[] objArr = {new Integer(i), shareDialog};
ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
Class[] clsArr = {Integer.TYPE, ShareDialog.class};
Class cls = Boolean.TYPE;
PatchProxyResult proxy = PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 208849, clsArr, cls);
if (proxy.isSupported) {
return ((Boolean) proxy.result).booleanValue();
}
if (this.b) {
ArSpringFestivalHelper arSpringFestivalHelper = this.f19162a;
if (!PatchProxy.proxy(new Object[0], arSpringFestivalHelper, ArSpringFestivalHelper.changeQuickRedirect, false, 208826, new Class[0], Void.TYPE).isSupported) {
a aVar = ArSpringFestivalHelper.m;
if (!PatchProxy.proxy(new Object[]{new Byte((byte) 1)}, aVar, a.changeQuickRedirect, false, 208840, new Class[]{cls}, Void.TYPE).isSupported) {
ArSpringFestivalHelper.l.setValue(aVar, a.f19161a[1], Boolean.TRUE);
}
arSpringFestivalHelper.a();
}
}
this.f19163c.dismissAllowingStateLoss();
ArTigerPendantDialog arTigerPendantDialog = this.d;
if (arTigerPendantDialog != null) {
arTigerPendantDialog.dismissAllowingStateLoss();
}
return false;
}
}
/* compiled from: ArSpringFestivalHelper.kt */
public static final class d implements DuShareListener {
public static ChangeQuickRedirect changeQuickRedirect;
/* renamed from: a reason: collision with root package name */
public final /* synthetic */ ArSpringFestivalHelper f19164a;
public final /* synthetic */ boolean b;
/* renamed from: c reason: collision with root package name */
public final /* synthetic */ AppCompatActivity f19165c;
public d(ArSpringFestivalHelper arSpringFestivalHelper, boolean z, AppCompatActivity appCompatActivity) {
this.f19164a = arSpringFestivalHelper;
this.b = z;
this.f19165c = appCompatActivity;
}
@Override // com.shizhuang.duapp.modules.share.callback.DuShareListener
public void onCancel(@NotNull SHARE_MEDIA share_media) {
if (!PatchProxy.proxy(new Object[]{share_media}, this, changeQuickRedirect, false, 208853, new Class[]{SHARE_MEDIA.class}, Void.TYPE).isSupported) {
if (this.b) {
this.f19164a.k(this.f19165c);
} else {
Toast.makeText(g.a(), "分享取消", 0).show();
}
}
}
@Override // com.shizhuang.duapp.modules.share.callback.DuShareListener
public void onError(@NotNull SHARE_MEDIA share_media, @NotNull Throwable th2) {
if (!PatchProxy.proxy(new Object[]{share_media, th2}, this, changeQuickRedirect, false, 208852, new Class[]{SHARE_MEDIA.class, Throwable.class}, Void.TYPE).isSupported) {
if (this.b) {
this.f19164a.k(this.f19165c);
} else {
m.a(th2);
}
}
}
@Override // com.shizhuang.duapp.modules.share.callback.DuShareListener
public void onResult(@NotNull SHARE_MEDIA share_media) {
if (!PatchProxy.proxy(new Object[]{share_media}, this, changeQuickRedirect, false, 208851, new Class[]{SHARE_MEDIA.class}, Void.TYPE).isSupported) {
if (this.b) {
this.f19164a.k(this.f19165c);
} else {
q.k("分享成功");
}
}
}
@Override // com.shizhuang.duapp.modules.share.callback.DuShareListener
public void onStart(@NotNull SHARE_MEDIA share_media) {
boolean z = PatchProxy.proxy(new Object[]{share_media}, this, changeQuickRedirect, false, 208850, new Class[]{SHARE_MEDIA.class}, Void.TYPE).isSupported;
}
}
/* compiled from: ArSpringFestivalHelper.kt */
public static final class e implements MaterialDialog.SingleButtonCallback {
public static final e b = new e();
public static ChangeQuickRedirect changeQuickRedirect;
@Override // com.afollestad.materialdialogs.MaterialDialog.SingleButtonCallback
public final void onClick(@NotNull MaterialDialog materialDialog, @NotNull DialogAction dialogAction) {
if (!PatchProxy.proxy(new Object[]{materialDialog, dialogAction}, this, changeQuickRedirect, false, 208854, new Class[]{MaterialDialog.class, DialogAction.class}, Void.TYPE).isSupported) {
materialDialog.dismiss();
}
}
}
static {
String j12 = androidx.appcompat.widget.a.j(f.h("ar_has_showDialog"));
Boolean bool = Boolean.FALSE;
k = i.a(j12, bool, null);
StringBuilder h12 = f.h("ar_hasShared");
h12.append(ServiceManager.d().getUserId());
l = i.a(h12.toString(), bool, null);
}
public final void a() {
if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 208822, new Class[0], Void.TYPE).isSupported && this.f) {
ViewGroup viewGroup = this.f19159g;
View view = null;
TextView textView = viewGroup != null ? (TextView) viewGroup.findViewById(R.id.ar_tips_tv) : null;
ViewGroup viewGroup2 = this.f19159g;
View findViewById = viewGroup2 != null ? viewGroup2.findViewById(R.id.ar_share_tips) : null;
ViewGroup viewGroup3 = this.f19159g;
if (viewGroup3 != null) {
view = viewGroup3.findViewById(R.id.ar_share_Bg);
}
if (view != null) {
ViewKt.setVisible(view, true);
}
ArTigerPendantDialog arTigerPendantDialog = this.f19160h;
if (arTigerPendantDialog == null || !arTigerPendantDialog.f()) {
a aVar = m;
if (!aVar.b()) {
if (textView != null) {
ViewKt.setVisible(textView, true);
}
if (findViewById != null) {
ViewKt.setVisible(findViewById, false);
}
} else if (!aVar.b() || aVar.a()) {
if (textView != null) {
ViewKt.setVisible(textView, false);
}
if (findViewById != null) {
ViewKt.setVisible(findViewById, false);
}
} else {
if (textView != null) {
ViewKt.setVisible(textView, false);
}
if (findViewById != null) {
ViewKt.setVisible(findViewById, true);
}
if (!this.i) {
this.i = true;
h("community_ar_entrance_exposure", "1391", "分享活动 抽好礼");
}
}
} else {
if (textView != null) {
ViewKt.setVisible(textView, false);
}
if (findViewById != null) {
ViewKt.setVisible(findViewById, false);
}
}
if (!ServiceManager.s().isUserLogin()) {
if (textView != null) {
textView.setText("登录可参与抽好礼");
}
if (textView != null) {
ViewKt.setVisible(textView, true);
}
} else if (textView != null) {
textView.setText("试一试 即获好礼");
}
ViewGroup viewGroup4 = this.f19159g;
if (viewGroup4 != null) {
viewGroup4.invalidate();
}
}
}
public final void b() {
if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 208833, new Class[0], Void.TYPE).isSupported) {
this.e = "";
}
}
public final void c() {
if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 208825, new Class[0], Void.TYPE).isSupported) {
ViewGroup viewGroup = this.f19159g;
Context context = viewGroup != null ? viewGroup.getContext() : null;
if ((context instanceof AppCompatActivity) && !m.b()) {
d(context, new ArSpringFestivalHelper$fetchDialog$1(this, context));
}
}
}
public final void d(@Nullable Context context, @NotNull Function1<? super TigerAvatarPendant, Unit> function1) {
if (!PatchProxy.proxy(new Object[]{context, function1}, this, changeQuickRedirect, false, 208831, new Class[]{Context.class, Function1.class}, Void.TYPE).isSupported && context != null) {
ProductFacadeV2 productFacadeV2 = ProductFacadeV2.f18958a;
b bVar = new b(function1, context, context);
if (!PatchProxy.proxy(new Object[]{bVar}, productFacadeV2, ProductFacadeV2.changeQuickRedirect, false, 206355, new Class[]{s.class}, Void.TYPE).isSupported) {
j.doRequest(productFacadeV2.t().getAvatarPendant(), bVar);
}
}
}
public final void e(@NotNull ViewGroup viewGroup, @NotNull View view, @Nullable View view2, @NotNull String str, @NotNull Function0<Unit> function0) {
int i3;
ViewGroup viewGroup2;
ViewGroup viewGroup3;
ViewGroup viewGroup4;
if (!PatchProxy.proxy(new Object[]{viewGroup, view, view2, str, function0}, this, changeQuickRedirect, false, 208814, new Class[]{ViewGroup.class, View.class, View.class, String.class, Function0.class}, Void.TYPE).isSupported) {
this.f19159g = viewGroup;
this.d = str;
if (!PatchProxy.proxy(new Object[]{viewGroup}, this, changeQuickRedirect, false, 208816, new Class[]{ViewGroup.class}, Void.TYPE).isSupported) {
Context context = viewGroup.getContext();
if (!(context instanceof AppCompatActivity)) {
context = null;
}
AppCompatActivity appCompatActivity = (AppCompatActivity) context;
if (appCompatActivity != null) {
appCompatActivity.getLifecycle().addObserver(this.j);
}
}
if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 208815, new Class[0], Void.TYPE).isSupported) {
a aVar = m;
if (aVar.b() && !aVar.a()) {
ViewGroup viewGroup5 = this.f19159g;
d(viewGroup5 != null ? viewGroup5.getContext() : null, new ArSpringFestivalHelper$initShareData$1(this));
}
}
int indexOfChild = viewGroup.indexOfChild(view) + 1;
Object[] objArr = {new Integer(indexOfChild)};
ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
Class cls = Integer.TYPE;
if (!PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 208818, new Class[]{cls}, Void.TYPE).isSupported && (viewGroup4 = this.f19159g) != null) {
DuImageLoaderView duImageLoaderView = new DuImageLoaderView(viewGroup4.getContext());
ConstraintLayout.LayoutParams a5 = new LayoutSize(-1, 400).a(duImageLoaderView);
a5.topToTop = viewGroup4.getId();
duImageLoaderView.setLayoutParams(a5);
duImageLoaderView.setId(R.id.ar_share_Bg);
duImageLoaderView.setVisibility(8);
duImageLoaderView.setDrawableScaleType(DuScaleType.FIT_XY);
duImageLoaderView.i("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/bg_ar_spring.png").x();
viewGroup4.addView(duImageLoaderView, indexOfChild);
}
if (!PatchProxy.proxy(new Object[]{new Integer(indexOfChild)}, this, changeQuickRedirect, false, 208819, new Class[]{cls}, Void.TYPE).isSupported && (viewGroup3 = this.f19159g) != null) {
TextView textView = new TextView(viewGroup3.getContext());
LayoutSize layoutSize = new LayoutSize(-2, 27);
LayoutSize.q(layoutSize, 0, 99, 0, 0, null, 16);
layoutSize.u(19, null);
ConstraintLayout.LayoutParams a12 = layoutSize.a(textView);
a12.topToTop = viewGroup3.getId();
a12.leftToLeft = viewGroup3.getId();
a12.rightToRight = viewGroup3.getId();
textView.setLayoutParams(a12);
textView.setText("试一试 即获好礼");
textView.setGravity(17);
textView.setId(R.id.ar_tips_tv);
textView.setVisibility(8);
textView.setTextColor((int) 4294967295L);
viewGroup3.addView(textView, indexOfChild + 1);
}
if (view2 == null) {
i3 = -1;
} else {
i3 = viewGroup.indexOfChild(view2);
}
if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 208820, new Class[]{cls}, Void.TYPE).isSupported && (viewGroup2 = this.f19159g) != null) {
ImageView imageView = new ImageView(viewGroup2.getContext());
LayoutSize layoutSize2 = new LayoutSize(200, 44);
LayoutSize.q(layoutSize2, 0, 89, 0, 0, null, 16);
ConstraintLayout.LayoutParams a13 = layoutSize2.a(imageView);
a13.topToTop = viewGroup2.getId();
a13.leftToLeft = viewGroup2.getId();
a13.rightToRight = viewGroup2.getId();
imageView.setId(R.id.ar_share_tips);
imageView.setVisibility(8);
imageView.setBackgroundResource(R.drawable.ar_share_tips);
imageView.setLayoutParams(a13);
ViewExtensionKt.j(imageView, 0, new ArSpringFestivalHelper$addShareTips$1(this, imageView), 1);
viewGroup2.addView(imageView, i3);
}
if (!PatchProxy.proxy(new Object[]{function0}, this, changeQuickRedirect, false, 208817, new Class[]{Function0.class}, Void.TYPE).isSupported) {
this.f19157a = new ar0.f(function0);
}
}
}
public final void f() {
Runnable runnable;
if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 208824, new Class[0], Void.TYPE).isSupported && (runnable = this.f19157a) != null) {
this.b.removeCallbacks(runnable);
}
}
public final void g(@NotNull String str, @NotNull String str2, @NotNull String str3) {
if (!PatchProxy.proxy(new Object[]{str, str2, str3}, this, changeQuickRedirect, false, 208834, new Class[]{String.class, String.class, String.class}, Void.TYPE).isSupported) {
i60.b bVar = i60.b.f33293a;
String str4 = this.d;
String str5 = "";
if (str4 == null) {
str4 = str5;
}
ArrayMap arrayMap = new ArrayMap(8);
cd.e.a(arrayMap, TuplesKt.to("block_content_title", str3));
Pair[] pairArr = new Pair[1];
String str6 = this.e;
if (str6 != null) {
str5 = str6;
}
pairArr[0] = TuplesKt.to("spu_id", str5);
cd.e.a(arrayMap, pairArr);
bVar.b(str, str4, str2, arrayMap);
}
}
public final void h(@NotNull String str, @NotNull String str2, @NotNull String str3) {
if (!PatchProxy.proxy(new Object[]{str, str2, str3}, this, changeQuickRedirect, false, 208835, new Class[]{String.class, String.class, String.class}, Void.TYPE).isSupported) {
i60.b bVar = i60.b.f33293a;
String str4 = this.d;
if (str4 == null) {
str4 = "";
}
ArrayMap arrayMap = new ArrayMap(8);
cd.e.a(arrayMap, TuplesKt.to("block_content_title", str3));
bVar.b(str, str4, str2, arrayMap);
}
}
public final void i(@Nullable String str) {
if (!PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 208801, new Class[]{String.class}, Void.TYPE).isSupported) {
this.f19158c = str;
}
}
public final void j(@NotNull AppCompatActivity appCompatActivity, @NotNull String str, boolean z, @Nullable ArTigerPendantDialog arTigerPendantDialog) {
pb1.i iVar;
if (!PatchProxy.proxy(new Object[]{appCompatActivity, str, new Byte(z ? (byte) 1 : 0), arTigerPendantDialog}, this, changeQuickRedirect, false, 208828, new Class[]{AppCompatActivity.class, String.class, Boolean.TYPE, ArTigerPendantDialog.class}, Void.TYPE).isSupported) {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 208829, new Class[]{String.class}, pb1.i.class);
if (proxy.isSupported) {
iVar = (pb1.i) proxy.result;
} else {
pb1.i iVar2 = new pb1.i();
iVar2.G("潮人过春节,来得物AR试穿尖货装备!");
iVar2.C("赢艺术家绘制球鞋/版画");
iVar2.s("潮人过春节,来得物AR试穿潮流装备,赢艺术家绘制球鞋/版画");
iVar2.D("潮人过春节,来得物AR试穿尖货装备! 赢艺术家绘制球鞋/版画 " + str + " " + "(分享自 @得物APP)");
iVar2.F(str);
iVar2.u("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/ar_share_spring_festival.png");
iVar = iVar2;
}
ShareDialog k6 = ShareDialog.k();
k6.x(iVar).w(new c(this, z, k6, arTigerPendantDialog)).y(new d(this, z, appCompatActivity)).F(appCompatActivity);
}
}
public final void k(@NotNull Context context) {
if (!PatchProxy.proxy(new Object[]{context}, this, changeQuickRedirect, false, 208830, new Class[]{Context.class}, Void.TYPE).isSupported) {
MaterialDialog.b bVar = new MaterialDialog.b(context);
bVar.b("你已参与抽奖~\n最终中奖结果将在活动结束后,通过得物App官方社区帐号以及站内信公布,敬请关注!");
bVar.l = "知道了";
bVar.f2882u = e.b;
bVar.l();
}
}
public final void l(long j12) {
if (!PatchProxy.proxy(new Object[]{new Long(j12)}, this, changeQuickRedirect, false, 208823, new Class[]{Long.TYPE}, Void.TYPE).isSupported && this.f19157a != null && ServiceManager.s().isUserLogin()) {
f();
Runnable runnable = this.f19157a;
if (runnable != null) {
this.b.postDelayed(runnable, j12);
}
}
}
public final void m(@Nullable String str) {
if (!PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 208832, new Class[]{String.class}, Void.TYPE).isSupported) {
this.e = str;
a();
}
}
public final void n() {
if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 208821, new Class[0], Void.TYPE).isSupported) {
this.f = true;
}
}
}