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


package com.shizhuang.duapp.modules.mall_dynamic.channel.views.feed;

import a40.f;
import android.content.Context;
import android.graphics.drawable.GradientDrawable;
import android.text.SpannableStringBuilder;
import android.util.AttributeSet;
import android.view.View;
import androidx.appcompat.widget.AppCompatTextView;
import cd.g;
import cd.n;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.shizhuang.duapp.R;
import com.shizhuang.duapp.common.component.module.IModuleExposureObserver;
import com.shizhuang.duapp.common.exposure.DuExposureHelper;
import com.shizhuang.duapp.common.extension.DrawableScale;
import com.shizhuang.duapp.libs.duimageloaderview.DuImageLoaderView;
import com.shizhuang.duapp.libs.duimageloaderview.options.DuScaleType;
import com.shizhuang.duapp.modules.du_mall_common.extension.ViewExtensionKt;
import com.shizhuang.duapp.modules.mall_dynamic.channel.model.feed.ChannelCardModel;
import com.shizhuang.duapp.modules.mall_dynamic.channel.views.BaseChannelView;
import fi.b;
import j60.z;
import java.util.HashMap;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.jvm.JvmOverloads;
import kotlin.text.StringsKt__StringsKt;
import of.a;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@Metadata(bv = {}, d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u00012\u00020\u0003B'\b\u0007\u0012\u0006\u0010\r\u001a\u00020\f\u0012\n\b\u0002\u0010\u000f\u001a\u0004\u0018\u00010\u000e\u0012\b\b\u0002\u0010\u0010\u001a\u00020\n¢\u0006\u0004\b\u0011\u0010\u0012J\u0012\u0010\u0007\u001a\u00020\u00062\b\u0010\u0005\u001a\u0004\u0018\u00010\u0004H\u0002J\u0012\u0010\t\u001a\u00020\u00062\b\u0010\b\u001a\u0004\u0018\u00010\u0004H\u0002J\b\u0010\u000b\u001a\u00020\nH\u0016¨\u0006\u0013"}, d2 = {"Lcom/shizhuang/duapp/modules/mall_dynamic/channel/views/feed/ChannelSceneCardView;", "Lcom/shizhuang/duapp/modules/mall_dynamic/channel/views/BaseChannelView;", "Lcom/shizhuang/duapp/modules/mall_dynamic/channel/model/feed/ChannelCardModel;", "Lcom/shizhuang/duapp/common/component/module/IModuleExposureObserver;", "", "subTitle", "", "setSubTitle", PushConstants.TITLE, "setMainTitle", "", "getLayoutId", "Landroid/content/Context;", "context", "Landroid/util/AttributeSet;", "attrs", "defStyleAttr", "<init>", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "du_mall_dynamic_release"}, k = 1, mv = {1, 4, 2})
/* compiled from: ChannelSceneCardView.kt */
public final class ChannelSceneCardView extends BaseChannelView<ChannelCardModel> implements IModuleExposureObserver {
    public static ChangeQuickRedirect changeQuickRedirect;
    public HashMap f;

    @JvmOverloads
    public ChannelSceneCardView(@NotNull Context context) {
        this(context, null, 0, 6);
    }

    @JvmOverloads
    public ChannelSceneCardView(@NotNull Context context, @Nullable AttributeSet attributeSet) {
        this(context, attributeSet, 0, 4);
    }

    /* JADX INFO: this call moved to the top of the method (can break code semantics) */
    public /* synthetic */ ChannelSceneCardView(Context context, AttributeSet attributeSet, int i, int i3) {
        this(context, (i3 & 2) != 0 ? null : attributeSet, (i3 & 4) != 0 ? 0 : i);
    }

    private final void setMainTitle(String str) {
        boolean z = true;
        if (!PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 212233, new Class[]{String.class}, Void.TYPE).isSupported) {
            if (!(str == null || str.length() == 0)) {
                z = false;
            }
            if (z) {
                AppCompatTextView appCompatTextView = (AppCompatTextView) _$_findCachedViewById(R.id.sceneMainTitle);
                if (str == null) {
                    str = "";
                }
                appCompatTextView.setText(str);
                return;
            }
            SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
            spannableStringBuilder.append("#", new a(getContext(), R.drawable.ic_mall_text_left_l, 4, 0, 0, b.b((float) 3), 24), 17);
            if (str == null) {
                str = "";
            }
            spannableStringBuilder.append((CharSequence) str);
            spannableStringBuilder.append("#", new a(getContext(), R.drawable.ic_mall_text_right_l, 0, 0, 0, b.b((float) -1), 24), 17);
            ((AppCompatTextView) _$_findCachedViewById(R.id.sceneMainTitle)).setText(spannableStringBuilder);
        }
    }

    private final void setSubTitle(String str) {
        String str2;
        int i = 0;
        if (!PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 212232, new Class[]{String.class}, Void.TYPE).isSupported) {
            String str3 = "";
            if (!n.b(str)) {
                str2 = str3;
            } else if (StringsKt__StringsKt.contains$default((CharSequence) str, (CharSequence) " ", false, 2, (Object) null)) {
                String str4 = str3;
                for (Object obj : CollectionsKt___CollectionsKt.take(StringsKt__StringsKt.split$default((CharSequence) str, new String[]{" "}, false, 0, 6, (Object) null), 2)) {
                    int i3 = i + 1;
                    if (i < 0) {
                        CollectionsKt__CollectionsKt.throwIndexOverflow();
                    }
                    String g3 = f.g("# ", (String) obj);
                    if (i == 0) {
                        str4 = g3;
                    } else if (i == 1) {
                        str3 = g3;
                    }
                    i = i3;
                }
                str2 = str3;
                str3 = str4;
            } else {
                str3 = f.g("# ", str);
                str2 = str3;
            }
            ((AppCompatTextView) _$_findCachedViewById(R.id.sceneSubTitle1)).setText(str3);
            ((AppCompatTextView) _$_findCachedViewById(R.id.sceneSubTitle2)).setText(str2);
        }
    }

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

    /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
    @Override // com.shizhuang.duapp.modules.mall_dynamic.channel.views.BaseChannelView
    public void c(ChannelCardModel channelCardModel) {
        ChannelCardModel channelCardModel2 = channelCardModel;
        if (!PatchProxy.proxy(new Object[]{channelCardModel2}, this, changeQuickRedirect, false, 212231, new Class[]{ChannelCardModel.class}, Void.TYPE).isSupported) {
            GradientDrawable gradientDrawable = new GradientDrawable();
            gradientDrawable.setColors(new int[]{855638016, 0});
            gradientDrawable.setOrientation(GradientDrawable.Orientation.TOP_BOTTOM);
            float f12 = (float) 2;
            gradientDrawable.setCornerRadius((float) b.b(f12));
            DuImageLoaderView duImageLoaderView = (DuImageLoaderView) _$_findCachedViewById(R.id.itemIcon);
            String cardCoverImg = channelCardModel2.getCardCoverImg();
            if (cardCoverImg == null) {
                cardCoverImg = "";
            }
            g.a(duImageLoaderView.i(cardCoverImg), DrawableScale.ProductList).h0(gradientDrawable).p0(DuScaleType.CENTER_CROP).R((float) b.b(f12)).x();
            ((DuImageLoaderView) _$_findCachedViewById(R.id.ivBg)).i("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/mall_bg_channel_style_nx.webp").p0(DuScaleType.FIT_XY).x();
            setMainTitle(channelCardModel2.getCardMainTitle());
            setSubTitle(channelCardModel2.getCardSubTitle());
            ViewExtensionKt.e(this, 0, new ChannelSceneCardView$onBind$1(this, channelCardModel2), 1);
        }
    }

    @Override // com.shizhuang.duapp.common.component.module.AbsModuleView
    public int getLayoutId() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 212230, new Class[0], Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : R.layout.item_mall_channel_scene_card;
    }

    @Override // com.shizhuang.duapp.common.component.module.IModuleExposureObserver
    public void onExposure(@Nullable DuExposureHelper.State state) {
        if (!PatchProxy.proxy(new Object[]{state}, this, changeQuickRedirect, false, 212234, new Class[]{DuExposureHelper.State.class}, Void.TYPE).isSupported) {
            ChannelCardModel channelCardModel = (ChannelCardModel) getAcquireData();
            BaseChannelView.k(this, null, channelCardModel != null ? channelCardModel.getTrack() : null, 1, null);
        }
    }

    @JvmOverloads
    public ChannelSceneCardView(@NotNull Context context, @Nullable AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        z.b.a(this, b.b((float) 2), -1);
    }
}