得物.apk(点击下载) / DuSlidingTabLayoutV2.java
package com.shizhuang.duapp.modules.du_community_common.widget;
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.text.TextPaint;
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 androidx.viewpager2.widget.ViewPager2;
import com.flyco.tablayout.listener.OnTabSelectListener;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.shizhuang.duapp.R;
import o5.i;
import tc.b;
public class DuSlidingTabLayoutV2 extends HorizontalScrollView {
public static ChangeQuickRedirect changeQuickRedirect;
public float A;
public int B;
public boolean C;
public boolean D;
public final int[] E;
public int F;
public float G;
public int H;
public int I;
public float J;
public float K;
public float L;
public int M;
public int N;
public int O;
public int P;
public float Q;
public float R;
public float S;
public float T;
public float U;
public int V;
public boolean W;
/* renamed from: a0 reason: collision with root package name */
public int f13145a0;
public Context b;
public int b0;
/* renamed from: c reason: collision with root package name */
public ViewPager2 f13146c;
/* renamed from: c0 reason: collision with root package name */
public ViewPager2.OnPageChangeCallback f13147c0;
public String[] d;
/* renamed from: d0 reason: collision with root package name */
public float f13148d0;
public LinearLayout e;
/* renamed from: e0 reason: collision with root package name */
public Paint f13149e0;
public int f;
public OnTabSelectListener f0;
/* renamed from: g reason: collision with root package name */
public float f13150g;
/* renamed from: h reason: collision with root package name */
public int f13151h;
public Rect i;
public Rect j;
public GradientDrawable k;
public Paint l;
public Paint m;
public Paint n;
public Path o;
public int p;
/* renamed from: q reason: collision with root package name */
public float f13152q;
public boolean r;
public float s;
public int t;
/* renamed from: u reason: collision with root package name */
public float f13153u;
/* renamed from: v reason: collision with root package name */
public float f13154v;
public float w;
public float x;
public float y;
public float z;
public interface CustomTabProvider {
View getCustomTabView(ViewGroup viewGroup, int i);
void tabSelect(View view);
void tabUnselect(View view);
}
public interface IPageAdapter {
String getPageTitle(int i);
}
public DuSlidingTabLayoutV2(Context context) {
this(context, null, 0);
}
public final void a() {
if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111850, new Class[0], Void.TYPE).isSupported) {
View childAt = this.e.getChildAt(this.f);
float left = (float) childAt.getLeft();
float right = (float) childAt.getRight();
if (this.p == 0 && this.C) {
this.f13149e0.setTextSize(this.L);
this.f13148d0 = ((right - left) - this.f13149e0.measureText(((TextView) childAt.findViewById(R.id.tv_tab_title)).getText().toString())) / 2.0f;
}
int i3 = this.f;
if (i3 < this.f13151h - 1) {
View childAt2 = this.e.getChildAt(i3 + 1);
float left2 = (float) childAt2.getLeft();
float right2 = (float) childAt2.getRight();
float f12 = this.f13150g;
left = a.b(left2, left, f12, left);
right = a.b(right2, right, f12, right);
if (this.p == 0 && this.C) {
this.f13149e0.setTextSize(this.L);
float f13 = this.f13148d0;
this.f13148d0 = a.b(((right2 - left2) - this.f13149e0.measureText(((TextView) childAt2.findViewById(R.id.tv_tab_title)).getText().toString())) / 2.0f, f13, this.f13150g, f13);
}
}
Rect rect = this.i;
int i12 = (int) left;
rect.left = i12;
int i13 = (int) right;
rect.right = i13;
if (this.p == 0 && this.C) {
float f14 = this.f13148d0;
rect.left = (int) ((left + f14) - 1.0f);
rect.right = (int) ((right - f14) - 1.0f);
}
Rect rect2 = this.j;
rect2.left = i12;
rect2.right = i13;
if (this.f13154v >= i.f36333a) {
float a5 = h.a.a((float) childAt.getWidth(), this.f13154v, 2.0f, (float) childAt.getLeft());
int i14 = this.f;
if (i14 < this.f13151h - 1) {
View childAt3 = this.e.getChildAt(i14 + 1);
a5 += this.f13150g * ((float) ((childAt3.getWidth() / 2) + (childAt.getWidth() / 2)));
}
Rect rect3 = this.i;
int i15 = (int) a5;
rect3.left = i15;
rect3.right = (int) (((float) i15) + this.f13154v);
}
}
}
public void b() {
View view;
LinearLayout.LayoutParams layoutParams;
if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111844, new Class[0], Void.TYPE).isSupported) {
this.e.removeAllViews();
String[] strArr = this.d;
this.f13151h = strArr == null ? this.f13146c.getAdapter().getItemCount() : strArr.length;
for (int i3 = 0; i3 < this.f13151h; i3++) {
if (!(this.f13146c.getAdapter() instanceof CustomTabProvider) || this.f13145a0 != i3) {
view = View.inflate(this.b, R.layout.layout_tab, null);
} else {
view = ((CustomTabProvider) this.f13146c.getAdapter()).getCustomTabView(this, i3);
}
String[] strArr2 = this.d;
String str = (strArr2 == null ? ((IPageAdapter) this.f13146c.getAdapter()).getPageTitle(i3) : strArr2[i3]).toString();
if (!PatchProxy.proxy(new Object[]{new Integer(i3), str, view}, this, changeQuickRedirect, false, 111845, new Class[]{Integer.TYPE, String.class, View.class}, Void.TYPE).isSupported) {
TextView textView = (TextView) view.findViewById(R.id.tv_tab_title);
if (!(textView == null || str == null)) {
textView.setText(str);
}
view.setOnClickListener(new b(this, i3, 1));
if (this.r) {
layoutParams = new LinearLayout.LayoutParams(0, -1, 1.0f);
} else {
layoutParams = new LinearLayout.LayoutParams(-2, -1);
}
if (this.s > i.f36333a) {
layoutParams = new LinearLayout.LayoutParams((int) this.s, -1);
}
this.e.addView(view, i3, layoutParams);
}
}
g();
}
}
public final void c() {
if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111848, new Class[0], Void.TYPE).isSupported && this.f13151h > 0) {
int width = (int) (this.f13150g * ((float) this.e.getChildAt(this.f).getWidth()));
int left = this.e.getChildAt(this.f).getLeft() + width;
if (this.f > 0 || width > 0) {
int width2 = left - ((getWidth() / 2) - getPaddingLeft());
a();
Rect rect = this.j;
left = a2.a.c(rect.right, rect.left, 2, width2);
}
if (left != this.b0) {
this.b0 = left;
scrollTo(left, 0);
}
}
}
public void d(int i3, boolean z4) {
if (!PatchProxy.proxy(new Object[]{new Integer(i3), new Byte(z4 ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 111853, new Class[]{Integer.TYPE, Boolean.TYPE}, Void.TYPE).isSupported) {
this.f = i3;
this.f13146c.setCurrentItem(i3, z4);
f(i3);
}
}
public void e(ViewPager2 viewPager2, String[] strArr) {
if (!PatchProxy.proxy(new Object[]{viewPager2, strArr}, this, changeQuickRedirect, false, 111843, new Class[]{ViewPager2.class, String[].class}, Void.TYPE).isSupported) {
if (viewPager2 == null || viewPager2.getAdapter() == null) {
throw new IllegalStateException("ViewPager or ViewPager adapter can not be NULL !");
} else if (strArr == null || strArr.length == 0) {
throw new IllegalStateException("Titles can not be EMPTY !");
} else if (strArr.length == viewPager2.getAdapter().getItemCount()) {
this.f13146c = viewPager2;
this.d = strArr;
viewPager2.unregisterOnPageChangeCallback(this.f13147c0);
this.f13146c.registerOnPageChangeCallback(this.f13147c0);
b();
} else {
throw new IllegalStateException("Titles length must be the same as the page count !");
}
}
}
public final void f(int i3) {
if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 111849, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
int i12 = 0;
while (i12 < this.f13151h) {
View childAt = this.e.getChildAt(i12);
boolean z4 = i12 == i3;
TextView textView = (TextView) childAt.findViewById(R.id.tv_tab_title);
if (textView != null) {
textView.setTextColor(z4 ? this.M : this.N);
textView.setBackgroundResource(z4 ? this.O : this.P);
}
if ((this.f13146c.getAdapter() instanceof CustomTabProvider) && this.f13145a0 == i12) {
if (z4) {
((CustomTabProvider) this.f13146c.getAdapter()).tabSelect(childAt);
} else {
((CustomTabProvider) this.f13146c.getAdapter()).tabUnselect(childAt);
}
}
if (this.V == 1 && textView != null) {
textView.getPaint().setFakeBoldText(z4);
}
i12++;
}
}
}
public final void g() {
if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111846, new Class[0], Void.TYPE).isSupported) {
int i3 = 0;
while (i3 < this.f13151h) {
View childAt = this.e.getChildAt(i3);
boolean z4 = true;
if (!(i3 == 0 && i3 == this.f13151h - 1)) {
int i12 = (int) this.U;
childAt.setPadding(i12, 0, i12, 0);
}
TextView textView = (TextView) childAt.findViewById(R.id.tv_tab_title);
if (textView != null) {
textView.setTextColor(i3 == this.f ? this.M : this.N);
textView.setBackgroundResource(i3 == this.f ? this.O : this.P);
textView.setTextSize(0, this.L);
float f12 = this.Q;
if (((int) f12) == 0) {
f12 = this.f13152q;
}
int i13 = (int) f12;
float f13 = this.R;
if (((int) f13) == 0) {
f13 = this.f13152q;
}
textView.setPadding(i13, (int) this.S, (int) f13, (int) this.T);
if (this.W) {
textView.setText(textView.getText().toString().toUpperCase());
}
int i14 = this.V;
if (i14 == 2) {
textView.getPaint().setFakeBoldText(true);
} else if (i14 == 0) {
textView.getPaint().setFakeBoldText(false);
} else if (i14 == 1) {
TextPaint paint = textView.getPaint();
if (this.f != i3) {
z4 = false;
}
paint.setFakeBoldText(z4);
}
}
i3++;
}
}
}
public int getCurrentTab() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111877, new Class[0], Integer.TYPE);
return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.f;
}
public int getDividerColor() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111892, new Class[0], Integer.TYPE);
return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.I;
}
public float getDividerPadding() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111894, new Class[0], Float.TYPE);
return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.K;
}
public float getDividerWidth() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111893, new Class[0], Float.TYPE);
return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.J;
}
public int getIndicatorColor() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111882, new Class[0], Integer.TYPE);
return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.t;
}
public float getIndicatorCornerRadius() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111885, new Class[0], Float.TYPE);
return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.w;
}
public float getIndicatorHeight() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111883, new Class[0], Float.TYPE);
return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.f13153u;
}
public float getIndicatorMarginBottom() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111889, new Class[0], Float.TYPE);
return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.A;
}
public float getIndicatorMarginLeft() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111886, new Class[0], Float.TYPE);
return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.x;
}
public float getIndicatorMarginRight() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111888, new Class[0], Float.TYPE);
return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.z;
}
public float getIndicatorMarginTop() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111887, new Class[0], Float.TYPE);
return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.y;
}
public int getIndicatorStyle() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111878, new Class[0], Integer.TYPE);
return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.p;
}
public float getIndicatorWidth() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111884, new Class[0], Float.TYPE);
return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.f13154v;
}
public int getTabCount() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111876, new Class[0], Integer.TYPE);
return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.f13151h;
}
public float getTabPadding() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111879, new Class[0], Float.TYPE);
return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.f13152q;
}
public float getTabWidth() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111881, new Class[0], Float.TYPE);
return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.s;
}
public int getTextBold() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111898, new Class[0], Integer.TYPE);
return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.V;
}
public int getTextSelectColor() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111896, new Class[0], Integer.TYPE);
return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.M;
}
public int getTextUnselectColor() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111897, new Class[0], Integer.TYPE);
return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.N;
}
public float getTextsize() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111895, new Class[0], Float.TYPE);
return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.L;
}
public String[] getTitles() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111906, new Class[0], String[].class);
return proxy.isSupported ? (String[]) proxy.result : this.d;
}
public int getUnderlineColor() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111890, new Class[0], Integer.TYPE);
return proxy.isSupported ? ((Integer) proxy.result).intValue() : this.F;
}
public float getUnderlineHeight() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111891, new Class[0], Float.TYPE);
return proxy.isSupported ? ((Float) proxy.result).floatValue() : this.G;
}
public void onDraw(Canvas canvas) {
if (!PatchProxy.proxy(new Object[]{canvas}, this, changeQuickRedirect, false, 111851, new Class[]{Canvas.class}, Void.TYPE).isSupported) {
super.onDraw(canvas);
if (!isInEditMode() && this.f13151h > 0) {
int height = getHeight();
int paddingLeft = getPaddingLeft();
float f12 = this.J;
if (f12 > i.f36333a) {
this.m.setStrokeWidth(f12);
this.m.setColor(this.I);
for (int i3 = 0; i3 < this.f13151h - 1; i3++) {
View childAt = this.e.getChildAt(i3);
canvas.drawLine((float) (childAt.getRight() + paddingLeft), this.K, (float) (childAt.getRight() + paddingLeft), ((float) height) - this.K, this.m);
}
}
if (this.G > i.f36333a) {
this.l.setColor(this.F);
if (this.H == 80) {
float f13 = (float) height;
canvas.drawRect((float) paddingLeft, f13 - this.G, (float) (this.e.getWidth() + paddingLeft), f13, this.l);
} else {
canvas.drawRect((float) paddingLeft, i.f36333a, (float) (this.e.getWidth() + paddingLeft), this.G, this.l);
}
}
a();
int i12 = this.p;
if (i12 == 1) {
if (this.f13153u > i.f36333a) {
this.n.setColor(this.t);
this.o.reset();
float f14 = (float) height;
this.o.moveTo((float) (this.i.left + paddingLeft), f14);
Path path = this.o;
Rect rect = this.i;
path.lineTo((float) ((rect.right / 2) + (rect.left / 2) + paddingLeft), f14 - this.f13153u);
this.o.lineTo((float) (paddingLeft + this.i.right), f14);
this.o.close();
canvas.drawPath(this.o, this.n);
}
} else if (i12 == 2) {
if (this.f13153u < i.f36333a) {
this.f13153u = (((float) height) - this.y) - this.A;
}
float f15 = this.f13153u;
if (f15 > i.f36333a) {
float f16 = this.w;
if (f16 < i.f36333a || f16 > f15 / 2.0f) {
this.w = f15 / 2.0f;
}
this.k.setColor(this.t);
GradientDrawable gradientDrawable = this.k;
Rect rect2 = this.i;
int i13 = ((int) this.x) + paddingLeft + rect2.left;
float f17 = this.y;
gradientDrawable.setBounds(i13, (int) f17, (int) (((float) (paddingLeft + rect2.right)) - this.z), (int) (f17 + this.f13153u));
this.k.setCornerRadius(this.w);
this.k.draw(canvas);
}
} else if (this.f13153u > i.f36333a) {
if (this.D) {
this.k.setOrientation(GradientDrawable.Orientation.LEFT_RIGHT);
this.k.setColors(this.E);
} else {
this.k.setColor(this.t);
}
if (this.B == 80) {
GradientDrawable gradientDrawable2 = this.k;
Rect rect3 = this.i;
float f18 = this.A;
gradientDrawable2.setBounds(((int) this.x) + paddingLeft + rect3.left, (height - ((int) this.f13153u)) - ((int) f18), (paddingLeft + rect3.right) - ((int) this.z), height - ((int) f18));
} else {
GradientDrawable gradientDrawable3 = this.k;
Rect rect4 = this.i;
int i14 = ((int) this.x) + paddingLeft + rect4.left;
float f19 = this.y;
gradientDrawable3.setBounds(i14, (int) f19, (paddingLeft + rect4.right) - ((int) this.z), ((int) this.f13153u) + ((int) f19));
}
this.k.setCornerRadius(this.w);
this.k.draw(canvas);
}
}
}
}
public void onRestoreInstanceState(Parcelable parcelable) {
if (!PatchProxy.proxy(new Object[]{parcelable}, this, changeQuickRedirect, false, 111910, new Class[]{Parcelable.class}, Void.TYPE).isSupported) {
if (parcelable instanceof Bundle) {
Bundle bundle = (Bundle) parcelable;
this.f = bundle.getInt("mCurrentTab");
parcelable = bundle.getParcelable("instanceState");
if (this.f != 0 && this.e.getChildCount() > 0) {
f(this.f);
c();
}
}
super.onRestoreInstanceState(parcelable);
}
}
public Parcelable onSaveInstanceState() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 111909, 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.f);
return bundle;
}
public void setCurrentTab(int i3) {
if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 111852, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
this.f = i3;
this.f13146c.setCurrentItem(i3);
f(i3);
}
}
public void setDividerColor(int i3) {
if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 111868, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
this.I = i3;
invalidate();
}
}
public void setDividerPadding(float f12) {
if (!PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 111870, new Class[]{Float.TYPE}, Void.TYPE).isSupported) {
this.K = (float) fi.b.b(f12);
invalidate();
}
}
public void setDividerWidth(float f12) {
if (!PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 111869, new Class[]{Float.TYPE}, Void.TYPE).isSupported) {
this.J = (float) fi.b.b(f12);
invalidate();
}
}
public void setIndicatorColor(int i3) {
if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 111858, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
this.t = i3;
invalidate();
}
}
public void setIndicatorCornerRadius(float f12) {
if (!PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 111861, new Class[]{Float.TYPE}, Void.TYPE).isSupported) {
this.w = (float) fi.b.b(f12);
invalidate();
}
}
public void setIndicatorGravity(int i3) {
if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 111862, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
this.B = i3;
invalidate();
}
}
public void setIndicatorHeight(float f12) {
if (!PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 111859, new Class[]{Float.TYPE}, Void.TYPE).isSupported) {
this.f13153u = (float) fi.b.b(f12);
invalidate();
}
}
public void setIndicatorStyle(int i3) {
if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 111854, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
this.p = i3;
invalidate();
}
}
public void setIndicatorWidth(float f12) {
if (!PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 111860, new Class[]{Float.TYPE}, Void.TYPE).isSupported) {
this.f13154v = (float) fi.b.b(f12);
invalidate();
}
}
public void setIndicatorWidthEqualTitle(boolean z4) {
if (!PatchProxy.proxy(new Object[]{new Byte(z4 ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 111864, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) {
this.C = z4;
invalidate();
}
}
public void setOnTabSelectListener(OnTabSelectListener onTabSelectListener) {
if (!PatchProxy.proxy(new Object[]{onTabSelectListener}, this, changeQuickRedirect, false, 111908, new Class[]{OnTabSelectListener.class}, Void.TYPE).isSupported) {
this.f0 = onTabSelectListener;
}
}
public void setTabPadding(float f12) {
if (!PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 111855, new Class[]{Float.TYPE}, Void.TYPE).isSupported) {
this.f13152q = (float) fi.b.b(f12);
g();
}
}
public void setTabSpaceEqual(boolean z4) {
if (!PatchProxy.proxy(new Object[]{new Byte(z4 ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 111856, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) {
this.r = z4;
g();
}
}
public void setTabWidth(float f12) {
if (!PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 111857, new Class[]{Float.TYPE}, Void.TYPE).isSupported) {
this.s = (float) fi.b.b(f12);
g();
}
}
public void setTextAllCaps(boolean z4) {
if (!PatchProxy.proxy(new Object[]{new Byte(z4 ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 111875, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) {
this.W = z4;
g();
}
}
public void setTextBold(int i3) {
if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 111874, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
this.V = i3;
g();
}
}
public void setTextSelectColor(int i3) {
if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 111872, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
this.M = i3;
g();
}
}
public void setTextUnselectColor(int i3) {
if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 111873, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
this.N = i3;
g();
}
}
public void setTextsize(float f12) {
if (!PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 111871, new Class[]{Float.TYPE}, Void.TYPE).isSupported) {
this.L = (float) fi.b.o(f12);
g();
}
}
public void setUnderlineColor(int i3) {
if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 111865, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
this.F = i3;
invalidate();
}
}
public void setUnderlineGravity(int i3) {
if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 111867, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
this.H = i3;
invalidate();
}
}
public void setUnderlineHeight(float f12) {
if (!PatchProxy.proxy(new Object[]{new Float(f12)}, this, changeQuickRedirect, false, 111866, new Class[]{Float.TYPE}, Void.TYPE).isSupported) {
this.G = (float) fi.b.b(f12);
invalidate();
}
}
public void setViewPager(ViewPager2 viewPager2) {
if (!PatchProxy.proxy(new Object[]{viewPager2}, this, changeQuickRedirect, false, 111842, new Class[]{ViewPager2.class}, Void.TYPE).isSupported) {
if (viewPager2 == null || viewPager2.getAdapter() == null || !(viewPager2.getAdapter() instanceof IPageAdapter)) {
throw new IllegalStateException("ViewPager or ViewPager adapter can not be NULL !");
}
this.f13146c = viewPager2;
viewPager2.unregisterOnPageChangeCallback(this.f13147c0);
this.f13146c.registerOnPageChangeCallback(this.f13147c0);
b();
}
}
public DuSlidingTabLayoutV2(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public DuSlidingTabLayoutV2(Context context, AttributeSet attributeSet, int i3) {
super(context, attributeSet, i3);
float f12;
this.i = new Rect();
this.j = new Rect();
this.k = new GradientDrawable();
this.l = new Paint(1);
this.m = new Paint(1);
this.n = new Paint(1);
this.o = new Path();
this.p = 0;
this.E = new int[]{Color.parseColor("#FD937E"), Color.parseColor("#FF4657")};
this.f13145a0 = -1;
this.f13147c0 = new ViewPager2.OnPageChangeCallback() {
/* class com.shizhuang.duapp.modules.du_community_common.widget.DuSlidingTabLayoutV2.AnonymousClass1 */
public static ChangeQuickRedirect changeQuickRedirect;
@Override // androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
public void onPageScrollStateChanged(int i) {
if (!PatchProxy.proxy(new Object[]{new Integer(i)}, this, changeQuickRedirect, false, 111915, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
super.onPageScrollStateChanged(i);
}
}
@Override // androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
public void onPageScrolled(int i, float f, int i3) {
Object[] objArr = {new Integer(i), new Float(f), new Integer(i3)};
ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
Class cls = Integer.TYPE;
Class cls2 = Float.TYPE;
if (!PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 111913, new Class[]{cls, cls2, cls}, Void.TYPE).isSupported) {
super.onPageScrolled(i, f, i3);
DuSlidingTabLayoutV2 duSlidingTabLayoutV2 = DuSlidingTabLayoutV2.this;
ChangeQuickRedirect changeQuickRedirect3 = DuSlidingTabLayoutV2.changeQuickRedirect;
if (!PatchProxy.proxy(new Object[]{new Integer(i), new Float(f), new Integer(i3)}, duSlidingTabLayoutV2, DuSlidingTabLayoutV2.changeQuickRedirect, false, 111847, new Class[]{cls, cls2, cls}, Void.TYPE).isSupported) {
duSlidingTabLayoutV2.f = i;
duSlidingTabLayoutV2.f13150g = f;
duSlidingTabLayoutV2.c();
duSlidingTabLayoutV2.invalidate();
}
}
}
@Override // androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
public void onPageSelected(int i) {
if (!PatchProxy.proxy(new Object[]{new Integer(i)}, this, changeQuickRedirect, false, 111914, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
super.onPageSelected(i);
DuSlidingTabLayoutV2 duSlidingTabLayoutV2 = DuSlidingTabLayoutV2.this;
ChangeQuickRedirect changeQuickRedirect2 = DuSlidingTabLayoutV2.changeQuickRedirect;
duSlidingTabLayoutV2.f(i);
}
}
};
this.f13149e0 = new Paint(1);
new SparseArray();
setFillViewport(true);
setWillNotDraw(false);
setClipChildren(false);
setClipToPadding(false);
this.b = context;
LinearLayout linearLayout = new LinearLayout(context);
this.e = linearLayout;
addView(linearLayout);
if (!PatchProxy.proxy(new Object[]{context, attributeSet}, this, changeQuickRedirect, false, 111841, new Class[]{Context.class, AttributeSet.class}, Void.TYPE).isSupported) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, new int[]{R.attr.du_tab_layout_divider_color, R.attr.du_tab_layout_divider_padding, R.attr.du_tab_layout_divider_width, R.attr.du_tab_layout_indicator_color, R.attr.du_tab_layout_indicator_corner_radius, R.attr.du_tab_layout_indicator_gravity, R.attr.du_tab_layout_indicator_height, R.attr.du_tab_layout_indicator_margin_bottom, R.attr.du_tab_layout_indicator_margin_left, R.attr.du_tab_layout_indicator_margin_right, R.attr.du_tab_layout_indicator_margin_top, R.attr.du_tab_layout_indicator_show_gradient_color, R.attr.du_tab_layout_indicator_style, R.attr.du_tab_layout_indicator_width, R.attr.du_tab_layout_indicator_width_equal_title, R.attr.du_tab_layout_tab_padding, R.attr.du_tab_layout_tab_space_equal, R.attr.du_tab_layout_tab_width, R.attr.du_tab_layout_textAllCaps, R.attr.du_tab_layout_textBold, R.attr.du_tab_layout_textPaddingBottom, R.attr.du_tab_layout_textPaddingLeft, R.attr.du_tab_layout_textPaddingRight, R.attr.du_tab_layout_textPaddingTop, R.attr.du_tab_layout_textSelectBg, R.attr.du_tab_layout_textSelectColor, R.attr.du_tab_layout_textUnselectBg, R.attr.du_tab_layout_textUnselectColor, R.attr.du_tab_layout_text_gradient_position, R.attr.du_tab_layout_text_parentPadding, R.attr.du_tab_layout_textsize, R.attr.du_tab_layout_underline_color, R.attr.du_tab_layout_underline_gravity, R.attr.du_tab_layout_underline_height});
int i12 = obtainStyledAttributes.getInt(12, 0);
this.p = i12;
this.t = obtainStyledAttributes.getColor(3, Color.parseColor(i12 == 2 ? "#4B6A87" : "#ffffff"));
int i13 = this.p;
if (i13 == 1) {
f12 = 4.0f;
} else {
f12 = (float) (i13 == 2 ? -1 : 2);
}
this.f13153u = obtainStyledAttributes.getDimension(6, (float) fi.b.b(f12));
this.f13154v = obtainStyledAttributes.getDimension(13, (float) fi.b.b(this.p == 1 ? 10.0f : -1.0f));
this.w = obtainStyledAttributes.getDimension(4, (float) fi.b.b(this.p == 2 ? -1.0f : i.f36333a));
this.x = obtainStyledAttributes.getDimension(8, (float) fi.b.b(i.f36333a));
float f13 = 7.0f;
this.y = obtainStyledAttributes.getDimension(10, (float) fi.b.b(this.p == 2 ? 7.0f : i.f36333a));
this.z = obtainStyledAttributes.getDimension(9, (float) fi.b.b(i.f36333a));
this.A = obtainStyledAttributes.getDimension(7, (float) fi.b.b(this.p != 2 ? i.f36333a : f13));
this.B = obtainStyledAttributes.getInt(5, 80);
this.C = obtainStyledAttributes.getBoolean(14, false);
this.D = obtainStyledAttributes.getBoolean(11, false);
this.F = obtainStyledAttributes.getColor(31, Color.parseColor("#ffffff"));
this.G = obtainStyledAttributes.getDimension(33, (float) fi.b.b(i.f36333a));
this.H = obtainStyledAttributes.getInt(32, 80);
this.I = obtainStyledAttributes.getColor(0, Color.parseColor("#ffffff"));
this.J = obtainStyledAttributes.getDimension(2, (float) fi.b.b(i.f36333a));
this.K = obtainStyledAttributes.getDimension(1, (float) fi.b.b(12.0f));
this.L = obtainStyledAttributes.getDimension(30, (float) fi.b.o(14.0f));
this.M = obtainStyledAttributes.getColor(25, Color.parseColor("#ffffff"));
this.N = obtainStyledAttributes.getColor(27, Color.parseColor("#AAffffff"));
this.O = obtainStyledAttributes.getResourceId(24, 0);
this.P = obtainStyledAttributes.getResourceId(26, 0);
this.Q = obtainStyledAttributes.getDimension(21, i.f36333a);
this.R = obtainStyledAttributes.getDimension(22, i.f36333a);
this.S = obtainStyledAttributes.getDimension(23, i.f36333a);
this.T = obtainStyledAttributes.getDimension(20, i.f36333a);
this.U = obtainStyledAttributes.getDimension(29, i.f36333a);
this.V = obtainStyledAttributes.getInt(19, 0);
this.W = obtainStyledAttributes.getBoolean(18, false);
this.f13145a0 = obtainStyledAttributes.getInt(28, -1);
this.r = obtainStyledAttributes.getBoolean(16, false);
float dimension = obtainStyledAttributes.getDimension(17, (float) fi.b.b(-1.0f));
this.s = dimension;
this.f13152q = obtainStyledAttributes.getDimension(15, (float) ((this.r || dimension > i.f36333a) ? fi.b.b(i.f36333a) : fi.b.b(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();
}
}
}