得物.apk(点击下载) / CommentLikeContainerView.java


package com.shizhuang.duapp.modules.du_community_common.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.FrameLayout;
import co.c;
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.libs.duimageloaderview.options.DuScaleType;
import com.shizhuang.duapp.modules.du_community_common.manager.LikeIconResManager;
import df.b0;
import df.q;
import fi.b;
import java.util.HashMap;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.JvmOverloads;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@Metadata(bv = {}, d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\u0018\u00002\u00020\u0001B\u001d\b\u0007\u0012\u0006\u0010\u0003\u001a\u00020\u0002\u0012\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u0004¢\u0006\u0004\b\u0006\u0010\u0007¨\u0006\b"}, d2 = {"Lcom/shizhuang/duapp/modules/du_community_common/view/CommentLikeContainerView;", "Landroid/widget/FrameLayout;", "Landroid/content/Context;", "context", "Landroid/util/AttributeSet;", "attrs", "<init>", "(Landroid/content/Context;Landroid/util/AttributeSet;)V", "du_community_common_release"}, k = 1, mv = {1, 4, 2})
/* compiled from: CommentLikeContainerView.kt */
public final class CommentLikeContainerView extends FrameLayout {
    public static ChangeQuickRedirect changeQuickRedirect;
    public LikeIconResManager.g b;

    /* renamed from: c  reason: collision with root package name */
    public int f12994c;
    public int d;
    public String e;
    public boolean f;

    /* renamed from: g  reason: collision with root package name */
    public HashMap f12995g;

    @JvmOverloads
    public CommentLikeContainerView(@NotNull Context context) {
        this(context, null);
    }

    public static /* synthetic */ void d(CommentLikeContainerView commentLikeContainerView, boolean z, LikeIconResManager.i iVar, int i, int i3) {
        if ((i3 & 4) != 0) {
            i = 1;
        }
        commentLikeContainerView.c(z, iVar, i);
    }

    public View a(int i) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Integer(i)}, this, changeQuickRedirect, false, 109420, new Class[]{Integer.TYPE}, View.class);
        if (proxy.isSupported) {
            return (View) proxy.result;
        }
        if (this.f12995g == null) {
            this.f12995g = new HashMap();
        }
        View view = (View) this.f12995g.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View findViewById = findViewById(i);
        this.f12995g.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

    public final void b(boolean z) {
        c cVar;
        if (!PatchProxy.proxy(new Object[]{new Byte(z ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 109419, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) {
            if (this.f && ((Boolean) b0.f("key_comment_first_salute", Boolean.TRUE)).booleanValue()) {
                q.n(getResources().getString(R.string.du_trend_comment_first_salute_toast));
                b0.l("key_comment_first_salute", Boolean.FALSE);
            }
            if (!z) {
                e();
            } else if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 109410, new Class[0], Void.TYPE).isSupported) {
                LikeIconResManager.g gVar = this.b;
                String a5 = gVar != null ? gVar.a() : null;
                if (a5 == null || a5.length() == 0) {
                    cVar = ((DuImageLoaderView) a(R.id.iv_like_animation)).i(this.e);
                } else {
                    cVar = ((DuImageLoaderView) a(R.id.iv_like_animation)).i(a5);
                }
                ((DuImageLoaderView) a(R.id.iv_like)).setVisibility(4);
                ((DuImageLoaderView) a(R.id.iv_like_animation)).setVisibility(0);
                cVar.U(true).T(1).Q(true).x();
            }
        }
    }

    public final void c(boolean z, @NotNull LikeIconResManager.i iVar, int i) {
        boolean z4;
        Object[] objArr = {new Byte(z ? (byte) 1 : 0), iVar, new Integer(i)};
        ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
        Class cls = Boolean.TYPE;
        Class cls2 = Integer.TYPE;
        if (!PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 109412, new Class[]{cls, LikeIconResManager.i.class, cls2}, Void.TYPE).isSupported) {
            if (!PatchProxy.proxy(new Object[]{new Integer(i)}, this, changeQuickRedirect, false, 109418, new Class[]{cls2}, Void.TYPE).isSupported && i == 2) {
                ViewGroup.LayoutParams layoutParams = ((DuImageLoaderView) a(R.id.iv_like)).getLayoutParams();
                float f12 = (float) 26;
                layoutParams.width = b.b(f12);
                layoutParams.height = b.b(f12);
                Unit unit = Unit.INSTANCE;
                ((DuImageLoaderView) a(R.id.iv_like)).setLayoutParams(layoutParams);
                ViewGroup.LayoutParams layoutParams2 = ((DuImageLoaderView) a(R.id.iv_like_animation)).getLayoutParams();
                layoutParams2.width = b.b((float) 46);
                layoutParams2.height = b.b(32.5f);
                ((DuImageLoaderView) a(R.id.iv_like_animation)).setLayoutParams(layoutParams2);
            }
            LikeIconResManager.h b2 = LikeIconResManager.f.b(iVar);
            this.b = b2.c();
            this.f12994c = b2.b().c();
            this.d = b2.b().b();
            this.e = b2.b().a();
            LikeIconResManager.g c5 = b2.c();
            if (c5 != null) {
                PatchProxyResult proxy = PatchProxy.proxy(new Object[0], c5, LikeIconResManager.g.changeQuickRedirect, false, 101749, new Class[0], cls);
                if (proxy.isSupported) {
                    z4 = ((Boolean) proxy.result).booleanValue();
                } else {
                    z4 = c5.d;
                }
            } else {
                LikeIconResManager.f b5 = b2.b();
                PatchProxyResult proxy2 = PatchProxy.proxy(new Object[0], b5, LikeIconResManager.f.changeQuickRedirect, false, 101736, new Class[0], cls);
                if (proxy2.isSupported) {
                    z4 = ((Boolean) proxy2.result).booleanValue();
                } else {
                    z4 = b5.d;
                }
            }
            this.f = z4;
            f(z);
        }
    }

    public final void e() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 109411, new Class[0], Void.TYPE).isSupported) {
            ((DuImageLoaderView) a(R.id.iv_like)).setVisibility(0);
            ((DuImageLoaderView) a(R.id.iv_like_animation)).setVisibility(4);
            ((DuImageLoaderView) a(R.id.iv_like_animation)).p();
            f(false);
        }
    }

    public final void f(boolean z) {
        c cVar;
        String str;
        c cVar2;
        c cVar3;
        if (!PatchProxy.proxy(new Object[]{new Byte(z ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 109413, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) {
            if (z) {
                DuImageLoaderView duImageLoaderView = (DuImageLoaderView) a(R.id.iv_like);
                LikeIconResManager.g gVar = this.b;
                String c5 = gVar != null ? gVar.c() : null;
                String str2 = c5 != null ? c5 : "";
                PatchProxyResult proxy = PatchProxy.proxy(new Object[]{duImageLoaderView, str2}, this, changeQuickRedirect, false, 109414, new Class[]{DuImageLoaderView.class, String.class}, c.class);
                if (proxy.isSupported) {
                    cVar = (c) proxy.result;
                } else {
                    if (str2.length() == 0) {
                        cVar3 = duImageLoaderView.h(this.f12994c);
                    } else {
                        cVar3 = duImageLoaderView.i(str2);
                    }
                    PatchProxyResult proxy2 = PatchProxy.proxy(new Object[]{cVar3}, this, changeQuickRedirect, false, 109416, new Class[]{c.class}, c.class);
                    if (proxy2.isSupported) {
                        cVar = (c) proxy2.result;
                    } else {
                        cVar = cVar3.l0(null).b0(getContext(), Integer.valueOf(this.f12994c)).p0(DuScaleType.FIT_CENTER);
                    }
                }
            } else {
                DuImageLoaderView duImageLoaderView2 = (DuImageLoaderView) a(R.id.iv_like);
                LikeIconResManager.g gVar2 = this.b;
                String b2 = gVar2 != null ? gVar2.b() : null;
                if (b2 != null) {
                    str = b2;
                } else {
                    str = "";
                }
                PatchProxyResult proxy3 = PatchProxy.proxy(new Object[]{duImageLoaderView2, str}, this, changeQuickRedirect, false, 109415, new Class[]{DuImageLoaderView.class, String.class}, c.class);
                if (proxy3.isSupported) {
                    cVar = (c) proxy3.result;
                } else {
                    if (str.length() == 0) {
                        cVar2 = duImageLoaderView2.h(this.d);
                    } else {
                        cVar2 = duImageLoaderView2.i(str);
                    }
                    PatchProxyResult proxy4 = PatchProxy.proxy(new Object[]{cVar2}, this, changeQuickRedirect, false, 109417, new Class[]{c.class}, c.class);
                    if (proxy4.isSupported) {
                        cVar = (c) proxy4.result;
                    } else {
                        cVar = cVar2.l0(null).b0(getContext(), Integer.valueOf(this.d)).p0(DuScaleType.FIT_CENTER);
                    }
                }
            }
            cVar.x();
        }
    }

    public void onAttachedToWindow() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 109408, new Class[0], Void.TYPE).isSupported) {
            super.onAttachedToWindow();
            ViewParent parent = getParent();
            if (!(parent instanceof ViewGroup)) {
                parent = null;
            }
            ViewGroup viewGroup = (ViewGroup) parent;
            if (viewGroup != null) {
                viewGroup.setClipChildren(false);
            }
            setClipChildren(false);
            setClipToPadding(false);
        }
    }

    public void onDetachedFromWindow() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 109409, new Class[0], Void.TYPE).isSupported) {
            super.onDetachedFromWindow();
            ((DuImageLoaderView) a(R.id.iv_like)).animate().cancel();
        }
    }

    @JvmOverloads
    public CommentLikeContainerView(@NotNull Context context, @Nullable AttributeSet attributeSet) {
        super(context, attributeSet);
        this.f12994c = R.mipmap.icon_common_zan1;
        this.d = R.mipmap.icon_common_zan;
        this.e = "https://cdn.poizon.com/node-common/0e1c74c631a3a39d115d121fe65824b1.webp";
        FrameLayout.inflate(context, R.layout.du_trend_layout_container_view_comment_like, this);
    }
}