package com.bytedance.sdk.component.adexpress.ajl;

import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;

/* JADX INFO: loaded from: classes.dex */
public class lse extends FrameLayout {

    /* JADX INFO: renamed from: ef, reason: collision with root package name */
    private static final int f6445ef = (com.bytedance.sdk.component.adexpress.dynamic.jnr.ku.ro("", 0.0f, true)[1] / 2) + 1;
    private static final int vt = (com.bytedance.sdk.component.adexpress.dynamic.jnr.ku.ro("", 0.0f, true)[1] / 2) + 3;
    private Drawable ajl;
    LinearLayout fm;
    private Drawable jnr;

    /* JADX INFO: renamed from: lb, reason: collision with root package name */
    private float f6446lb;
    LinearLayout ro;
    private double wsy;
    private float wu;
    private float yz;

    public lse(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.fm = new LinearLayout(getContext());
        this.ro = new LinearLayout(getContext());
        this.fm.setOrientation(0);
        this.fm.setGravity(8388611);
        this.ro.setOrientation(0);
        this.ro.setGravity(8388611);
        this.jnr = com.bytedance.sdk.component.utils.maa.lb(context, "tt_star_thick");
        this.ajl = com.bytedance.sdk.component.utils.maa.lb(context, "tt_star");
    }

    private ImageView getStarImageView() {
        ImageView imageView = new ImageView(getContext());
        imageView.setLayoutParams(new ViewGroup.LayoutParams((int) this.f6446lb, (int) this.yz));
        imageView.setPadding(1, f6445ef, 1, vt);
        return imageView;
    }

    public void fm(double d10, int i10, int i11, int i12) {
        float f10 = i11;
        this.f6446lb = (int) com.bytedance.sdk.component.adexpress.yz.wsy.lb(getContext(), f10);
        this.yz = (int) com.bytedance.sdk.component.adexpress.yz.wsy.lb(getContext(), f10);
        this.wsy = d10;
        this.wu = i12;
        removeAllViews();
        for (int i13 = 0; i13 < 5; i13++) {
            ImageView starImageView = getStarImageView();
            starImageView.setScaleType(ImageView.ScaleType.FIT_XY);
            starImageView.setColorFilter(i10, PorterDuff.Mode.SRC_IN);
            starImageView.setImageDrawable(getStarFillDrawable());
            this.ro.addView(starImageView);
        }
        for (int i14 = 0; i14 < 5; i14++) {
            ImageView starImageView2 = getStarImageView();
            starImageView2.setScaleType(ImageView.ScaleType.FIT_XY);
            starImageView2.setImageDrawable(getStarEmptyDrawable());
            this.fm.addView(starImageView2);
        }
        addView(this.fm);
        addView(this.ro);
        requestLayout();
    }

    public Drawable getStarEmptyDrawable() {
        return this.jnr;
    }

    public Drawable getStarFillDrawable() {
        return this.ajl;
    }

    @Override // android.widget.FrameLayout, android.view.View
    public void onMeasure(int i10, int i11) {
        super.onMeasure(i10, i11);
        this.fm.measure(i10, i11);
        double d10 = this.wsy;
        float f10 = this.f6446lb;
        this.ro.measure(View.MeasureSpec.makeMeasureSpec((int) (((d10 - ((double) ((int) d10))) * ((double) (f10 - 2.0f))) + ((double) ((((int) d10) * f10) + 1.0f))), 1073741824), View.MeasureSpec.makeMeasureSpec(this.fm.getMeasuredHeight(), 1073741824));
        if (this.wu > 0.0f) {
            this.fm.setPadding(0, ((int) (r7.getMeasuredHeight() - this.wu)) / 2, 0, 0);
            this.ro.setPadding(0, ((int) (this.fm.getMeasuredHeight() - this.wu)) / 2, 0, 0);
        }
    }
}
