得物.apk(点击下载) / ChannelTrendPopularityView.java
package com.shizhuang.duapp.modules.mall_dynamic.channel.views;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.core.view.OneShotPreDrawListener;
import cd.g;
import cd.k;
import co.d;
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.extension.DrawableScale;
import com.shizhuang.duapp.common.ui.view.ProductImageLoaderView;
import com.shizhuang.duapp.common.widget.font.FontText;
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.du_mall_common.utils.exposure.ModuleChildBoundExposureCallback;
import com.shizhuang.duapp.modules.du_mall_common.utils.exposure.callback.IMallViewExposureObserver;
import com.shizhuang.duapp.modules.mall_dynamic.channel.model.ChannelComponentItemModel;
import com.shizhuang.duapp.modules.mall_dynamic.channel.model.ChannelTrendPopularityItemModel;
import com.shizhuang.duapp.modules.mall_dynamic.channel.model.ChannelTrendPopularityModel;
import com.shizhuang.duapp.modules.mall_dynamic.channel.widget.CommonTitleView;
import com.shizhuang.duapp.modules.pay.R$styleable;
import fi.b;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.jvm.JvmOverloads;
import nr0.l;
import o5.i;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import yc.c;
@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\u0005\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u00012\u00020\u00032\u00020\u0004B'\b\u0007\u0012\u0006\u0010\b\u001a\u00020\u0007\u0012\n\b\u0002\u0010\n\u001a\u0004\u0018\u00010\t\u0012\b\b\u0002\u0010\u000b\u001a\u00020\u0005¢\u0006\u0004\b\f\u0010\rJ\b\u0010\u0006\u001a\u00020\u0005H\u0016¨\u0006\u000e"}, d2 = {"Lcom/shizhuang/duapp/modules/mall_dynamic/channel/views/ChannelTrendPopularityView;", "Lcom/shizhuang/duapp/modules/mall_dynamic/channel/views/BaseChannelView;", "Lcom/shizhuang/duapp/modules/mall_dynamic/channel/model/ChannelTrendPopularityModel;", "Lcom/shizhuang/duapp/modules/du_mall_common/utils/exposure/callback/IMallViewExposureObserver;", "Lcom/shizhuang/duapp/modules/du_mall_common/utils/exposure/ModuleChildBoundExposureCallback;", "", "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: ChannelTrendPopularityView.kt */
public final class ChannelTrendPopularityView extends BaseChannelView<ChannelTrendPopularityModel> implements IMallViewExposureObserver, ModuleChildBoundExposureCallback {
public static ChangeQuickRedirect changeQuickRedirect;
public HashMap f;
@JvmOverloads
public ChannelTrendPopularityView(@NotNull Context context) {
this(context, null, 0, 6);
}
@JvmOverloads
public ChannelTrendPopularityView(@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 */ ChannelTrendPopularityView(Context context, AttributeSet attributeSet, int i, int i3) {
this(context, (i3 & 2) != 0 ? null : attributeSet, (i3 & 4) != 0 ? 0 : i);
}
public View _$_findCachedViewById(int i) {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Integer(i)}, this, changeQuickRedirect, false, 212014, 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(ChannelTrendPopularityModel channelTrendPopularityModel) {
ChannelTrendPopularityModel channelTrendPopularityModel2 = channelTrendPopularityModel;
if (!PatchProxy.proxy(new Object[]{channelTrendPopularityModel2}, this, changeQuickRedirect, false, 212009, new Class[]{ChannelTrendPopularityModel.class}, Void.TYPE).isSupported) {
int i = R.id.popularityTitleView;
CommonTitleView commonTitleView = (CommonTitleView) _$_findCachedViewById(R.id.popularityTitleView);
String modelTitle = channelTrendPopularityModel2.getModelTitle();
if (modelTitle == null) {
modelTitle = "";
}
commonTitleView.a(modelTitle, "查看榜单");
((DuImageLoaderView) _$_findCachedViewById(R.id.popularityBg)).i("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/dynamic/bg_channel_trend_popularity_default.webp").p0(DuScaleType.FIT_XY).c0(c.e(c.f40324a, Color.parseColor("#3E3E41"), i.f36333a, 0, null, null, 30)).x();
Pair[] pairArr = {new Pair(_$_findCachedViewById(R.id.popularityProductItem1), Integer.valueOf((int) R.drawable.ic_channel_trend_popularity_rank_top1)), new Pair(_$_findCachedViewById(R.id.popularityProductItem2), Integer.valueOf((int) R.drawable.ic_channel_trend_popularity_rank_top2)), new Pair(_$_findCachedViewById(R.id.popularityProductItem3), Integer.valueOf((int) R.drawable.ic_channel_trend_popularity_rank_top3))};
int i3 = 0;
int i12 = 0;
while (i3 < 3) {
Pair pair = pairArr[i3];
int i13 = i12 + 1;
View view = (View) pair.component1();
int intValue = ((Number) pair.component2()).intValue();
List<ChannelTrendPopularityItemModel> infos = channelTrendPopularityModel2.getInfos();
ChannelTrendPopularityItemModel channelTrendPopularityItemModel = infos != null ? (ChannelTrendPopularityItemModel) CollectionsKt___CollectionsKt.getOrNull(infos, i12) : null;
view.setVisibility(channelTrendPopularityItemModel != null ? 0 : 8);
if (channelTrendPopularityItemModel != null) {
ProductImageLoaderView productImageLoaderView = (ProductImageLoaderView) view.findViewById(R.id.popularityProductImg);
String singleImgUrl = channelTrendPopularityItemModel.getSingleImgUrl();
if (singleImgUrl == null) {
singleImgUrl = "";
}
co.c a5 = g.a(productImageLoaderView.i(singleImgUrl).d0(300), DrawableScale.ProductList);
float f12 = (float) R$styleable.AppCompatTheme_textAppearanceSmallPopupMenu;
((co.c) a5.v(new d(b.b(f12), b.b(f12)))).x();
((FontText) view.findViewById(R.id.popularityProductPrice)).c(k.g(channelTrendPopularityItemModel.getPrice(), false, null, 3), 10, 12);
cp.b.k((ImageView) view.findViewById(R.id.popularityRank), intValue);
ViewExtensionKt.e(view, 0, new ChannelTrendPopularityView$onBind$$inlined$forEachIndexed$lambda$1(channelTrendPopularityItemModel, this, channelTrendPopularityModel2), 1);
AppCompatTextView appCompatTextView = (AppCompatTextView) view.findViewById(R.id.popularityHotSellCount);
OneShotPreDrawListener.add(appCompatTextView, new l(appCompatTextView, view, channelTrendPopularityItemModel));
}
i3++;
i12 = i13;
i = R.id.popularityTitleView;
}
((CommonTitleView) _$_findCachedViewById(i)).setClickCallBack(new ChannelTrendPopularityView$onBind$2(this, channelTrendPopularityModel2));
}
}
@Override // com.shizhuang.duapp.modules.du_mall_common.utils.exposure.ModuleChildBoundExposureCallback
public void getExposureBound(@NotNull Rect rect) {
if (!PatchProxy.proxy(new Object[]{rect}, this, changeQuickRedirect, false, 212013, new Class[]{Rect.class}, Void.TYPE).isSupported) {
ViewExtensionKt.j((DuImageLoaderView) _$_findCachedViewById(R.id.popularityBg), this, rect);
}
}
@Override // com.shizhuang.duapp.common.component.module.AbsModuleView
public int getLayoutId() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 212008, new Class[0], Integer.TYPE);
return proxy.isSupported ? ((Integer) proxy.result).intValue() : R.layout.layout_mall_channel_trend_popularity;
}
@Override // com.shizhuang.duapp.modules.du_mall_common.utils.exposure.callback.IMallViewExposureObserver
public void onExposure() {
ChannelComponentItemModel channelComponentItemModel;
ChannelTrendPopularityModel channelTrendPopularityModel;
List<ChannelTrendPopularityItemModel> infos;
ChannelComponentItemModel channelComponentItemModel2;
ChannelTrendPopularityModel channelTrendPopularityModel2;
if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 212010, new Class[0], Void.TYPE).isSupported) {
if (!(PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 212012, new Class[0], Void.TYPE).isSupported || (channelComponentItemModel2 = (ChannelComponentItemModel) getData()) == null || (channelTrendPopularityModel2 = (ChannelTrendPopularityModel) channelComponentItemModel2.getData()) == null)) {
BaseChannelView.k(this, null, channelTrendPopularityModel2.getTrack(), 1, null);
}
if (!(PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 212011, new Class[0], Void.TYPE).isSupported || (channelComponentItemModel = (ChannelComponentItemModel) getData()) == null || (channelTrendPopularityModel = (ChannelTrendPopularityModel) channelComponentItemModel.getData()) == null || (infos = channelTrendPopularityModel.getInfos()) == null)) {
ArrayList arrayList = new ArrayList();
int i = 0;
for (T t : infos) {
int i3 = i + 1;
if (i < 0) {
CollectionsKt__CollectionsKt.throwIndexOverflow();
}
if (i <= 2) {
arrayList.add(t);
}
i = i3;
}
Iterator it2 = arrayList.iterator();
while (it2.hasNext()) {
BaseChannelView.k(this, null, ((ChannelTrendPopularityItemModel) it2.next()).getTrack(), 1, null);
}
}
}
}
@JvmOverloads
public ChannelTrendPopularityView(@NotNull Context context, @Nullable AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
}
}