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


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

import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import co.c;
import com.facebook.drawee.generic.GenericDraweeHierarchy;
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.ModuleAdapterDelegateKt;
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.IViewAppearObserver;
import com.shizhuang.duapp.modules.du_mall_common.utils.exposure.IModuleExposureSectionViewCallback;
import com.shizhuang.duapp.modules.mall_dynamic.channel.model.ChannelBrandHotCategoryItemBrandModel2;
import com.shizhuang.duapp.modules.mall_dynamic.channel.model.ChannelBrandHotCategoryItemModel2;
import com.shizhuang.duapp.modules.mall_dynamic.channel.model.ChannelBrandHotCategoryModel2;
import com.shizhuang.duapp.modules.mall_dynamic.channel.model.ChannelComponentItemModel;
import com.shizhuang.duapp.modules.mall_dynamic.channel.widget.ReverseDrawingOrderLinearLayout;
import com.youth.banner.Banner;
import com.youth.banner.adapter.BannerAdapter;
import com.youth.banner.listener.OnPageSelectedListener;
import fi.b;
import j60.t;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.ArraysKt___ArraysKt;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.jvm.JvmOverloads;
import kotlin.jvm.functions.Function0;
import kotlinx.android.extensions.LayoutContainer;
import l60.e;
import l60.f;
import o5.i;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@Metadata(bv = {}, d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u00012\u00020\u00032\u00020\u0004:\u0002\r\u000eB\u001d\b\u0007\u0012\u0006\u0010\b\u001a\u00020\u0007\u0012\n\b\u0002\u0010\n\u001a\u0004\u0018\u00010\t¢\u0006\u0004\b\u000b\u0010\fJ\b\u0010\u0006\u001a\u00020\u0005H\u0016¨\u0006\u000f"}, d2 = {"Lcom/shizhuang/duapp/modules/mall_dynamic/channel/views/ChannelBrandHotCategoryView2;", "Lcom/shizhuang/duapp/modules/mall_dynamic/channel/views/BaseChannelView;", "Lcom/shizhuang/duapp/modules/mall_dynamic/channel/model/ChannelBrandHotCategoryModel2;", "Lcom/shizhuang/duapp/modules/du_mall_common/utils/exposure/IModuleExposureSectionViewCallback;", "Lcom/shizhuang/duapp/modules/du_mall_common/utils/IViewAppearObserver;", "", "getSubViewCount", "Landroid/content/Context;", "context", "Landroid/util/AttributeSet;", "attrs", "<init>", "(Landroid/content/Context;Landroid/util/AttributeSet;)V", "BrandHotCategoryAdapter", "BrandHotCategoryViewHolder", "du_mall_dynamic_release"}, k = 1, mv = {1, 4, 2})
/* compiled from: ChannelBrandHotCategoryView2.kt */
public final class ChannelBrandHotCategoryView2 extends BaseChannelView<ChannelBrandHotCategoryModel2> implements IModuleExposureSectionViewCallback, IViewAppearObserver {
    public static ChangeQuickRedirect changeQuickRedirect;
    public final ScalBannerHelper f;

    /* renamed from: g  reason: collision with root package name */
    public final Banner f19292g;

    /* renamed from: h  reason: collision with root package name */
    public final RecyclerView f19293h;
    public BrandHotCategoryAdapter i;

    @Metadata(bv = {}, d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\u0018\u00002\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00030\u0001B\u0007¢\u0006\u0004\b\u0004\u0010\u0005¨\u0006\u0006"}, d2 = {"Lcom/shizhuang/duapp/modules/mall_dynamic/channel/views/ChannelBrandHotCategoryView2$BrandHotCategoryAdapter;", "Lcom/youth/banner/adapter/BannerAdapter;", "Lcom/shizhuang/duapp/modules/mall_dynamic/channel/model/ChannelBrandHotCategoryItemModel2;", "Lcom/shizhuang/duapp/modules/mall_dynamic/channel/views/ChannelBrandHotCategoryView2$BrandHotCategoryViewHolder;", "<init>", "()V", "du_mall_dynamic_release"}, k = 1, mv = {1, 4, 2})
    /* compiled from: ChannelBrandHotCategoryView2.kt */
    public static final class BrandHotCategoryAdapter extends BannerAdapter<ChannelBrandHotCategoryItemModel2, BrandHotCategoryViewHolder> {
        public static ChangeQuickRedirect changeQuickRedirect;

        @Override // com.youth.banner.holder.IViewHolder
        public void onBindView(Object obj, Object obj2, int i, int i3) {
            String str;
            BrandHotCategoryViewHolder brandHotCategoryViewHolder = (BrandHotCategoryViewHolder) obj;
            ChannelBrandHotCategoryItemModel2 channelBrandHotCategoryItemModel2 = (ChannelBrandHotCategoryItemModel2) obj2;
            int i12 = 4;
            Object[] objArr = {brandHotCategoryViewHolder, channelBrandHotCategoryItemModel2, new Integer(i), new Integer(i3)};
            ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
            Class cls = Integer.TYPE;
            if (!PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 211515, new Class[]{BrandHotCategoryViewHolder.class, ChannelBrandHotCategoryItemModel2.class, cls, cls}, Void.TYPE).isSupported) {
                char c5 = 0;
                if (!PatchProxy.proxy(new Object[]{channelBrandHotCategoryItemModel2}, brandHotCategoryViewHolder, BrandHotCategoryViewHolder.changeQuickRedirect, false, 211516, new Class[]{ChannelBrandHotCategoryItemModel2.class}, Void.TYPE).isSupported) {
                    ((TextView) brandHotCategoryViewHolder._$_findCachedViewById(R.id.tvItemTitle)).setTextSize(0, (float) t.d(13));
                    TextView textView = (TextView) brandHotCategoryViewHolder._$_findCachedViewById(R.id.tvItemTitle);
                    if (channelBrandHotCategoryItemModel2 == null || (str = channelBrandHotCategoryItemModel2.getTitle()) == null) {
                        str = "";
                    }
                    textView.setText(str);
                    ((GenericDraweeHierarchy) ((DuImageLoaderView) brandHotCategoryViewHolder._$_findCachedViewById(R.id.ivItemImage)).getHierarchy()).setActualImageScaleType(e.f35034a);
                    List<ChannelBrandHotCategoryItemBrandModel2> list = null;
                    float f = (float) 2;
                    ((DuImageLoaderView) brandHotCategoryViewHolder._$_findCachedViewById(R.id.ivItemImage)).i(channelBrandHotCategoryItemModel2 != null ? channelBrandHotCategoryItemModel2.getImgUrl() : null).R((float) b.b(f)).l0(new ColorDrawable((int) 4294309369L)).p0(DuScaleType.CENTER_CROP).d0(300).x();
                    ((GenericDraweeHierarchy) ((DuImageLoaderView) brandHotCategoryViewHolder._$_findCachedViewById(R.id.f40932bg)).getHierarchy()).setActualImageScaleType(new f(i.f36333a, 1));
                    ((c) ((DuImageLoaderView) brandHotCategoryViewHolder._$_findCachedViewById(R.id.f40932bg)).i(channelBrandHotCategoryItemModel2 != null ? channelBrandHotCategoryItemModel2.getImgUrl() : null).R((float) b.b(f)).q(25)).d0(300).x();
                    int i13 = R.id.brandImageContainer;
                    ((ReverseDrawingOrderLinearLayout) brandHotCategoryViewHolder._$_findCachedViewById(R.id.brandImageContainer)).removeAllViews();
                    if (channelBrandHotCategoryItemModel2 != null) {
                        list = channelBrandHotCategoryItemModel2.getBrandList();
                    }
                    if (list == null) {
                        list = CollectionsKt__CollectionsKt.emptyList();
                    }
                    List take = CollectionsKt___CollectionsKt.take(list, 3);
                    ArrayList arrayList = new ArrayList();
                    for (Object obj3 : take) {
                        String brandLogo = ((ChannelBrandHotCategoryItemBrandModel2) obj3).getBrandLogo();
                        if (!(brandLogo == null || brandLogo.length() == 0)) {
                            arrayList.add(obj3);
                        }
                    }
                    Iterator it2 = arrayList.iterator();
                    int i14 = 0;
                    while (it2.hasNext()) {
                        Object next = it2.next();
                        int i15 = i14 + 1;
                        if (i14 < 0) {
                            CollectionsKt__CollectionsKt.throwIndexOverflow();
                        }
                        ChannelBrandHotCategoryItemBrandModel2 channelBrandHotCategoryItemBrandModel2 = (ChannelBrandHotCategoryItemBrandModel2) next;
                        DuImageLoaderView duImageLoaderView = new DuImageLoaderView(brandHotCategoryViewHolder.getContainerView().getContext());
                        ViewGroup.MarginLayoutParams marginLayoutParams = new ViewGroup.MarginLayoutParams(t.d(25), t.d(25));
                        if (i14 > 0) {
                            marginLayoutParams.setMarginStart(t.d(-7));
                        }
                        ((ReverseDrawingOrderLinearLayout) brandHotCategoryViewHolder._$_findCachedViewById(i13)).addView(duImageLoaderView, marginLayoutParams);
                        String brandLogo2 = channelBrandHotCategoryItemBrandModel2.getBrandLogo();
                        Integer orNull = ArraysKt___ArraysKt.getOrNull(brandHotCategoryViewHolder.b, i14);
                        Integer orNull2 = ArraysKt___ArraysKt.getOrNull(brandHotCategoryViewHolder.f19294c, i14);
                        Object[] objArr2 = new Object[i12];
                        objArr2[c5] = duImageLoaderView;
                        objArr2[1] = brandLogo2;
                        objArr2[2] = orNull;
                        objArr2[3] = orNull2;
                        ChangeQuickRedirect changeQuickRedirect3 = BrandHotCategoryViewHolder.changeQuickRedirect;
                        Class[] clsArr = new Class[i12];
                        clsArr[c5] = DuImageLoaderView.class;
                        clsArr[1] = String.class;
                        clsArr[2] = Integer.class;
                        clsArr[3] = Integer.class;
                        if (!PatchProxy.proxy(objArr2, brandHotCategoryViewHolder, changeQuickRedirect3, false, 211517, clsArr, Void.TYPE).isSupported) {
                            duImageLoaderView.i(brandLogo2).p0(DuScaleType.CENTER_CROP).Y((float) Math.max(1, b.b(0.7f))).X(orNull != null ? orNull.intValue() : 0).h0(new ColorDrawable(orNull2 != null ? orNull2.intValue() : 0)).o0(true).d0(300).x();
                        }
                        i14 = i15;
                        i13 = R.id.brandImageContainer;
                        i12 = 4;
                        c5 = 0;
                    }
                }
            }
        }

        @Override // com.youth.banner.holder.IViewHolder
        public Object onCreateHolder(ViewGroup viewGroup, int i) {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[]{viewGroup, new Integer(i)}, this, changeQuickRedirect, false, 211514, new Class[]{ViewGroup.class, Integer.TYPE}, BrandHotCategoryViewHolder.class);
            if (proxy.isSupported) {
                return (BrandHotCategoryViewHolder) proxy.result;
            }
            return new BrandHotCategoryViewHolder(ViewExtensionKt.w(viewGroup, R.layout.layout_channel_brand_hot_category_item2, false, 2));
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000\u000e\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u00012\u00020\u0002¨\u0006\u0003"}, d2 = {"Lcom/shizhuang/duapp/modules/mall_dynamic/channel/views/ChannelBrandHotCategoryView2$BrandHotCategoryViewHolder;", "Landroidx/recyclerview/widget/RecyclerView$ViewHolder;", "Lkotlinx/android/extensions/LayoutContainer;", "du_mall_dynamic_release"}, k = 1, mv = {1, 4, 2})
    /* compiled from: ChannelBrandHotCategoryView2.kt */
    public static final class BrandHotCategoryViewHolder extends RecyclerView.ViewHolder implements LayoutContainer {
        public static ChangeQuickRedirect changeQuickRedirect;
        public final int[] b = {(int) 4294967295L, (int) 2164260863L, 1308622847};

        /* renamed from: c  reason: collision with root package name */
        public final int[] f19294c = {0, 218103808, 436207616};
        @NotNull
        public final View d;
        public HashMap e;

        public BrandHotCategoryViewHolder(@NotNull View view) {
            super(view);
            this.d = view;
        }

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

        @Override // kotlinx.android.extensions.LayoutContainer
        @NotNull
        public View getContainerView() {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 211518, new Class[0], View.class);
            return proxy.isSupported ? (View) proxy.result : this.d;
        }
    }

    /* compiled from: ChannelBrandHotCategoryView2.kt */
    public static final class a implements OnPageSelectedListener {
        public static ChangeQuickRedirect changeQuickRedirect;

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ ChannelBrandHotCategoryView2 f19295a;

        public a(ChannelBrandHotCategoryView2 channelBrandHotCategoryView2) {
            this.f19295a = channelBrandHotCategoryView2;
        }

        @Override // com.youth.banner.listener.OnPageSelectedListener
        public final void onPageSelected(int i) {
            ChannelBrandHotCategoryItemModel2 channelBrandHotCategoryItemModel2;
            if (!PatchProxy.proxy(new Object[]{new Integer(i)}, this, changeQuickRedirect, false, 211513, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
                ChannelBrandHotCategoryView2 channelBrandHotCategoryView2 = this.f19295a;
                ScalBannerHelper scalBannerHelper = channelBrandHotCategoryView2.f;
                BrandHotCategoryAdapter brandHotCategoryAdapter = channelBrandHotCategoryView2.i;
                scalBannerHelper.d((brandHotCategoryAdapter == null || (channelBrandHotCategoryItemModel2 = (ChannelBrandHotCategoryItemModel2) brandHotCategoryAdapter.getItem(i)) == null) ? null : channelBrandHotCategoryItemModel2.getImgUrl());
            }
        }
    }

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

    /* 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(ChannelBrandHotCategoryModel2 channelBrandHotCategoryModel2) {
        ChannelBrandHotCategoryModel2 channelBrandHotCategoryModel22 = channelBrandHotCategoryModel2;
        if (!PatchProxy.proxy(new Object[]{channelBrandHotCategoryModel22}, this, changeQuickRedirect, false, 211504, new Class[]{ChannelBrandHotCategoryModel2.class}, Void.TYPE).isSupported) {
            Banner banner = this.f19292g;
            BrandHotCategoryAdapter brandHotCategoryAdapter = new BrandHotCategoryAdapter();
            this.i = brandHotCategoryAdapter;
            Unit unit = Unit.INSTANCE;
            banner.setAdapter(brandHotCategoryAdapter);
            this.f19292g.setOnBannerListener(new nr0.c(this));
            BrandHotCategoryAdapter brandHotCategoryAdapter2 = this.i;
            if (brandHotCategoryAdapter2 != null) {
                List<ChannelBrandHotCategoryItemModel2> list = channelBrandHotCategoryModel22.getList();
                if (list == null) {
                    list = CollectionsKt__CollectionsKt.emptyList();
                }
                brandHotCategoryAdapter2.setItems(list);
            }
        }
    }

    @Override // com.shizhuang.duapp.modules.du_mall_common.utils.exposure.IModuleExposureSubViewCallback
    @Nullable
    public Object getSubItem(int i3) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 211507, new Class[]{Integer.TYPE}, Object.class);
        return proxy.isSupported ? proxy.result : m(i3);
    }

    @Override // com.shizhuang.duapp.modules.du_mall_common.utils.exposure.IModuleExposureSubViewCallback
    @Nullable
    public View getSubView(int i3) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 211506, new Class[]{Integer.TYPE}, View.class);
        return proxy.isSupported ? (View) proxy.result : this.f19293h.getChildAt(i3);
    }

    @Override // com.shizhuang.duapp.modules.du_mall_common.utils.exposure.IModuleExposureSubViewCallback
    public int getSubViewCount() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 211505, new Class[0], Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.f19293h.getChildCount();
    }

    public final ChannelBrandHotCategoryItemModel2 m(int i3) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 211508, new Class[]{Integer.TYPE}, ChannelBrandHotCategoryItemModel2.class);
        if (proxy.isSupported) {
            return (ChannelBrandHotCategoryItemModel2) proxy.result;
        }
        int i12 = com.shizhuang.duapp.modules.du_mall_common.extension.ViewExtensionKt.i(this.f19293h, i3);
        if (i12 < 0) {
            return null;
        }
        BrandHotCategoryAdapter brandHotCategoryAdapter = this.i;
        int realPosition = brandHotCategoryAdapter != null ? brandHotCategoryAdapter.getRealPosition(i12) : -1;
        BrandHotCategoryAdapter brandHotCategoryAdapter2 = this.i;
        if (brandHotCategoryAdapter2 != null) {
            return (ChannelBrandHotCategoryItemModel2) brandHotCategoryAdapter2.getItem(realPosition);
        }
        return null;
    }

    @Override // com.shizhuang.duapp.modules.du_mall_common.utils.IViewAppearObserver
    public void onAppeared() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 211501, new Class[0], Void.TYPE).isSupported) {
            this.f.onAppeared();
        }
    }

    @Override // com.shizhuang.duapp.modules.du_mall_common.utils.IViewAppearObserver
    public void onDisappeared() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 211502, new Class[0], Void.TYPE).isSupported) {
            this.f.onDisappeared();
        }
    }

    @Override // com.shizhuang.duapp.modules.du_mall_common.utils.exposure.IModuleExposureSectionViewCallback
    public void onSubViewExposure(int i3) {
        ChannelBrandHotCategoryItemModel2 m;
        if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 211509, new Class[]{Integer.TYPE}, Void.TYPE).isSupported && (m = m(i3)) != null) {
            j("Toprecommendationscard", m.getTrack());
        }
    }

    @Override // com.shizhuang.duapp.common.component.module.IModuleView, com.shizhuang.duapp.common.component.module.AbsModuleView
    public void update(Object obj) {
        ChannelComponentItemModel channelComponentItemModel = (ChannelComponentItemModel) obj;
        boolean z = true;
        if (!PatchProxy.proxy(new Object[]{channelComponentItemModel}, this, changeQuickRedirect, false, 211503, new Class[]{ChannelComponentItemModel.class}, Void.TYPE).isSupported) {
            super.update(channelComponentItemModel);
            ScalBannerHelper scalBannerHelper = this.f;
            if (ModuleAdapterDelegateKt.d(this) != 0) {
                z = false;
            }
            scalBannerHelper.e(z);
        }
    }

    @JvmOverloads
    public ChannelBrandHotCategoryView2(@NotNull Context context, @Nullable AttributeSet attributeSet) {
        super(context, attributeSet, 0, 4);
        ScalBannerHelper scalBannerHelper = new ScalBannerHelper(this, "https://apk.poizon.com/duApp/Android_Config/resource/mall/app/dynamic/bg_channel_brand_category_hot_header_mask_white.png");
        this.f = scalBannerHelper;
        Banner a5 = scalBannerHelper.a();
        this.f19292g = a5;
        RecyclerView recyclerView = a5.getRecyclerView();
        if (recyclerView != null) {
            this.f19293h = recyclerView;
            scalBannerHelper.c(4000, getMainViewModel().j(), new Function0<Unit>(this) {
                /* class com.shizhuang.duapp.modules.mall_dynamic.channel.views.ChannelBrandHotCategoryView2.AnonymousClass1 */
                public static ChangeQuickRedirect changeQuickRedirect;
                public final /* synthetic */ ChannelBrandHotCategoryView2 this$0;

                {
                    this.this$0 = r1;
                }

                @Override // kotlin.jvm.functions.Function0
                public final void invoke() {
                    if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 211512, new Class[0], Void.TYPE).isSupported) {
                        this.this$0.d();
                    }
                }
            }, null);
            a5.addOnPageSelectedListener(new a(this));
            return;
        }
        throw new IllegalStateException("Required value was null.".toString());
    }
}