得物.apk(点击下载) / MyOwnEditorEmotionCallBack.java
package com.shizhuang.duapp.modules.product_detail.own.callback;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentViewModelLazyKt;
import androidx.recyclerview.widget.RecyclerView;
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.component.module.NormalModuleAdapter;
import com.shizhuang.duapp.common.extension.ViewExtensionKt;
import com.shizhuang.duapp.common.helper.net.facade.IViewHandler;
import com.shizhuang.duapp.framework.util.ui.KeyBordStateUtil;
import com.shizhuang.duapp.libs.duimageloaderview.DuImageLoaderView;
import com.shizhuang.duapp.modules.du_mall_common.constant.MallABTest;
import com.shizhuang.duapp.modules.du_mall_common.dialog.MallCommonDialog;
import com.shizhuang.duapp.modules.du_mall_common.dialog.model.MallDialogBasicModel;
import com.shizhuang.duapp.modules.du_mall_common.dialog.model.MallDialogType;
import com.shizhuang.duapp.modules.du_mall_common.extension.LifecycleExtensionKt;
import com.shizhuang.duapp.modules.du_mall_common.extension.LiveDataExtensionKt;
import com.shizhuang.duapp.modules.du_mall_common.utils.page.FragmentViewCallback;
import com.shizhuang.duapp.modules.product_detail.api.ProductFacadeV2;
import com.shizhuang.duapp.modules.product_detail.own.model.MyOwnSkuCardItemModel;
import com.shizhuang.duapp.modules.product_detail.own.model.MyOwnSkuListItemModel;
import com.shizhuang.duapp.modules.product_detail.own.ui.MyOwnSkuCardFragment;
import com.shizhuang.duapp.modules.product_detail.own.views.MyOwnSkuCardItemViewNew;
import com.shizhuang.duapp.modules.product_detail.own.vm.MyOwnViewModel;
import com.shizhuang.duapp.modules.product_detail.own.widget.InterceptConstraintLayout;
import com.shizhuang.duapp.modules.product_detail.own.widget.MyOwnEditorMessageEditText;
import com.shizhuang.duapp.modules.product_detail.own.widget.NoScrollLinearLayoutManager;
import com.shizhuang.duapp.modules.product_detail.own.widget.SlowFlingRecyclerView;
import df.u0;
import fi.c;
import java.util.HashMap;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.LazyThreadSafetyMode;
import kotlin.Metadata;
import kotlin.TuplesKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Reflection;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import rd.l;
import td.j;
import td.s;
@Metadata(bv = {}, d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lcom/shizhuang/duapp/modules/product_detail/own/callback/MyOwnEditorEmotionCallBack;", "Lcom/shizhuang/duapp/modules/du_mall_common/utils/page/FragmentViewCallback;", "du_product_detail_release"}, k = 1, mv = {1, 4, 2})
/* compiled from: MyOwnEditorEmotionCallBack.kt */
public final class MyOwnEditorEmotionCallBack extends FragmentViewCallback {
public static ChangeQuickRedirect changeQuickRedirect;
public final boolean d = MallABTest.f13351a.I();
public final Lazy e;
public NoScrollLinearLayoutManager f;
/* renamed from: g reason: collision with root package name */
public int f22813g;
/* renamed from: h reason: collision with root package name */
public MyOwnSkuCardItemModel f22814h;
public MyOwnSkuListItemModel i;
public boolean j;
public final Lazy k;
public final MyOwnEditorEmotionCallBack$onBackPressedCallback$1 l;
public final MyOwnSkuCardFragment m;
public final NormalModuleAdapter n;
public final boolean o;
public HashMap p;
/* compiled from: MyOwnEditorEmotionCallBack.kt */
public static final class a extends s<Boolean> {
public static ChangeQuickRedirect changeQuickRedirect;
public final /* synthetic */ MyOwnEditorEmotionCallBack b;
/* renamed from: c reason: collision with root package name */
public final /* synthetic */ boolean f22815c;
public final /* synthetic */ String d;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public a(MyOwnEditorEmotionCallBack myOwnEditorEmotionCallBack, boolean z, String str, Fragment fragment) {
super(fragment);
this.b = myOwnEditorEmotionCallBack;
this.f22815c = z;
this.d = str;
}
@Override // com.shizhuang.duapp.common.helper.net.facade.IViewHandler, td.s, td.a
public void onBzError(@Nullable l<Boolean> lVar) {
if (!PatchProxy.proxy(new Object[]{lVar}, this, changeQuickRedirect, false, 280040, new Class[]{l.class}, Void.TYPE).isSupported) {
super.onBzError(lVar);
}
}
@Override // com.shizhuang.duapp.common.helper.net.facade.IViewHandler, td.a
public void onSuccess(Object obj) {
MyOwnSkuListItemModel myOwnSkuListItemModel;
MyOwnSkuCardItemModel myOwnSkuCardItemModel;
Boolean bool = (Boolean) obj;
if (!PatchProxy.proxy(new Object[]{bool}, this, changeQuickRedirect, false, 280039, new Class[]{Boolean.class}, Void.TYPE).isSupported) {
super.onSuccess(bool);
MyOwnEditorEmotionCallBack myOwnEditorEmotionCallBack = this.b;
boolean z = this.f22815c;
String str = this.d;
if (!PatchProxy.proxy(new Object[]{new Byte(z ? (byte) 1 : 0), str}, myOwnEditorEmotionCallBack, MyOwnEditorEmotionCallBack.changeQuickRedirect, false, 280024, new Class[]{Boolean.TYPE, String.class}, Void.TYPE).isSupported && (myOwnSkuListItemModel = myOwnEditorEmotionCallBack.i) != null && (myOwnSkuCardItemModel = myOwnEditorEmotionCallBack.f22814h) != null && myOwnEditorEmotionCallBack.f22813g >= 0) {
if (z) {
myOwnSkuListItemModel.setSelectEmotionStatus(0);
myOwnSkuListItemModel.setSelectEmotion("");
} else {
myOwnSkuListItemModel.setSelectEmotionStatus(1);
myOwnSkuListItemModel.setSelectEmotion(str);
}
myOwnEditorEmotionCallBack.r(myOwnSkuListItemModel);
myOwnEditorEmotionCallBack.m.s(myOwnSkuCardItemModel);
myOwnEditorEmotionCallBack.i();
myOwnEditorEmotionCallBack.l.setEnabled(false);
myOwnEditorEmotionCallBack.n.notifyItemChanged(myOwnEditorEmotionCallBack.f22813g, "");
}
}
}
}
public MyOwnEditorEmotionCallBack(@NotNull MyOwnSkuCardFragment myOwnSkuCardFragment, @NotNull NormalModuleAdapter normalModuleAdapter, boolean z) {
super(myOwnSkuCardFragment, true);
this.m = myOwnSkuCardFragment;
this.n = normalModuleAdapter;
this.o = z;
Fragment fragment = this.f13642c;
this.e = FragmentViewModelLazyKt.createViewModelLazy(fragment, Reflection.getOrCreateKotlinClass(MyOwnViewModel.class), new MyOwnEditorEmotionCallBack$$special$$inlined$activityViewModels$1(fragment), new MyOwnEditorEmotionCallBack$$special$$inlined$activityViewModels$2(fragment));
this.f22813g = -1;
this.k = LazyKt__LazyJVMKt.lazy(LazyThreadSafetyMode.NONE, (Function0) new MyOwnEditorEmotionCallBack$keyBordStateUtil$2(this));
this.l = new MyOwnEditorEmotionCallBack$onBackPressedCallback$1(this, false);
}
@Override // com.shizhuang.duapp.modules.du_mall_common.utils.page.FragmentViewCallback
public void e() {
if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 280026, new Class[0], Void.TYPE).isSupported) {
k().c();
super.e();
}
}
public View h(int i3) {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 280027, new Class[]{Integer.TYPE}, View.class);
if (proxy.isSupported) {
return (View) proxy.result;
}
if (this.p == null) {
this.p = new HashMap();
}
View view = (View) this.p.get(Integer.valueOf(i3));
if (view != null) {
return view;
}
View containerView = getContainerView();
if (containerView == null) {
return null;
}
View findViewById = containerView.findViewById(i3);
this.p.put(Integer.valueOf(i3), findViewById);
return findViewById;
}
public final void i() {
MyOwnSkuListItemModel myOwnSkuListItemModel;
if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 280022, new Class[0], Void.TYPE).isSupported && this.f22813g >= 0 && (myOwnSkuListItemModel = this.i) != null) {
if (myOwnSkuListItemModel != null) {
myOwnSkuListItemModel.setInputMessage("");
}
MyOwnSkuListItemModel myOwnSkuListItemModel2 = this.i;
if (myOwnSkuListItemModel2 != null) {
myOwnSkuListItemModel2.setOpenSoftKeyBoard(false);
}
}
}
@Override // com.shizhuang.duapp.modules.du_mall_common.utils.page.PageViewCallback, com.shizhuang.duapp.modules.du_mall_common.utils.page.IPageViewCallback
public void initData() {
if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 280012, new Class[0], Void.TYPE).isSupported) {
super.initData();
if (this.d) {
RecyclerView.LayoutManager layoutManager = ((SlowFlingRecyclerView) h(R.id.rvDetail)).getLayoutManager();
if (!(layoutManager instanceof NoScrollLinearLayoutManager)) {
layoutManager = null;
}
this.f = (NoScrollLinearLayoutManager) layoutManager;
LiveDataExtensionKt.b(l().a(), this.f13642c, new MyOwnEditorEmotionCallBack$initData$1(this));
if (this.o) {
LifecycleExtensionKt.l(this, 200, new MyOwnEditorEmotionCallBack$initData$2(this));
}
}
}
}
@Override // com.shizhuang.duapp.modules.du_mall_common.utils.page.PageViewCallback, com.shizhuang.duapp.modules.du_mall_common.utils.page.IPageViewCallback
public void initView(@Nullable Bundle bundle) {
if (!PatchProxy.proxy(new Object[]{bundle}, this, changeQuickRedirect, false, 280011, new Class[]{Bundle.class}, Void.TYPE).isSupported) {
super.initView(bundle);
((LinearLayout) h(R.id.editIconParent)).setVisibility(this.d ? 0 : 8);
((InterceptConstraintLayout) h(R.id.content)).setInterceptEvent(this.d);
if (this.d && !PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 280014, new Class[0], Void.TYPE).isSupported) {
((InterceptConstraintLayout) h(R.id.content)).setMListener(new MyOwnEditorEmotionCallBack$initEditorView$1(this));
((DuImageLoaderView) h(R.id.editIcon)).i("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/product_detail/icon_edit_white.png").x();
ViewExtensionKt.h((LinearLayout) h(R.id.editIconParent), new MyOwnEditorEmotionCallBack$initEditorView$2(this));
k().a(new k21.a(this));
f().getOnBackPressedDispatcher().addCallback(c(), this.l);
}
}
}
public final String j() {
MyOwnSkuListItemModel myOwnSkuListItemModel;
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 280021, new Class[0], String.class);
if (proxy.isSupported) {
return (String) proxy.result;
}
if (this.f22813g < 0 || (myOwnSkuListItemModel = this.i) == null) {
return "";
}
String inputMessage = myOwnSkuListItemModel != null ? myOwnSkuListItemModel.getInputMessage() : null;
if (inputMessage != null) {
return inputMessage;
}
return "";
}
public final KeyBordStateUtil k() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 280010, new Class[0], KeyBordStateUtil.class);
return (KeyBordStateUtil) (proxy.isSupported ? proxy.result : this.k.getValue());
}
public final MyOwnViewModel l() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 280009, new Class[0], MyOwnViewModel.class);
return (MyOwnViewModel) (proxy.isSupported ? proxy.result : this.e.getValue());
}
public final boolean m() {
MyOwnSkuListItemModel myOwnSkuListItemModel;
String inputMessage;
boolean z = false;
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 280020, new Class[0], Boolean.TYPE);
if (proxy.isSupported) {
return ((Boolean) proxy.result).booleanValue();
}
if (this.f22813g < 0 || (myOwnSkuListItemModel = this.i) == null) {
return false;
}
if (myOwnSkuListItemModel.isVerifySuccess() && (inputMessage = myOwnSkuListItemModel.getInputMessage()) != null) {
if ((inputMessage.length() == 0) && !myOwnSkuListItemModel.isShowVerifyText()) {
return true;
}
}
String inputMessage2 = myOwnSkuListItemModel.getInputMessage();
if (inputMessage2 == null || inputMessage2.length() == 0) {
z = true;
}
return !z;
}
public final void n() {
int i3;
NoScrollLinearLayoutManager noScrollLinearLayoutManager;
View findViewByPosition;
if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 280016, new Class[0], Void.TYPE).isSupported && (i3 = this.f22813g) >= 0 && this.i != null && (noScrollLinearLayoutManager = this.f) != null && (findViewByPosition = noScrollLinearLayoutManager.findViewByPosition(i3)) != null && (findViewByPosition instanceof MyOwnSkuCardItemViewNew)) {
MyOwnSkuCardItemViewNew myOwnSkuCardItemViewNew = (MyOwnSkuCardItemViewNew) findViewByPosition;
if (!PatchProxy.proxy(new Object[0], myOwnSkuCardItemViewNew, MyOwnSkuCardItemViewNew.changeQuickRedirect, false, 280812, new Class[0], Void.TYPE).isSupported) {
c.c((MyOwnEditorMessageEditText) myOwnSkuCardItemViewNew._$_findCachedViewById(R.id.messageEdInput), myOwnSkuCardItemViewNew.getContext());
}
}
}
public final void o() {
MyOwnSkuListItemModel myOwnSkuListItemModel;
boolean z = false;
if (PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 280017, new Class[0], Void.TYPE).isSupported || this.f22813g < 0 || (myOwnSkuListItemModel = this.i) == null) {
return;
}
if (myOwnSkuListItemModel == null || !myOwnSkuListItemModel.isVerifyIng()) {
MyOwnSkuListItemModel myOwnSkuListItemModel2 = this.i;
if (myOwnSkuListItemModel2 != null) {
myOwnSkuListItemModel2.setOpenSoftKeyBoard(true);
}
MyOwnSkuListItemModel myOwnSkuListItemModel3 = this.i;
if (myOwnSkuListItemModel3 != null) {
String inputMessage = myOwnSkuListItemModel3 != null ? myOwnSkuListItemModel3.getInputMessage() : null;
if (inputMessage == null) {
inputMessage = "";
}
if (inputMessage.length() == 0) {
z = true;
}
myOwnSkuListItemModel3.setShowTipsParent(z);
}
this.n.notifyItemChanged(this.f22813g, "");
return;
}
u0.d(g(), "内容正在审核中,不可修改");
}
/* JADX DEBUG: Multi-variable search result rejected for r33v0, resolved type: boolean */
/* JADX WARN: Multi-variable type inference failed */
public final void p(long j12, String str, String str2, boolean z) {
Object[] objArr = {new Long(j12), str, str2, new Byte(z ? (byte) 1 : 0)};
ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
Class cls = Long.TYPE;
Class cls2 = Boolean.TYPE;
if (!PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 280023, new Class[]{cls, String.class, String.class, cls2}, Void.TYPE).isSupported) {
ProductFacadeV2 productFacadeV2 = ProductFacadeV2.f21736a;
a aVar = new a(this, z, str, this.f13642c);
if (!PatchProxy.proxy(new Object[]{new Long(j12), str, str2, new Byte((byte) z), aVar}, productFacadeV2, ProductFacadeV2.changeQuickRedirect, false, 258736, new Class[]{cls, String.class, String.class, cls2, IViewHandler.class}, Void.TYPE).isSupported) {
j.doRequest(productFacadeV2.G().editEmotion(cd.c.b(TuplesKt.to("skuId", Long.valueOf(j12)), TuplesKt.to("emotion", str), TuplesKt.to("subOrderNo", str2), TuplesKt.to("clearFlag", Boolean.valueOf(z)))), aVar, Boolean.class);
}
}
}
public final void q(boolean z) {
boolean z4 = true;
if (!PatchProxy.proxy(new Object[]{new Byte(z ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 280015, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) {
if (!(j().length() == 0) || !z) {
z4 = false;
}
String str = z4 ? "你编辑的心情已清空,是否确认保存?" : "你编辑的心情尚未确认,是否确认提交审核?";
MallCommonDialog.f13387a.b(g(), new MallDialogBasicModel(null, str, 0, null, null, "放弃", new MyOwnEditorEmotionCallBack$showDialog$1(this, z), z4 ? "确认" : "确认提交", null, new MyOwnEditorEmotionCallBack$showDialog$2(this, z, z4), null, null, null, MallDialogType.NORMAL, false, false, null, Float.valueOf(0.75f), 122141, null));
}
}
public final void r(MyOwnSkuListItemModel myOwnSkuListItemModel) {
boolean z = true;
if (!PatchProxy.proxy(new Object[]{myOwnSkuListItemModel}, this, changeQuickRedirect, false, 280025, new Class[]{MyOwnSkuListItemModel.class}, Void.TYPE).isSupported) {
LinearLayout linearLayout = (LinearLayout) h(R.id.editIconParent);
if (myOwnSkuListItemModel == null || myOwnSkuListItemModel.isVerifyIng()) {
z = false;
}
linearLayout.setSelected(z);
}
}
}