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


package com.shizhuang.duapp.modules.live.anchor.livecenter.activity.fans.view;

import a1.a;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.flyco.tablayout.listener.OnTabSelectListener;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.sensorsdata.analytics.android.sdk.SensorsDataAutoTrackHelper;
import com.shizhuang.duapp.R;
import o5.i;
import os.b;

public class SlidingTabLayout extends HorizontalScrollView {
    private static int TABVIEW_POSITION_TAG_KEY;
    public static ChangeQuickRedirect changeQuickRedirect;
    public boolean A;
    public int B;
    public float C;
    public int D;
    public int E;
    public float F;
    public float G;
    public float H;
    public int I;
    public int J;
    public boolean K;
    public boolean L;
    public int M;
    public float N;
    public Paint O;
    public OnTabSelectListener P;
    public Context b;

    /* renamed from: c */
    public String[] f17487c;
    public LinearLayout d;
    public int e;
    public int f;

    /* renamed from: g */
    public Rect f17488g;

    /* renamed from: h */
    public Rect f17489h;
    public GradientDrawable i;
    public Paint j;
    public Paint k;
    public Paint l;
    public Path m;
    public int n;
    public float o;
    public boolean p;

    /* renamed from: q */
    public float f17490q;
    public int r;
    public float s;
    public float t;

    /* renamed from: u */
    public float f17491u;

    /* renamed from: v */
    public float f17492v;
    public float w;
    public float x;
    public float y;
    public int z;

    public interface CustomTabProvider {
        View getCustomTabView(ViewGroup viewGroup, int i);

        void tabSelect(View view);

        void tabUnselect(View view);
    }

    public SlidingTabLayout(Context context) {
        this(context, null, 0);
    }

    public static /* synthetic */ void a(SlidingTabLayout slidingTabLayout, View view, View view2) {
        int i3 = 0;
        if (!PatchProxy.proxy(new Object[]{view, view2}, slidingTabLayout, changeQuickRedirect, false, 179913, new Class[]{View.class, View.class}, Void.TYPE).isSupported) {
            if (view.getTag(TABVIEW_POSITION_TAG_KEY) != null) {
                i3 = ((Integer) view.getTag(TABVIEW_POSITION_TAG_KEY)).intValue();
            }
            if (slidingTabLayout.e != i3) {
                OnTabSelectListener onTabSelectListener = slidingTabLayout.P;
                if (onTabSelectListener != null) {
                    onTabSelectListener.onTabSelect(i3);
                    slidingTabLayout.P.onTabReselect(slidingTabLayout.e);
                }
                slidingTabLayout.e = i3;
            }
            slidingTabLayout.g(slidingTabLayout.e);
            SensorsDataAutoTrackHelper.trackViewOnClick(view2);
        }
    }

    public final void b() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179853, new Class[0], Void.TYPE).isSupported) {
            View childAt = this.d.getChildAt(this.e);
            float left = (float) childAt.getLeft();
            float right = (float) childAt.getRight();
            if (this.n == 0 && this.A) {
                this.O.setTextSize(this.H);
                this.N = ((right - left) - this.O.measureText(((TextView) childAt.findViewById(R.id.tv_tab_title)).getText().toString())) / 2.0f;
            }
            int i3 = this.e;
            if (i3 < this.f - 1) {
                View childAt2 = this.d.getChildAt(i3 + 1);
                float left2 = (float) childAt2.getLeft();
                float right2 = (float) childAt2.getRight();
                left = a.b(left2, left, i.f36333a, left);
                right = a.b(right2, right, i.f36333a, right);
                if (this.n == 0 && this.A) {
                    this.O.setTextSize(this.H);
                    float f12 = this.N;
                    this.N = a.b(((right2 - left2) - this.O.measureText(((TextView) childAt2.findViewById(R.id.tv_tab_title)).getText().toString())) / 2.0f, f12, i.f36333a, f12);
                }
            }
            Rect rect = this.f17488g;
            int i12 = (int) left;
            rect.left = i12;
            int i13 = (int) right;
            rect.right = i13;
            if (this.n == 0 && this.A) {
                float f13 = this.N;
                rect.left = (int) ((left + f13) - 1.0f);
                rect.right = (int) ((right - f13) - 1.0f);
            }
            Rect rect2 = this.f17489h;
            rect2.left = i12;
            rect2.right = i13;
            if (this.t >= i.f36333a) {
                float a5 = h.a.a((float) childAt.getWidth(), this.t, 2.0f, (float) childAt.getLeft());
                int i14 = this.e;
                if (i14 < this.f - 1) {
                    a5 += ((float) ((this.d.getChildAt(i14 + 1).getWidth() / 2) + (childAt.getWidth() / 2))) * i.f36333a;
                }
                Rect rect3 = this.f17488g;
                int i15 = (int) a5;
                rect3.left = i15;
                rect3.right = (int) (((float) i15) + this.t);
            }
        }
    }

    public int c(float f12) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 179911, new Class[]{Float.TYPE}, Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : (int) ((f12 * this.b.getResources().getDisplayMetrics().density) + 0.5f);
    }

    public TextView d(int i3) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 179902, new Class[]{Integer.TYPE}, TextView.class);
        if (proxy.isSupported) {
            return (TextView) proxy.result;
        }
        return (TextView) this.d.getChildAt(i3).findViewById(R.id.tv_tab_title);
    }

    public final void e() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179851, new Class[0], Void.TYPE).isSupported && this.f > 0) {
            int width = (int) (((float) this.d.getChildAt(this.e).getWidth()) * i.f36333a);
            int left = this.d.getChildAt(this.e).getLeft() + width;
            if (this.e > 0 || width > 0) {
                int width2 = left - ((getWidth() / 2) - getPaddingLeft());
                b();
                Rect rect = this.f17489h;
                left = a2.a.c(rect.right, rect.left, 2, width2);
            }
            if (left != this.M) {
                this.M = left;
                scrollTo(left, 0);
            }
        }
    }

    public int f(float f12) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 179912, new Class[]{Float.TYPE}, Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : (int) ((f12 * this.b.getResources().getDisplayMetrics().scaledDensity) + 0.5f);
    }

    public final void g(int i3) {
        if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 179852, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
            int i12 = 0;
            while (i12 < this.f) {
                View childAt = this.d.getChildAt(i12);
                boolean z4 = i12 == i3;
                TextView textView = (TextView) childAt.findViewById(R.id.tv_tab_title);
                if (textView != null) {
                    textView.setTextColor(z4 ? this.I : this.J);
                }
                i12++;
            }
            e();
            invalidate();
        }
    }

    public int getCurrentTab() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179879, new Class[0], Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.e;
    }

    public int getDividerColor() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179894, new Class[0], Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.E;
    }

    public float getDividerPadding() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179896, new Class[0], Float.TYPE);
        return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.G;
    }

    public float getDividerWidth() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179895, new Class[0], Float.TYPE);
        return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.F;
    }

    public int getIndicatorColor() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179884, new Class[0], Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.r;
    }

    public float getIndicatorCornerRadius() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179887, new Class[0], Float.TYPE);
        return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.f17491u;
    }

    public float getIndicatorHeight() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179885, new Class[0], Float.TYPE);
        return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.s;
    }

    public float getIndicatorMarginBottom() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179891, new Class[0], Float.TYPE);
        return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.y;
    }

    public float getIndicatorMarginLeft() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179888, new Class[0], Float.TYPE);
        return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.f17492v;
    }

    public float getIndicatorMarginRight() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179890, new Class[0], Float.TYPE);
        return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.x;
    }

    public float getIndicatorMarginTop() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179889, new Class[0], Float.TYPE);
        return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.w;
    }

    public int getIndicatorStyle() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179880, new Class[0], Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.n;
    }

    public float getIndicatorWidth() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179886, new Class[0], Float.TYPE);
        return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.t;
    }

    public int getTabCount() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179878, new Class[0], Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.f;
    }

    public float getTabPadding() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179881, new Class[0], Float.TYPE);
        return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.o;
    }

    public float getTabWidth() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179883, new Class[0], Float.TYPE);
        return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.f17490q;
    }

    public int getTextSelectColor() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179898, new Class[0], Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.I;
    }

    public int getTextUnselectColor() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179899, new Class[0], Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.J;
    }

    public float getTextsize() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179897, new Class[0], Float.TYPE);
        return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.H;
    }

    public int getUnderlineColor() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179892, new Class[0], Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.B;
    }

    public float getUnderlineHeight() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179893, new Class[0], Float.TYPE);
        return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.C;
    }

    public final void h() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179850, new Class[0], Void.TYPE).isSupported) {
            int i3 = 0;
            while (i3 < this.f17487c.length) {
                TextView textView = (TextView) this.d.getChildAt(i3).findViewById(R.id.tv_tab_title);
                if (textView != null) {
                    textView.setTextColor(i3 == this.e ? this.I : this.J);
                    textView.setTextSize(0, this.H);
                    float f12 = this.o;
                    textView.setPadding((int) f12, 0, (int) f12, 0);
                    if (this.L) {
                        textView.setText(textView.getText().toString().toUpperCase());
                    }
                    if (this.K) {
                        textView.getPaint().setFakeBoldText(this.K);
                    }
                }
                i3++;
            }
        }
    }

    public void onDraw(Canvas canvas) {
        if (!PatchProxy.proxy(new Object[]{canvas}, this, changeQuickRedirect, false, 179854, new Class[]{Canvas.class}, Void.TYPE).isSupported) {
            super.onDraw(canvas);
            if (!isInEditMode() && this.f > 0) {
                int height = getHeight();
                int paddingLeft = getPaddingLeft();
                float f12 = this.F;
                if (f12 > i.f36333a) {
                    this.k.setStrokeWidth(f12);
                    this.k.setColor(this.E);
                    for (int i3 = 0; i3 < this.f - 1; i3++) {
                        View childAt = this.d.getChildAt(i3);
                        canvas.drawLine((float) (childAt.getRight() + paddingLeft), this.G, (float) (childAt.getRight() + paddingLeft), ((float) height) - this.G, this.k);
                    }
                }
                if (this.C > i.f36333a) {
                    this.j.setColor(this.B);
                    if (this.D == 80) {
                        float f13 = (float) height;
                        canvas.drawRect((float) paddingLeft, f13 - this.C, (float) (this.d.getWidth() + paddingLeft), f13, this.j);
                    } else {
                        canvas.drawRect((float) paddingLeft, i.f36333a, (float) (this.d.getWidth() + paddingLeft), this.C, this.j);
                    }
                }
                b();
                int i12 = this.n;
                if (i12 == 1) {
                    if (this.s > i.f36333a) {
                        this.l.setColor(this.r);
                        this.m.reset();
                        float f14 = (float) height;
                        this.m.moveTo((float) (this.f17488g.left + paddingLeft), f14);
                        Path path = this.m;
                        Rect rect = this.f17488g;
                        path.lineTo((float) ((rect.right / 2) + (rect.left / 2) + paddingLeft), f14 - this.s);
                        this.m.lineTo((float) (paddingLeft + this.f17488g.right), f14);
                        this.m.close();
                        canvas.drawPath(this.m, this.l);
                    }
                } else if (i12 == 2) {
                    if (this.s < i.f36333a) {
                        this.s = (((float) height) - this.w) - this.y;
                    }
                    float f15 = this.s;
                    if (f15 > i.f36333a) {
                        float f16 = this.f17491u;
                        if (f16 < i.f36333a || f16 > f15 / 2.0f) {
                            this.f17491u = f15 / 2.0f;
                        }
                        this.i.setColor(this.r);
                        GradientDrawable gradientDrawable = this.i;
                        Rect rect2 = this.f17488g;
                        int i13 = ((int) this.f17492v) + paddingLeft + rect2.left;
                        float f17 = this.w;
                        gradientDrawable.setBounds(i13, (int) f17, (int) (((float) (paddingLeft + rect2.right)) - this.x), (int) (f17 + this.s));
                        this.i.setCornerRadius(this.f17491u);
                        this.i.draw(canvas);
                    }
                } else if (this.s > i.f36333a) {
                    this.i.setColor(this.r);
                    if (this.z == 80) {
                        GradientDrawable gradientDrawable2 = this.i;
                        Rect rect3 = this.f17488g;
                        float f18 = this.y;
                        gradientDrawable2.setBounds(((int) this.f17492v) + paddingLeft + rect3.left, (height - ((int) this.s)) - ((int) f18), (paddingLeft + rect3.right) - ((int) this.x), height - ((int) f18));
                    } else {
                        GradientDrawable gradientDrawable3 = this.i;
                        Rect rect4 = this.f17488g;
                        int i14 = ((int) this.f17492v) + paddingLeft + rect4.left;
                        float f19 = this.w;
                        gradientDrawable3.setBounds(i14, (int) f19, (paddingLeft + rect4.right) - ((int) this.x), ((int) this.s) + ((int) f19));
                    }
                    this.i.setCornerRadius(this.f17491u);
                    this.i.draw(canvas);
                }
            }
        }
    }

    public void onRestoreInstanceState(Parcelable parcelable) {
        if (!PatchProxy.proxy(new Object[]{parcelable}, this, changeQuickRedirect, false, 179910, new Class[]{Parcelable.class}, Void.TYPE).isSupported) {
            if (parcelable instanceof Bundle) {
                Bundle bundle = (Bundle) parcelable;
                this.e = bundle.getInt("mCurrentTab");
                parcelable = bundle.getParcelable("instanceState");
                if (this.e != 0 && this.d.getChildCount() > 0) {
                    g(this.e);
                    e();
                }
            }
            super.onRestoreInstanceState(parcelable);
        }
    }

    public Parcelable onSaveInstanceState() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 179909, new Class[0], Parcelable.class);
        if (proxy.isSupported) {
            return (Parcelable) proxy.result;
        }
        Bundle bundle = new Bundle();
        bundle.putParcelable("instanceState", super.onSaveInstanceState());
        bundle.putInt("mCurrentTab", this.e);
        return bundle;
    }

    public void setCurrentTab(int i3) {
        if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 179855, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
            this.e = i3;
            g(i3);
        }
    }

    public void setDividerColor(int i3) {
        if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 179870, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
            this.E = i3;
            invalidate();
        }
    }

    public void setDividerPadding(float f12) {
        if (!PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 179872, new Class[]{Float.TYPE}, Void.TYPE).isSupported) {
            this.G = (float) c(f12);
            invalidate();
        }
    }

    public void setDividerWidth(float f12) {
        if (!PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 179871, new Class[]{Float.TYPE}, Void.TYPE).isSupported) {
            this.F = (float) c(f12);
            invalidate();
        }
    }

    public void setIndicatorColor(int i3) {
        if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 179860, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
            this.r = i3;
            invalidate();
        }
    }

    public void setIndicatorCornerRadius(float f12) {
        if (!PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 179863, new Class[]{Float.TYPE}, Void.TYPE).isSupported) {
            this.f17491u = (float) c(f12);
            invalidate();
        }
    }

    public void setIndicatorGravity(int i3) {
        if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 179864, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
            this.z = i3;
            invalidate();
        }
    }

    public void setIndicatorHeight(float f12) {
        if (!PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 179861, new Class[]{Float.TYPE}, Void.TYPE).isSupported) {
            this.s = (float) c(f12);
            invalidate();
        }
    }

    public void setIndicatorStyle(int i3) {
        if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 179856, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
            this.n = i3;
            invalidate();
        }
    }

    public void setIndicatorWidth(float f12) {
        if (!PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 179862, new Class[]{Float.TYPE}, Void.TYPE).isSupported) {
            this.t = (float) c(f12);
            invalidate();
        }
    }

    public void setIndicatorWidthEqualTitle(boolean z4) {
        if (!PatchProxy.proxy(new Object[]{new Byte(z4 ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 179866, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) {
            this.A = z4;
            invalidate();
        }
    }

    public void setOnTabSelectListener(OnTabSelectListener onTabSelectListener) {
        if (!PatchProxy.proxy(new Object[]{onTabSelectListener}, this, changeQuickRedirect, false, 179908, new Class[]{OnTabSelectListener.class}, Void.TYPE).isSupported) {
            this.P = onTabSelectListener;
        }
    }

    public void setTabPadding(float f12) {
        if (!PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 179857, new Class[]{Float.TYPE}, Void.TYPE).isSupported) {
            this.o = (float) c(f12);
            h();
        }
    }

    public void setTabSpaceEqual(boolean z4) {
        if (!PatchProxy.proxy(new Object[]{new Byte(z4 ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 179858, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) {
            this.p = z4;
            h();
        }
    }

    public void setTabWidth(float f12) {
        if (!PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 179859, new Class[]{Float.TYPE}, Void.TYPE).isSupported) {
            this.f17490q = (float) c(f12);
            h();
        }
    }

    public void setTabs(String[] strArr) {
        LinearLayout.LayoutParams layoutParams;
        if (!PatchProxy.proxy(new Object[]{strArr}, this, changeQuickRedirect, false, 179848, new Class[]{String[].class}, Void.TYPE).isSupported) {
            this.d.removeAllViews();
            this.f17487c = strArr;
            this.f = strArr.length;
            for (int i3 = 0; i3 < this.f; i3++) {
                View inflate = View.inflate(this.b, R.layout.layout_tab, null);
                String str = this.f17487c[i3].toString();
                if (!PatchProxy.proxy(new Object[]{new Integer(i3), str, inflate}, this, changeQuickRedirect, false, 179849, new Class[]{Integer.TYPE, String.class, View.class}, Void.TYPE).isSupported) {
                    TextView textView = (TextView) inflate.findViewById(R.id.tv_tab_title);
                    if (!(textView == null || str == null)) {
                        textView.setText(str);
                    }
                    inflate.setTag(TABVIEW_POSITION_TAG_KEY, Integer.valueOf(i3));
                    inflate.setOnClickListener(new b(this, inflate, 2));
                    if (this.p) {
                        layoutParams = new LinearLayout.LayoutParams(0, -1, 1.0f);
                    } else {
                        layoutParams = new LinearLayout.LayoutParams(-2, -1);
                    }
                    if (this.f17490q > i.f36333a) {
                        layoutParams = new LinearLayout.LayoutParams((int) this.f17490q, -1);
                    }
                    this.d.addView(inflate, i3, layoutParams);
                }
            }
            h();
        }
    }

    public void setTextAllCaps(boolean z4) {
        if (!PatchProxy.proxy(new Object[]{new Byte(z4 ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 179877, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) {
            this.L = z4;
            h();
        }
    }

    public void setTextBold(boolean z4) {
        if (!PatchProxy.proxy(new Object[]{new Byte(z4 ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 179876, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) {
            this.K = z4;
            h();
        }
    }

    public void setTextSelectColor(int i3) {
        if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 179874, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
            this.I = i3;
            h();
        }
    }

    public void setTextUnselectColor(int i3) {
        if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 179875, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
            this.J = i3;
            h();
        }
    }

    public void setTextsize(float f12) {
        if (!PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 179873, new Class[]{Float.TYPE}, Void.TYPE).isSupported) {
            this.H = (float) f(f12);
            h();
        }
    }

    public void setUnderlineColor(int i3) {
        if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 179867, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
            this.B = i3;
            invalidate();
        }
    }

    public void setUnderlineGravity(int i3) {
        if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 179869, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
            this.D = i3;
            invalidate();
        }
    }

    public void setUnderlineHeight(float f12) {
        if (!PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 179868, new Class[]{Float.TYPE}, Void.TYPE).isSupported) {
            this.C = (float) c(f12);
            invalidate();
        }
    }

    public SlidingTabLayout(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public SlidingTabLayout(Context context, AttributeSet attributeSet, int i3) {
        super(context, attributeSet, i3);
        float f12;
        this.f17488g = new Rect();
        this.f17489h = new Rect();
        this.i = new GradientDrawable();
        this.j = new Paint(1);
        this.k = new Paint(1);
        this.l = new Paint(1);
        this.m = new Path();
        this.n = 0;
        this.O = new Paint(1);
        new SparseArray();
        setFillViewport(true);
        setWillNotDraw(false);
        setClipChildren(false);
        setClipToPadding(false);
        this.b = context;
        LinearLayout linearLayout = new LinearLayout(context);
        this.d = linearLayout;
        addView(linearLayout);
        if (!PatchProxy.proxy(new Object[]{context, attributeSet}, this, changeQuickRedirect, false, 179847, new Class[]{Context.class, AttributeSet.class}, Void.TYPE).isSupported) {
            TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, new int[]{R.attr.indicatorColor, R.attr.indicatorDrawable, R.attr.indicatorHeight, R.attr.indicatorLeftMargin, R.attr.indicatorRightMargin, R.attr.indicatorWidth, R.attr.tl_divider_color, R.attr.tl_divider_padding, R.attr.tl_divider_width, R.attr.tl_indicator_color, R.attr.tl_indicator_corner_radius, R.attr.tl_indicator_gravity, R.attr.tl_indicator_height, R.attr.tl_indicator_margin_bottom, R.attr.tl_indicator_margin_left, R.attr.tl_indicator_margin_right, R.attr.tl_indicator_margin_top, R.attr.tl_indicator_style, R.attr.tl_indicator_width, R.attr.tl_indicator_width_equal_title, R.attr.tl_tab_padding, R.attr.tl_tab_space_equal, R.attr.tl_tab_width, R.attr.tl_textAllCaps, R.attr.tl_textBold, R.attr.tl_textSelectColor, R.attr.tl_textUnselectColor, R.attr.tl_textsize, R.attr.tl_underline_color, R.attr.tl_underline_gravity, R.attr.tl_underline_height});
            int i12 = obtainStyledAttributes.getInt(17, 0);
            this.n = i12;
            this.r = obtainStyledAttributes.getColor(9, Color.parseColor(i12 == 2 ? "#4B6A87" : "#ffffff"));
            int i13 = this.n;
            if (i13 == 1) {
                f12 = 4.0f;
            } else {
                f12 = (float) (i13 == 2 ? -1 : 2);
            }
            this.s = obtainStyledAttributes.getDimension(12, (float) c(f12));
            this.t = obtainStyledAttributes.getDimension(18, (float) c(this.n == 1 ? 10.0f : -1.0f));
            this.f17491u = obtainStyledAttributes.getDimension(10, (float) c(this.n == 2 ? -1.0f : i.f36333a));
            this.f17492v = obtainStyledAttributes.getDimension(14, (float) c(i.f36333a));
            float f13 = 7.0f;
            this.w = obtainStyledAttributes.getDimension(16, (float) c(this.n == 2 ? 7.0f : i.f36333a));
            this.x = obtainStyledAttributes.getDimension(15, (float) c(i.f36333a));
            this.y = obtainStyledAttributes.getDimension(13, (float) c(this.n != 2 ? i.f36333a : f13));
            this.z = obtainStyledAttributes.getInt(11, 80);
            this.A = obtainStyledAttributes.getBoolean(19, false);
            this.B = obtainStyledAttributes.getColor(28, Color.parseColor("#ffffff"));
            this.C = obtainStyledAttributes.getDimension(30, (float) c(i.f36333a));
            this.D = obtainStyledAttributes.getInt(29, 80);
            this.E = obtainStyledAttributes.getColor(6, Color.parseColor("#ffffff"));
            this.F = obtainStyledAttributes.getDimension(8, (float) c(i.f36333a));
            this.G = obtainStyledAttributes.getDimension(7, (float) c(12.0f));
            this.H = obtainStyledAttributes.getDimension(27, (float) f(14.0f));
            this.I = obtainStyledAttributes.getColor(25, Color.parseColor("#ffffff"));
            this.J = obtainStyledAttributes.getColor(26, Color.parseColor("#AAffffff"));
            this.K = obtainStyledAttributes.getBoolean(24, false);
            this.L = obtainStyledAttributes.getBoolean(23, false);
            this.p = obtainStyledAttributes.getBoolean(21, false);
            float dimension = obtainStyledAttributes.getDimension(22, (float) c(-1.0f));
            this.f17490q = dimension;
            this.o = obtainStyledAttributes.getDimension(20, (float) ((this.p || dimension > i.f36333a) ? c(i.f36333a) : c(20.0f)));
            obtainStyledAttributes.recycle();
        }
        String attributeValue = attributeSet.getAttributeValue("http://schemas.android.com/apk/res/android", "layout_height");
        if (!attributeValue.equals("-1") && !attributeValue.equals("-2")) {
            TypedArray obtainStyledAttributes2 = context.obtainStyledAttributes(attributeSet, new int[]{16842997});
            obtainStyledAttributes2.getDimensionPixelSize(0, -2);
            obtainStyledAttributes2.recycle();
        }
    }
}