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


package com.shizhuang.duapp.modules.productv2.brand.views;

import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelLazy;
import co.c;
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.component.module.AbsModuleView;
import com.shizhuang.duapp.common.extension.ViewExtensionKt;
import com.shizhuang.duapp.common.widget.font.FontText;
import com.shizhuang.duapp.libs.duimageloaderview.DuImageLoaderView;
import com.shizhuang.duapp.libs.duimageloaderview.options.DuRequestOptions;
import com.shizhuang.duapp.modules.du_mall_common.utils.exposure.callback.IMallViewExposureObserver;
import com.shizhuang.duapp.modules.productv2.brand.model.BrandCouponModel;
import com.shizhuang.duapp.modules.productv2.brand.model.BrandSubCouponModel;
import com.shizhuang.duapp.modules.productv2.brand.vm.BrandCoverViewModelV2;
import com.shizhuang.duapp.modules.productv2.model.BrandActivityTabInfo;
import com.shizhuang.duapp.modules.productv2.model.BrandDetailBasicInfo;
import com.shizhuang.duapp.modules.productv2.model.BrandHasOtherTabInfo;
import com.shizhuang.duapp.modules.productv2.model.BrandPersonInfoModel;
import com.shizhuang.duapp.modules.router.ServiceManager;
import fi.b;
import j60.z;
import java.util.HashMap;
import java.util.List;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.jvm.JvmOverloads;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import mn.a;
import n31.h;
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\u0010\b\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0006\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u00012\u00020\u0003J\b\u0010\u0005\u001a\u00020\u0004H\u0016J\u000e\u0010\t\u001a\u00020\b2\u0006\u0010\u0007\u001a\u00020\u0006J\u0006\u0010\n\u001a\u00020\u0006R\u001b\u0010\u0010\u001a\u00020\u000b8BX‚„\u0002¢\u0006\f\n\u0004\b\f\u0010\r\u001a\u0004\b\u000e\u0010\u000fR\u0019\u0010\u0016\u001a\u0004\u0018\u00010\u00118\u0006¢\u0006\f\n\u0004\b\u0012\u0010\u0013\u001a\u0004\b\u0014\u0010\u0015R\u0019\u0010\u001c\u001a\u0004\u0018\u00010\u00178\u0006¢\u0006\f\n\u0004\b\u0018\u0010\u0019\u001a\u0004\b\u001a\u0010\u001b¨\u0006\u001d"}, d2 = {"Lcom/shizhuang/duapp/modules/productv2/brand/views/BrandClimatePersonInfoViewForActivity;", "Lcom/shizhuang/duapp/common/component/module/AbsModuleView;", "Lcom/shizhuang/duapp/modules/productv2/model/BrandPersonInfoModel;", "Lcom/shizhuang/duapp/modules/du_mall_common/utils/exposure/callback/IMallViewExposureObserver;", "", "getLayoutId", "", "isBrandFavorite", "", "setBranFavoriteState", "getBrandFavoriteStatus", "Lcom/shizhuang/duapp/modules/productv2/brand/vm/BrandCoverViewModelV2;", "e", "Lkotlin/Lazy;", "getViewModel", "()Lcom/shizhuang/duapp/modules/productv2/brand/vm/BrandCoverViewModelV2;", "viewModel", "Lcom/shizhuang/duapp/modules/productv2/brand/views/IBrandSubscribeListener;", "i", "Lcom/shizhuang/duapp/modules/productv2/brand/views/IBrandSubscribeListener;", "getListener", "()Lcom/shizhuang/duapp/modules/productv2/brand/views/IBrandSubscribeListener;", "listener", "Landroidx/fragment/app/Fragment;", "j", "Landroidx/fragment/app/Fragment;", "getFragment", "()Landroidx/fragment/app/Fragment;", "fragment", "du_product_release"}, k = 1, mv = {1, 4, 2})
/* compiled from: BrandClimatePersonInfoViewForActivity.kt */
public final class BrandClimatePersonInfoViewForActivity extends AbsModuleView<BrandPersonInfoModel> implements IMallViewExposureObserver {
    public static ChangeQuickRedirect changeQuickRedirect;
    public long b;

    /* renamed from: c  reason: collision with root package name */
    public boolean f23251c;
    public boolean d;
    public final Lazy e;
    public int f;

    /* renamed from: g  reason: collision with root package name */
    public int f23252g;

    /* renamed from: h  reason: collision with root package name */
    public long f23253h;
    @Nullable
    public final IBrandSubscribeListener i;
    @Nullable
    public final Fragment j;
    public HashMap k;

    @JvmOverloads
    public BrandClimatePersonInfoViewForActivity(@NotNull Context context) {
        this(context, null, 0, null, null, 30);
    }

    @JvmOverloads
    public BrandClimatePersonInfoViewForActivity(@NotNull Context context, @Nullable AttributeSet attributeSet) {
        this(context, attributeSet, 0, null, null, 28);
    }

    @JvmOverloads
    public BrandClimatePersonInfoViewForActivity(@NotNull Context context, @Nullable AttributeSet attributeSet, int i3) {
        this(context, attributeSet, i3, null, null, 24);
    }

    /* JADX WARNING: Illegal instructions before constructor call */
    public BrandClimatePersonInfoViewForActivity(Context context, AttributeSet attributeSet, int i3, IBrandSubscribeListener iBrandSubscribeListener, Fragment fragment, int i12) {
        super(context, attributeSet, i3);
        attributeSet = (i12 & 2) != 0 ? null : attributeSet;
        i3 = (i12 & 4) != 0 ? 0 : i3;
        fragment = (i12 & 16) != 0 ? null : fragment;
        this.i = null;
        this.j = fragment;
        AppCompatActivity g3 = ViewExtensionKt.g(this);
        this.e = new ViewModelLazy(Reflection.getOrCreateKotlinClass(BrandCoverViewModelV2.class), new BrandClimatePersonInfoViewForActivity$$special$$inlined$activityViewModels$2(g3), new BrandClimatePersonInfoViewForActivity$$special$$inlined$activityViewModels$1(g3));
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 288590, new Class[0], Void.TYPE).isSupported && fragment != null) {
            ((DuRequestOptions) a.f35714a.g("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/product/brand_subscribe_new_success.png").v(h.f35873a.c())).G(fragment).y();
        }
    }

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

    public final boolean getBrandFavoriteStatus() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 288592, new Class[0], Boolean.TYPE);
        return proxy.isSupported ? ((Boolean) proxy.result).booleanValue() : this.d;
    }

    @Nullable
    public final Fragment getFragment() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 288604, new Class[0], Fragment.class);
        return proxy.isSupported ? (Fragment) proxy.result : this.j;
    }

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

    @Nullable
    public final IBrandSubscribeListener getListener() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 288603, new Class[0], IBrandSubscribeListener.class);
        return proxy.isSupported ? (IBrandSubscribeListener) proxy.result : this.i;
    }

    public final BrandCoverViewModelV2 getViewModel() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 288587, new Class[0], BrandCoverViewModelV2.class);
        return (BrandCoverViewModelV2) (proxy.isSupported ? proxy.result : this.e.getValue());
    }

    @Override // com.shizhuang.duapp.modules.du_mall_common.utils.exposure.callback.IMallViewExposureObserver
    public void onExposure() {
        String str;
        BrandActivityTabInfo activityTabInfo;
        String activityId;
        BrandActivityTabInfo activityTabInfo2;
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 288602, new Class[0], Void.TYPE).isSupported) {
            if (this.d) {
                str = "已订阅";
            } else {
                str = this.f23251c ? "订阅有礼" : "订阅";
            }
            i60.a aVar = i60.a.f33292a;
            Long valueOf = Long.valueOf(this.b);
            BrandHasOtherTabInfo value = getViewModel().r().getValue();
            String tabName = (value == null || (activityTabInfo2 = value.getActivityTabInfo()) == null) ? null : activityTabInfo2.getTabName();
            String str2 = "";
            String str3 = tabName != null ? tabName : str2;
            BrandHasOtherTabInfo value2 = getViewModel().r().getValue();
            if (!(value2 == null || (activityTabInfo = value2.getActivityTabInfo()) == null || (activityId = activityTabInfo.getActivityId()) == null)) {
                str2 = activityId;
            }
            aVar.l0(str2, str3, valueOf, str, getViewModel().getSource(), "活动");
        }
    }

    public final void setBranFavoriteState(boolean z) {
        int i3 = 0;
        if (!PatchProxy.proxy(new Object[]{new Byte(z ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 288591, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) {
            boolean areEqual = Intrinsics.areEqual(getViewModel().D(), Boolean.FALSE);
            this.d = z;
            this.f23251c = !z && areEqual;
            ((AppCompatTextView) _$_findCachedViewById(R.id.brandUserCoupon)).setVisibility(this.f23251c ? 0 : 8);
            ImageView imageView = (ImageView) _$_findCachedViewById(R.id.brandFavoriteTips);
            if (!(!z ? 1 : 0)) {
                i3 = 8;
            }
            imageView.setVisibility(i3);
            if (z) {
                ((FontText) _$_findCachedViewById(R.id.brandFavoriteBtn)).setText("已订阅");
                ((LinearLayout) _$_findCachedViewById(R.id.llBrandFavorite)).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.bg_brand_selection_favorite_radius));
                ((FontText) _$_findCachedViewById(R.id.brandFavoriteBtn)).setTextColor(Color.parseColor("#7F7F8E"));
                FontText fontText = (FontText) _$_findCachedViewById(R.id.brandFavoriteBtn);
                ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) fontText.getLayoutParams();
                float f12 = (float) 10;
                marginLayoutParams.leftMargin = b.b(f12);
                marginLayoutParams.rightMargin = b.b(f12);
                fontText.setLayoutParams(marginLayoutParams);
            } else {
                ((FontText) _$_findCachedViewById(R.id.brandFavoriteBtn)).setText("订阅");
                ((LinearLayout) _$_findCachedViewById(R.id.llBrandFavorite)).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.bg_brand_un_selection_favorite_radius));
                ((FontText) _$_findCachedViewById(R.id.brandFavoriteBtn)).setTextColor(Color.parseColor("#FFFFFF"));
                FontText fontText2 = (FontText) _$_findCachedViewById(R.id.brandFavoriteBtn);
                ViewGroup.MarginLayoutParams marginLayoutParams2 = (ViewGroup.MarginLayoutParams) fontText2.getLayoutParams();
                marginLayoutParams2.setMarginStart(b.b((float) 4));
                marginLayoutParams2.setMarginEnd(b.b((float) 10));
                fontText2.setLayoutParams(marginLayoutParams2);
            }
            ViewExtensionKt.j((LinearLayout) _$_findCachedViewById(R.id.llBrandFavorite), 0, new BrandClimatePersonInfoViewForActivity$setBranFavoriteState$3(this, z), 1);
        }
    }

    /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
    /* JADX WARNING: Removed duplicated region for block: B:41:0x0140  */
    /* JADX WARNING: Removed duplicated region for block: B:42:0x0143  */
    /* JADX WARNING: Removed duplicated region for block: B:51:0x0170  */
    /* JADX WARNING: Removed duplicated region for block: B:54:0x0185  */
    @Override // com.shizhuang.duapp.common.component.module.IModuleView, com.shizhuang.duapp.common.component.module.AbsModuleView
    public void update(BrandPersonInfoModel brandPersonInfoModel) {
        boolean z;
        String brandPostCountText;
        BrandSubCouponModel brandSubCouponModel;
        List<BrandCouponModel> brandCouponModels;
        BrandCouponModel brandCouponModel;
        BrandPersonInfoModel brandPersonInfoModel2 = brandPersonInfoModel;
        if (!PatchProxy.proxy(new Object[]{brandPersonInfoModel2}, this, changeQuickRedirect, false, 288589, new Class[]{BrandPersonInfoModel.class}, Void.TYPE).isSupported) {
            super.update(brandPersonInfoModel2);
            BrandDetailBasicInfo brandDetailBasicInfo = brandPersonInfoModel2.getBrandDetailBasicInfo();
            if (brandDetailBasicInfo != null) {
                z.b.a((ConstraintLayout) _$_findCachedViewById(R.id.coverBrandDetailParent), b.b((float) 2), Integer.valueOf(Color.parseColor("#33E9E9EC")));
                this.b = brandDetailBasicInfo.getBrandId();
                this.f23252g = brandPersonInfoModel2.getNumInterval();
                this.f = brandPersonInfoModel2.getDaysInterval();
                this.f23253h = brandPersonInfoModel2.getServerTime();
                FontText fontText = (FontText) _$_findCachedViewById(R.id.brandName);
                String brandName = brandDetailBasicInfo.getBrandName();
                String str = "";
                if (brandName == null) {
                    brandName = str;
                }
                fontText.setText(brandName);
                DuImageLoaderView duImageLoaderView = (DuImageLoaderView) _$_findCachedViewById(R.id.brandLogo);
                String brandLogo = brandDetailBasicInfo.getBrandLogo();
                if (brandLogo == null) {
                    brandLogo = str;
                }
                float f12 = (float) 68;
                ((c) duImageLoaderView.i(brandLogo).v(new d(b.b(f12), b.b(f12)))).x();
                ((AppCompatTextView) _$_findCachedViewById(R.id.brandProductTitle)).setText(getContext().getString(R.string.pd_brand_of_spu_count, Integer.valueOf(brandDetailBasicInfo.getBrandOfSpuCount())));
                int i3 = 8;
                ((AppCompatTextView) _$_findCachedViewById(R.id.brandProductTitle)).setVisibility(brandDetailBasicInfo.getBrandOfSpuCount() > 0 ? 0 : 8);
                ((AppCompatTextView) _$_findCachedViewById(R.id.brandUserFavorite)).setText(brandDetailBasicInfo.getBrandSpuUserFavoriteCountText());
                AppCompatTextView appCompatTextView = (AppCompatTextView) _$_findCachedViewById(R.id.brandUserFavorite);
                String brandSpuUserFavoriteCountText = brandDetailBasicInfo.getBrandSpuUserFavoriteCountText();
                appCompatTextView.setVisibility((brandSpuUserFavoriteCountText == null || brandSpuUserFavoriteCountText.length() == 0) ^ true ? 0 : 8);
                View _$_findCachedViewById = _$_findCachedViewById(R.id.brandProductSplit);
                if (!(((AppCompatTextView) _$_findCachedViewById(R.id.brandUserFavorite)).getVisibility() == 8)) {
                    if (!(((AppCompatTextView) _$_findCachedViewById(R.id.brandProductTitle)).getVisibility() == 8)) {
                        z = false;
                        _$_findCachedViewById.setVisibility(!z ? 8 : 0);
                        ((AppCompatTextView) _$_findCachedViewById(R.id.brandUserSubscribe)).setText(brandDetailBasicInfo.getBrandPostCountText());
                        AppCompatTextView appCompatTextView2 = (AppCompatTextView) _$_findCachedViewById(R.id.brandUserSubscribe);
                        brandPostCountText = brandDetailBasicInfo.getBrandPostCountText();
                        if (true ^ (brandPostCountText != null || brandPostCountText.length() == 0)) {
                            i3 = 0;
                        }
                        appCompatTextView2.setVisibility(i3);
                        setBranFavoriteState(getViewModel().L());
                        if (brandDetailBasicInfo.isFavorite()) {
                            ServiceManager.w().allTaskReport(getContext(), "brandSubscribe", str);
                        }
                        brandSubCouponModel = brandPersonInfoModel2.getBrandSubCouponModel();
                        if (brandSubCouponModel != null && (brandCouponModels = brandSubCouponModel.getBrandCouponModels()) != null && (brandCouponModel = (BrandCouponModel) CollectionsKt___CollectionsKt.getOrNull(brandCouponModels, 0)) != null) {
                            AppCompatTextView appCompatTextView3 = (AppCompatTextView) _$_findCachedViewById(R.id.brandUserCoupon);
                            String discountDesc = brandCouponModel.getDiscountDesc();
                            if (discountDesc != null) {
                                str = discountDesc;
                            }
                            appCompatTextView3.setText(str);
                            return;
                        }
                        return;
                    }
                }
                z = true;
                _$_findCachedViewById.setVisibility(!z ? 8 : 0);
                ((AppCompatTextView) _$_findCachedViewById(R.id.brandUserSubscribe)).setText(brandDetailBasicInfo.getBrandPostCountText());
                AppCompatTextView appCompatTextView22 = (AppCompatTextView) _$_findCachedViewById(R.id.brandUserSubscribe);
                brandPostCountText = brandDetailBasicInfo.getBrandPostCountText();
                if (true ^ (brandPostCountText != null || brandPostCountText.length() == 0)) {
                }
                appCompatTextView22.setVisibility(i3);
                setBranFavoriteState(getViewModel().L());
                if (brandDetailBasicInfo.isFavorite()) {
                }
                brandSubCouponModel = brandPersonInfoModel2.getBrandSubCouponModel();
                if (brandSubCouponModel != null) {
                }
            }
        }
    }
}