package com.shizhuang.duapp.media.editimage.view; import android.animation.ValueAnimator; import android.content.Context; import android.util.ArrayMap; import android.util.AttributeSet; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; import android.view.animation.LinearInterpolator; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.fragment.app.Fragment; import com.meituan.robust.ChangeQuickRedirect; import com.meituan.robust.PatchProxy; import com.meituan.robust.PatchProxyResult; import com.shizhuang.duapp.R; import com.shizhuang.duapp.libs.duimageloaderview.DuImageLoaderView; import com.shizhuang.duapp.media.editimage.ImageTagViewModel; import com.shizhuang.duapp.media.editimage.fragment.ImageEditFragment; import com.shizhuang.duapp.media.editimage.view.BaseTagView; import com.shizhuang.duapp.media.view.TagBackgroundView; import com.shizhuang.duapp.modules.du_community_common.sensor.SensorPublishUtil; import com.shizhuang.duapp.modules.du_community_common.view.MarqueeTextView; import com.shizhuang.duapp.modules.pay.R$styleable; import com.shizhuang.model.trend.TagModel; import java.util.HashMap; import jt.t; import jt.u; import kotlin.Metadata; import kotlin.Unit; import kotlin.jvm.JvmOverloads; import o5.i; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import t20.n; @Metadata(bv = {}, d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\t\u0018\u00002\u00020\u0001J\u0010\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0002J\b\u0010\u0007\u001a\u00020\u0006H\u0016R\"\u0010\u000e\u001a\u00020\u00068\u0006@\u0006X\u000e¢\u0006\u0012\n\u0004\b\b\u0010\t\u001a\u0004\b\n\u0010\u000b\"\u0004\b\f\u0010\r¨\u0006\u000f"}, d2 = {"Lcom/shizhuang/duapp/media/editimage/view/SmartTagViewV2;", "Lcom/shizhuang/duapp/media/editimage/view/BaseTagView;", "", "isUsed", "", "setSmartTagMatTextWidth", "", "getLayoutId", "H", "I", "getApiSource", "()I", "setApiSource", "(I)V", "apiSource", "du_media_release"}, k = 1, mv = {1, 4, 2}) /* compiled from: SmartTagViewV2.kt */ public final class SmartTagViewV2 extends BaseTagView { public static ChangeQuickRedirect changeQuickRedirect; public int H; public GestureDetector I; public ValueAnimator J; public ValueAnimator K; public final boolean L; public HashMap M; /* compiled from: SmartTagViewV2.kt */ public static final class a implements Runnable { public static ChangeQuickRedirect changeQuickRedirect; public final /* synthetic */ SmartTagViewV2 b; /* renamed from: c reason: collision with root package name */ public final /* synthetic */ TagModel f9903c; public a(SmartTagViewV2 smartTagViewV2, TagModel tagModel) { this.b = smartTagViewV2; this.f9903c = tagModel; } public final void run() { if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43669, new Class[0], Void.TYPE).isSupported) { this.b.j(this.f9903c); SmartTagViewV2 smartTagViewV2 = this.b; TagModel tagModel = this.f9903c; smartTagViewV2.k(tagModel.x, tagModel.y); this.b.x(); SmartTagViewV2 smartTagViewV22 = this.b; if (!PatchProxy.proxy(new Object[0], smartTagViewV22, SmartTagViewV2.changeQuickRedirect, false, 43658, new Class[0], Void.TYPE).isSupported) { ViewParent parent = smartTagViewV22.getParent().getParent(); if (!(parent instanceof ViewGroup)) { parent = null; } ViewGroup viewGroup = (ViewGroup) parent; if (viewGroup != null) { if (!PatchProxy.proxy(new Object[0], smartTagViewV22, SmartTagViewV2.changeQuickRedirect, false, 43659, new Class[0], Void.TYPE).isSupported) { if (smartTagViewV22.o()) { ConstraintLayout clTagLeft = smartTagViewV22.getClTagLeft(); if (clTagLeft != null) { clTagLeft.setVisibility(4); } } else { ConstraintLayout clTagRight = smartTagViewV22.getClTagRight(); if (clTagRight != null) { clTagRight.setVisibility(4); } } FrameLayout flBreath = smartTagViewV22.getFlBreath(); if (flBreath != null) { flBreath.setVisibility(4); } } int b2 = fi.b.b(smartTagViewV22.L ? 92.0f : 50.0f); DuImageLoaderView duImageLoaderView = new DuImageLoaderView(smartTagViewV22.getContext()); ((co.c) h.b.h(b2, b2, duImageLoaderView.i(smartTagViewV22.L ? "https://cdn.poizon.com/node-common/12a966f1a2ee0f0612f610453a863108.webp" : "https://cdn.poizon.com/node-common/0902d64b-8e31-fba2-da9f-df8cfec55887.webp"))).S(new t(smartTagViewV22, duImageLoaderView)).T(1).l0(null).c0(null).x(); smartTagViewV22.post(new u(smartTagViewV22, duImageLoaderView, b2, viewGroup)); } } this.b.setVisibility(0); } } } /* compiled from: SmartTagViewV2.kt */ public static final class b extends GestureDetector.SimpleOnGestureListener { public static ChangeQuickRedirect changeQuickRedirect; public final /* synthetic */ SmartTagViewV2 b; /* JADX WARN: Incorrect args count in method signature: ()V */ public b(SmartTagViewV2 smartTagViewV2) { this.b = smartTagViewV2; } public boolean onSingleTapConfirmed(@NotNull MotionEvent motionEvent) { PatchProxyResult proxy = PatchProxy.proxy(new Object[]{motionEvent}, this, changeQuickRedirect, false, 43672, new Class[]{MotionEvent.class}, Boolean.TYPE); if (proxy.isSupported) { return ((Boolean) proxy.result).booleanValue(); } this.b.z(); BaseTagView.Listener listener = this.b.getListener(); if (listener != null) { listener.onTagClick(this.b); } return true; } } /* compiled from: SmartTagViewV2.kt */ public static final class c implements ValueAnimator.AnimatorUpdateListener { public static ChangeQuickRedirect changeQuickRedirect; public final /* synthetic */ SmartTagViewV2 b; public c(SmartTagViewV2 smartTagViewV2) { this.b = smartTagViewV2; } public final void onAnimationUpdate(ValueAnimator valueAnimator) { if (!PatchProxy.proxy(new Object[]{valueAnimator}, this, changeQuickRedirect, false, 43676, new Class[]{ValueAnimator.class}, Void.TYPE).isSupported) { float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue(); ConstraintLayout clChildTagLeft = this.b.getClChildTagLeft(); if (clChildTagLeft != null) { clChildTagLeft.setScaleX(floatValue); } ConstraintLayout clChildTagLeft2 = this.b.getClChildTagLeft(); if (clChildTagLeft2 != null) { clChildTagLeft2.setScaleY(floatValue); } ConstraintLayout clChildTagLeft3 = this.b.getClChildTagLeft(); float f = i.f36333a; if (clChildTagLeft3 != null) { clChildTagLeft3.setPivotX(i.f36333a); } ConstraintLayout clChildTagLeft4 = this.b.getClChildTagLeft(); if (clChildTagLeft4 != null) { ConstraintLayout clChildTagLeft5 = this.b.getClChildTagLeft(); if (clChildTagLeft5 != null) { f = (float) clChildTagLeft5.getHeight(); } clChildTagLeft4.setPivotY(f); } } } } /* compiled from: SmartTagViewV2.kt */ public static final class d implements ValueAnimator.AnimatorUpdateListener { public static ChangeQuickRedirect changeQuickRedirect; public final /* synthetic */ SmartTagViewV2 b; public d(SmartTagViewV2 smartTagViewV2) { this.b = smartTagViewV2; } public final void onAnimationUpdate(ValueAnimator valueAnimator) { if (!PatchProxy.proxy(new Object[]{valueAnimator}, this, changeQuickRedirect, false, 43677, new Class[]{ValueAnimator.class}, Void.TYPE).isSupported) { float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue(); ConstraintLayout clChildTagRight = this.b.getClChildTagRight(); if (clChildTagRight != null) { clChildTagRight.setScaleX(floatValue); } ConstraintLayout clChildTagRight2 = this.b.getClChildTagRight(); if (clChildTagRight2 != null) { clChildTagRight2.setScaleY(floatValue); } ConstraintLayout clChildTagRight3 = this.b.getClChildTagRight(); float f = i.f36333a; if (clChildTagRight3 != null) { clChildTagRight3.setPivotX(i.f36333a); } ConstraintLayout clChildTagRight4 = this.b.getClChildTagRight(); if (clChildTagRight4 != null) { ConstraintLayout clChildTagRight5 = this.b.getClChildTagRight(); if (clChildTagRight5 != null) { f = (float) clChildTagRight5.getHeight(); } clChildTagRight4.setPivotY(f); } } } } /* compiled from: SmartTagViewV2.kt */ public static final class e implements Runnable { public static ChangeQuickRedirect changeQuickRedirect; public final /* synthetic */ SmartTagViewV2 b; /* renamed from: c reason: collision with root package name */ public final /* synthetic */ TagModel f9904c; public e(SmartTagViewV2 smartTagViewV2, TagModel tagModel) { this.b = smartTagViewV2; this.f9904c = tagModel; } public final void run() { if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43678, new Class[0], Void.TYPE).isSupported) { this.b.u(); SmartTagViewV2 smartTagViewV2 = this.b; TagModel tagModel = this.f9904c; smartTagViewV2.k(tagModel.x, tagModel.y); } } } @JvmOverloads public SmartTagViewV2(@NotNull Context context) { this(context, null, false, 6); } @JvmOverloads public SmartTagViewV2(@NotNull Context context, @Nullable AttributeSet attributeSet) { this(context, attributeSet, false, 4); } /* JADX WARNING: Illegal instructions before constructor call */ public SmartTagViewV2(Context context, AttributeSet attributeSet, boolean z, int i) { super(context, attributeSet, 0, 4); attributeSet = (i & 2) != 0 ? null : attributeSet; z = (i & 4) != 0 ? false : z; this.L = z; } private final void setSmartTagMatTextWidth(boolean z) { if (!PatchProxy.proxy(new Object[]{new Byte(z ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 43652, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) { if (z) { setMMinTextWidth(n.a(Integer.valueOf((int) R$styleable.AppCompatTheme_windowFixedHeightMajor))); setMMaxTextWidth(n.a(144)); } else { setMMinTextWidth(n.a(78)); setMMaxTextWidth(n.a(Integer.valueOf((int) R$styleable.AppCompatTheme_textAppearancePopupMenuHeader))); } MarqueeTextView tvNameLeft = getTvNameLeft(); if (tvNameLeft != null) { tvNameLeft.setMaxWidth(getMMaxTextWidth()); } MarqueeTextView tvNameLeft2 = getTvNameLeft(); if (tvNameLeft2 != null) { tvNameLeft2.setMarqueeThreshold(getMMaxTextWidth()); } MarqueeTextView tvNameRight = getTvNameRight(); if (tvNameRight != null) { tvNameRight.setMarqueeThreshold(getMMaxTextWidth()); } MarqueeTextView tvNameRight2 = getTvNameRight(); if (tvNameRight2 != null) { tvNameRight2.setMaxWidth(getMMaxTextWidth()); } } } @Override // com.shizhuang.duapp.media.editimage.view.BaseTagView @NotNull public Runnable a(@NotNull TagModel tagModel) { PatchProxyResult proxy = PatchProxy.proxy(new Object[]{tagModel}, this, changeQuickRedirect, false, 43656, new Class[]{TagModel.class}, Runnable.class); return proxy.isSupported ? (Runnable) proxy.result : new a(this, tagModel); } @Override // com.shizhuang.duapp.media.editimage.view.BaseTagView public void b() { TagModel tagBean; int i = 0; if (PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43663, new Class[0], Void.TYPE).isSupported || (tagBean = getTagBean()) == null) { return; } if (o()) { setEdgeLeft(tagBean.isSmartRecommend ? 0 : getLeftSafeDistance()); setEdgeRight(0); return; } setEdgeLeft(0); if (!tagBean.isSmartRecommend) { i = getRightSafeDistance(); } setEdgeRight(i); } public final int getApiSource() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43649, new Class[0], Integer.TYPE); return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.H; } @Override // com.shizhuang.duapp.media.editimage.view.BaseTagView public int getLayoutId() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43648, new Class[0], Integer.TYPE); return proxy.isSupported ? ((Integer) proxy.result).intValue() : R.layout.layout_smart_tag; } @Override // com.shizhuang.duapp.media.editimage.view.BaseTagView public void initData() { if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43654, new Class[0], Void.TYPE).isSupported) { super.initData(); TagBackgroundView ivBgLeft = getIvBgLeft(); if (ivBgLeft != null) { ivBgLeft.a(); } TagBackgroundView ivBgRight = getIvBgRight(); if (ivBgRight != null) { ivBgRight.a(); } } } @Override // com.shizhuang.duapp.media.editimage.view.BaseTagView public void l() { if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43653, new Class[0], Void.TYPE).isSupported) { super.l(); ImageView imageView = (ImageView) v(R.id.ivCloseLeft); if (imageView != null) { imageView.setOnClickListener(new SmartTagViewV2$initListener$1(this)); } ImageView imageView2 = (ImageView) v(R.id.ivCloseRight); if (imageView2 != null) { imageView2.setOnClickListener(new SmartTagViewV2$initListener$2(this)); } this.I = new GestureDetector(getContext(), new b(this)); } } @Override // com.shizhuang.duapp.media.editimage.view.BaseTagView public void n() { if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43651, new Class[0], Void.TYPE).isSupported) { super.n(); setSmartTagMatTextWidth(false); } } @Override // com.shizhuang.duapp.media.editimage.view.BaseTagView public boolean onTouchEvent(@NotNull MotionEvent motionEvent) { PatchProxyResult proxy = PatchProxy.proxy(new Object[]{motionEvent}, this, changeQuickRedirect, false, 43664, new Class[]{MotionEvent.class}, Boolean.TYPE); if (proxy.isSupported) { return ((Boolean) proxy.result).booleanValue(); } GestureDetector gestureDetector = this.I; if (gestureDetector != null) { gestureDetector.onTouchEvent(motionEvent); } return super.onTouchEvent(motionEvent); } @Override // com.shizhuang.duapp.media.editimage.view.BaseTagView public void p() { boolean z = false; if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43665, new Class[0], Void.TYPE).isSupported) { super.p(); ValueAnimator valueAnimator = this.J; if (valueAnimator != null) { valueAnimator.cancel(); } ValueAnimator valueAnimator2 = this.K; if (valueAnimator2 != null) { valueAnimator2.cancel(); } this.J = null; this.K = null; TagModel tagBean = getTagBean(); if (tagBean != null) { SensorPublishUtil sensorPublishUtil = SensorPublishUtil.f12955a; String str = tagBean.f26273id; String str2 = tagBean.type; String sessionID = getSessionID(); Integer valueOf = Integer.valueOf(getClickSource()); if (!PatchProxy.proxy(new Object[]{str, str2, sessionID, valueOf}, sensorPublishUtil, SensorPublishUtil.changeQuickRedirect, false, 108595, new Class[]{String.class, String.class, String.class, Integer.class}, Void.TYPE).isSupported) { ArrayMap arrayMap = new ArrayMap(8); if ("218".length() > 0) { arrayMap.put("current_page", "218"); } if ("".length() > 0) { z = true; } if (z) { arrayMap.put("block_type", ""); } if (str == null) { str = ""; } arrayMap.put("community_tag_id", str); arrayMap.put("community_tag_type", sensorPublishUtil.c(str2)); arrayMap.put("content_release_source_type_id", valueOf); arrayMap.put("content_release_id", sessionID); l30.b.f34999a.b("community_content_release_tag_delete_click", arrayMap); } } } } @Override // com.shizhuang.duapp.media.editimage.view.BaseTagView public void r() { if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43661, new Class[0], Void.TYPE).isSupported) { super.r(); x(); } } public final void setApiSource(int i) { if (!PatchProxy.proxy(new Object[]{new Integer(i)}, this, changeQuickRedirect, false, 43650, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) { this.H = i; } } public View v(int i) { PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Integer(i)}, this, changeQuickRedirect, false, 43667, new Class[]{Integer.TYPE}, View.class); if (proxy.isSupported) { return (View) proxy.result; } if (this.M == null) { this.M = new HashMap(); } View view = (View) this.M.get(Integer.valueOf(i)); if (view != null) { return view; } View findViewById = findViewById(i); this.M.put(Integer.valueOf(i), findViewById); return findViewById; } public final void w() { BaseTagView.Listener listener; if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43655, new Class[0], Void.TYPE).isSupported && (listener = getListener()) != null) { listener.onTagRemove(this); } } public final void x() { TagModel tagBean; if (PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43662, new Class[0], Void.TYPE).isSupported || (tagBean = getTagBean()) == null) { return; } if (o()) { MarqueeTextView tvNameLeft = getTvNameLeft(); if (tvNameLeft != null) { tvNameLeft.b(tagBean.tagName); return; } return; } MarqueeTextView tvNameRight = getTvNameRight(); if (tvNameRight != null) { tvNameRight.b(tagBean.tagName); } } public final void y() { if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43660, new Class[0], Void.TYPE).isSupported) { FrameLayout flBreath = getFlBreath(); if (flBreath != null) { flBreath.setVisibility(0); } if (o()) { ConstraintLayout clTagLeft = getClTagLeft(); if (clTagLeft != null) { clTagLeft.setVisibility(0); } ValueAnimator ofFloat = ValueAnimator.ofFloat(1.0f, 1.1f, 1.0f); ofFloat.addUpdateListener(new c(this)); ofFloat.setInterpolator(new LinearInterpolator()); ofFloat.setDuration(500L); ofFloat.start(); Unit unit = Unit.INSTANCE; this.J = ofFloat; return; } ConstraintLayout clTagRight = getClTagRight(); if (clTagRight != null) { clTagRight.setVisibility(0); } ValueAnimator ofFloat2 = ValueAnimator.ofFloat(1.0f, 1.1f, 1.0f); ofFloat2.addUpdateListener(new d(this)); ofFloat2.setInterpolator(new LinearInterpolator()); ofFloat2.setDuration(500L); ofFloat2.start(); Unit unit2 = Unit.INSTANCE; this.K = ofFloat2; } } public final void z() { ImageTagViewModel C; int i; boolean z = false; if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43657, new Class[0], Void.TYPE).isSupported) { Fragment i3 = ku.b.f34916a.i(getContext()); if (!(i3 instanceof ImageEditFragment)) { i3 = null; } ImageEditFragment imageEditFragment = (ImageEditFragment) i3; if (imageEditFragment != null && (C = imageEditFragment.C()) != null && C.d()) { Class cls = Integer.TYPE; PatchProxyResult proxy = PatchProxy.proxy(new Object[0], C, ImageTagViewModel.changeQuickRedirect, false, 41991, new Class[0], cls); if (proxy.isSupported) { i = ((Integer) proxy.result).intValue(); } else { i = C.f9810c; } int i12 = i + 1; if (!PatchProxy.proxy(new Object[]{new Integer(i12)}, C, ImageTagViewModel.changeQuickRedirect, false, 41992, new Class[]{cls}, Void.TYPE).isSupported) { C.f9810c = i12; } TagModel tagBean = getTagBean(); if (tagBean != null) { setSmartTagMatTextWidth(true); f(i.f36333a); TextView textView = (TextView) v(R.id.tvUseLeft); if (textView != null) { textView.setVisibility(8); } TextView textView2 = (TextView) v(R.id.tvUseRight); if (textView2 != null) { textView2.setVisibility(8); } ImageView imageView = (ImageView) v(R.id.ivCloseLeft); if (imageView != null) { imageView.setVisibility(8); } ImageView imageView2 = (ImageView) v(R.id.ivCloseRight); if (imageView2 != null) { imageView2.setVisibility(8); } TagBackgroundView ivBgLeft = getIvBgLeft(); if (ivBgLeft != null) { ivBgLeft.b(); } TagBackgroundView ivBgRight = getIvBgRight(); if (ivBgRight != null) { ivBgRight.b(); } TagBackgroundView ivBgLeft2 = getIvBgLeft(); if (ivBgLeft2 != null) { ivBgLeft2.setBgColor(R.color.color_black_333333_alpha90); } TagBackgroundView ivBgRight2 = getIvBgRight(); if (ivBgRight2 != null) { ivBgRight2.setBgColor(R.color.color_black_333333_alpha90); } TagModel tagBean2 = getTagBean(); if (tagBean2 != null) { tagBean2.isSmartRecommend = false; } SensorPublishUtil sensorPublishUtil = SensorPublishUtil.f12955a; String str = tagBean.f26273id; String str2 = tagBean.type; String sessionID = getSessionID(); Integer valueOf = Integer.valueOf(getClickSource()); if (!PatchProxy.proxy(new Object[]{str, str2, sessionID, valueOf}, sensorPublishUtil, SensorPublishUtil.changeQuickRedirect, false, 108596, new Class[]{String.class, String.class, String.class, Integer.class}, Void.TYPE).isSupported) { ArrayMap arrayMap = new ArrayMap(8); if ("218".length() > 0) { arrayMap.put("current_page", "218"); } if ("".length() > 0) { z = true; } if (z) { arrayMap.put("block_type", ""); } if (str == null) { str = ""; } arrayMap.put("community_tag_id", str); arrayMap.put("community_tag_type", sensorPublishUtil.c(str2)); arrayMap.put("content_release_source_type_id", valueOf); arrayMap.put("content_release_id", sessionID); l30.b.f34999a.b("community_content_release_tag_choose_click", arrayMap); } post(new e(this, tagBean)); } } } } }