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


package com.shizhuang.duapp.modules.mall_seller.merchant.margin.views;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelLazy;
import cd.h;
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.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.widget.DuIconsTextView;
import com.shizhuang.duapp.modules.mall_seller.merchant.margin.helper.HalfExpandedType;
import com.shizhuang.duapp.modules.mall_seller.merchant.margin.helper.HalfExpandedUiHelper;
import com.shizhuang.duapp.modules.mall_seller.merchant.margin.model.SellerMarginModel;
import com.shizhuang.duapp.modules.mall_seller.merchant.margin.model.SellerMarginSVIPBiddingInfo;
import com.shizhuang.duapp.modules.mall_seller.merchant.margin.model.SellerMarginSVIPModel;
import com.shizhuang.duapp.modules.mall_seller.merchant.margin.viewmodel.SellerSVIPMarginViewModel;
import java.util.HashMap;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.JvmOverloads;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Reflection;
import mn.a;
import o5.i;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import qu0.e;

@Metadata(bv = {}, d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0004\u0018\u00002\u00020\u00012\u00020\u0002B)\b\u0007\u0012\b\u0010\n\u001a\u0004\u0018\u00010\t\u0012\n\b\u0002\u0010\f\u001a\u0004\u0018\u00010\u000b\u0012\b\b\u0002\u0010\u000e\u001a\u00020\r¢\u0006\u0004\b\u000f\u0010\u0010R\u001b\u0010\b\u001a\u00020\u00038BX‚„\u0002¢\u0006\f\n\u0004\b\u0004\u0010\u0005\u001a\u0004\b\u0006\u0010\u0007¨\u0006\u0011"}, d2 = {"Lcom/shizhuang/duapp/modules/mall_seller/merchant/margin/views/SellerSVIPMarginHeadView;", "Landroidx/constraintlayout/widget/ConstraintLayout;", "Lcom/shizhuang/duapp/modules/mall_seller/merchant/margin/helper/HalfExpandedUiHelper$OnHalfExpandedUiCallback;", "Lcom/shizhuang/duapp/modules/mall_seller/merchant/margin/viewmodel/SellerSVIPMarginViewModel;", "b", "Lkotlin/Lazy;", "getViewModel", "()Lcom/shizhuang/duapp/modules/mall_seller/merchant/margin/viewmodel/SellerSVIPMarginViewModel;", "viewModel", "Landroid/content/Context;", "context", "Landroid/util/AttributeSet;", "attrs", "", "defStyleAttr", "<init>", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "du_mall_seller_release"}, k = 1, mv = {1, 4, 2})
/* compiled from: SellerSVIPMarginHeadView.kt */
public final class SellerSVIPMarginHeadView extends ConstraintLayout implements HalfExpandedUiHelper.OnHalfExpandedUiCallback {
    public static ChangeQuickRedirect changeQuickRedirect;
    public final Lazy b;

    /* renamed from: c  reason: collision with root package name */
    public HashMap f20388c;

    @JvmOverloads
    public SellerSVIPMarginHeadView(@Nullable Context context) {
        this(context, null, 0);
    }

    private final SellerSVIPMarginViewModel getViewModel() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 228093, new Class[0], SellerSVIPMarginViewModel.class);
        return (SellerSVIPMarginViewModel) (proxy.isSupported ? proxy.result : this.b.getValue());
    }

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

    @Override // com.shizhuang.duapp.modules.mall_seller.merchant.margin.helper.HalfExpandedUiHelper.OnHalfExpandedUiCallback
    public void onSlide(@NotNull View view, float f) {
        boolean z = PatchProxy.proxy(new Object[]{view, new Float(f)}, this, changeQuickRedirect, false, 228096, new Class[]{View.class, Float.TYPE}, Void.TYPE).isSupported;
    }

    @Override // com.shizhuang.duapp.modules.mall_seller.merchant.margin.helper.HalfExpandedUiHelper.OnHalfExpandedUiCallback
    public void onStateChanged(@NotNull View view, @NotNull HalfExpandedType halfExpandedType) {
        SellerMarginSVIPModel svipInfo;
        SellerMarginSVIPBiddingInfo biddingInfo;
        if (!PatchProxy.proxy(new Object[]{view, halfExpandedType}, this, changeQuickRedirect, false, 228095, new Class[]{View.class, HalfExpandedType.class}, Void.TYPE).isSupported) {
            SellerSVIPMarginHeadView$onStateChanged$1 sellerSVIPMarginHeadView$onStateChanged$1 = new SellerSVIPMarginHeadView$onStateChanged$1(this);
            int i = e.f37537a[halfExpandedType.ordinal()];
            float f = i.f36333a;
            if (i == 1) {
                sellerSVIPMarginHeadView$onStateChanged$1.invoke(i.f36333a);
            } else if (i == 2) {
                SellerMarginModel value = getViewModel().getHeaderLiveData().getValue();
                if (!(value == null || (svipInfo = value.getSvipInfo()) == null || (biddingInfo = svipInfo.getBiddingInfo()) == null)) {
                    f = biddingInfo.getBiddingUseCountProgress();
                }
                sellerSVIPMarginHeadView$onStateChanged$1.invoke(f);
            }
        }
    }

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

    @JvmOverloads
    public SellerSVIPMarginHeadView(@Nullable Context context, @Nullable AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        AppCompatActivity g3 = ViewExtensionKt.g(this);
        this.b = new ViewModelLazy(Reflection.getOrCreateKotlinClass(SellerSVIPMarginViewModel.class), new SellerSVIPMarginHeadView$$special$$inlined$activityViewModels$2(g3), new SellerSVIPMarginHeadView$$special$$inlined$activityViewModels$1(g3));
        ViewExtensionKt.v(this, R.layout.activity_seller_svip_margin_head, true);
        ((DuRequestOptions) a.f35714a.g("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/merchant/img_svipcard.png").u(new Function1<Bitmap, Unit>(this) {
            /* class com.shizhuang.duapp.modules.mall_seller.merchant.margin.views.SellerSVIPMarginHeadView.AnonymousClass1 */
            public static ChangeQuickRedirect changeQuickRedirect;
            public final /* synthetic */ SellerSVIPMarginHeadView this$0;

            {
                this.this$0 = r1;
            }

            /* Return type fixed from 'java.lang.Object' to match base method */
            /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
            @Override // kotlin.jvm.functions.Function1
            public /* bridge */ /* synthetic */ Unit invoke(Bitmap bitmap) {
                invoke(bitmap);
                return Unit.INSTANCE;
            }

            public final void invoke(@NotNull Bitmap bitmap) {
                if (!PatchProxy.proxy(new Object[]{bitmap}, this, changeQuickRedirect, false, 228101, new Class[]{Bitmap.class}, Void.TYPE).isSupported) {
                    ((ConstraintLayout) this.this$0.a(R.id.clContentHead)).setBackground(new BitmapDrawable(this.this$0.getResources(), bitmap));
                }
            }
        })).G(h.f(this)).y();
        ((DuImageLoaderView) a(R.id.ivTitle)).i("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/merchant/Frame%2015129@3x.png").x();
        ((DuImageLoaderView) a(R.id.ivSVIPInfoTitle)).i("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/merchant/icon_switch_camera_line.png").x();
        getViewModel().getHeaderLiveData().observe(h.f(this), new Observer<SellerMarginModel>(this) {
            /* class com.shizhuang.duapp.modules.mall_seller.merchant.margin.views.SellerSVIPMarginHeadView.AnonymousClass2 */
            public static ChangeQuickRedirect changeQuickRedirect;
            public final /* synthetic */ SellerSVIPMarginHeadView b;

            {
                this.b = r1;
            }

            /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
            @Override // androidx.lifecycle.Observer
            public void onChanged(SellerMarginModel sellerMarginModel) {
                SellerMarginSVIPBiddingInfo biddingInfo;
                SellerMarginModel sellerMarginModel2 = sellerMarginModel;
                if (!PatchProxy.proxy(new Object[]{sellerMarginModel2}, this, changeQuickRedirect, false, 228102, new Class[]{SellerMarginModel.class}, Void.TYPE).isSupported && sellerMarginModel2 != null) {
                    SellerSVIPMarginHeadView sellerSVIPMarginHeadView = this.b;
                    if (!PatchProxy.proxy(new Object[]{sellerMarginModel2}, sellerSVIPMarginHeadView, SellerSVIPMarginHeadView.changeQuickRedirect, false, 228094, new Class[]{SellerMarginModel.class}, Void.TYPE).isSupported) {
                        FontText fontText = (FontText) sellerSVIPMarginHeadView.a(R.id.tvAmount);
                        String amount = sellerMarginModel2.getAmount();
                        String str = "";
                        if (amount == null) {
                            amount = str;
                        }
                        fontText.c(amount, 26, 36);
                        ((TextView) sellerSVIPMarginHeadView.a(R.id.tvAmountTitle)).setText(sellerMarginModel2.getAmountText());
                        FontText fontText2 = (FontText) sellerSVIPMarginHeadView.a(R.id.tvFrozenAmount);
                        String frozenAmount = sellerMarginModel2.getFrozenAmount();
                        if (frozenAmount == null) {
                            frozenAmount = str;
                        }
                        fontText2.c(frozenAmount, 14, 14);
                        ((TextView) sellerSVIPMarginHeadView.a(R.id.tvFrozenAmountTitle)).setText(sellerMarginModel2.getFrozenAmountText());
                        FontText fontText3 = (FontText) sellerSVIPMarginHeadView.a(R.id.tvCanUseAmount);
                        String canUseAmount = sellerMarginModel2.getCanUseAmount();
                        if (canUseAmount != null) {
                            str = canUseAmount;
                        }
                        fontText3.c(str, 14, 14);
                        ((TextView) sellerSVIPMarginHeadView.a(R.id.tvCanUseAmountTitle)).setText(sellerMarginModel2.getCanUseAmountText());
                        SellerMarginSVIPModel svipInfo = sellerMarginModel2.getSvipInfo();
                        if (svipInfo != null && (biddingInfo = svipInfo.getBiddingInfo()) != null) {
                            ((TextView) sellerSVIPMarginHeadView.a(R.id.tvSVIPInfoTitle)).setText(biddingInfo.getTitle());
                            ((DuIconsTextView) sellerSVIPMarginHeadView.a(R.id.tvSVIPBiddingInfoTitle)).setText(biddingInfo.getRedirectText());
                            ViewExtensionKt.j((DuIconsTextView) sellerSVIPMarginHeadView.a(R.id.tvSVIPBiddingInfoTitle), 0, new SellerSVIPMarginHeadView$renderView$$inlined$let$lambda$1(biddingInfo, sellerSVIPMarginHeadView), 1);
                            ((TextView) sellerSVIPMarginHeadView.a(R.id.tvUseCount)).setText(biddingInfo.getBiddingUseCountText());
                            ((TextView) sellerSVIPMarginHeadView.a(R.id.tvCanUseCount)).setText(biddingInfo.getBiddingCanUseText());
                        }
                    }
                }
            }
        });
    }
}