what-the-bank/sources/com/google/android/material/tabs/TabLayout.java

1917 lines
64 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.google.android.material.tabs;
import android.R;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.database.DataSetObserver;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.RippleDrawable;
import android.text.Layout;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.SpannedString;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Base64;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.FrameLayout;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.viewpager.widget.ViewPager;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import java.lang.ref.WeakReference;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Iterator;
import o.AgY;
import o.C0459HUs;
import o.C0912RjT;
import o.C17052tZT;
import o.C4363bXv;
import o.C5745byp;
import o.C6286cOZ;
import o.C6759cbV;
import o.C7684csv;
import o.CYM;
import o.Lot;
import o.RDy;
import o.Tlu;
import o.URz;
import o.VTa;
import o.WYJ;
import o.qEr;
import org.bouncycastle.asn1.cmp.PKIFailureInfo;
@ViewPager.RVV
/* loaded from: classes2.dex */
public class TabLayout extends HorizontalScrollView {
public final ArrayList<RVV> A;
float B;
boolean C;
ViewPager D;
private Sts F;
private int G;
private LWm I;
private saX J;
private final int K;
private final int L;
private WYJ M;
private DataSetObserver N;
private ValueAnimator O;
private Sts P;
private float Q;
private final int R;
private boolean S;
private int T;
private SlidingTabIndicator U;
private int V;
private int W;
int a;
private final RDy.Sts<TabView> aa;
private int ac;
final int b;
int c;
public final ArrayList<Sts> d;
boolean e;
public RVV f;
int g;
ColorStateList h;
final int i;
int j;
VTa k;
PorterDuff.Mode l;
int m;
public boolean n;
/* renamed from: o, reason: collision with root package name */
final TimeInterpolator f6483o;
int p;
int q;
int r;
int s;
int t;
ColorStateList u;
Drawable v;
float w;
ColorStateList x;
final int y;
public int z;
private static final int H = C17052tZT.NHB.Widget_Design_TabLayout;
private static final RDy.Sts<RVV> E = new RDy.LWm(16);
/* loaded from: classes2.dex */
public interface IeS extends Sts<RVV> {
}
@Deprecated
/* loaded from: classes2.dex */
public interface Sts<T extends RVV> {
void a(T t);
void d(T t);
void e(T t);
}
/* loaded from: classes2.dex */
public static class RVV {
private static int k = 1;
private static byte m = 6;
private static int n;
CharSequence a;
Drawable b;
public View c;
public CharSequence f;
public TabView g;
public TabLayout h;
private Object j;
public int i = -1;
int e = 1;
int d = -1;
private void l(String str, Object[] objArr) {
byte[] decode = Base64.decode(str, 0);
byte[] bArr = new byte[decode.length];
for (int i = 0; i < decode.length; i++) {
bArr[i] = (byte) (decode[(decode.length - i) - 1] ^ m);
}
objArr[0] = new String(bArr, StandardCharsets.UTF_8);
}
public final RVV e(CharSequence charSequence) {
if (TextUtils.isEmpty(this.a) && !TextUtils.isEmpty(charSequence)) {
this.g.setContentDescription(charSequence);
}
this.f = charSequence;
TabView tabView = this.g;
if (tabView != null) {
tabView.b();
}
return this;
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r1v4, types: [android.text.SpannableString, android.text.Spannable] */
/* JADX WARN: Type inference failed for: r9v0, types: [com.google.android.material.tabs.TabLayout$RVV] */
public final RVV c(int i) {
int i2 = 2 % 2;
TabLayout tabLayout = this.h;
if (tabLayout == null) {
throw new IllegalArgumentException("Tab not attached to a TabLayout");
}
int i3 = k + 125;
n = i3 % 128;
int i4 = i3 % 2;
Resources resources = tabLayout.getResources();
String string = resources.getString(i);
if (!(!string.startsWith(",*,)"))) {
Object[] objArr = new Object[1];
l(string.substring(4), objArr);
string = ((String) objArr[0]).intern();
CharSequence text = resources.getText(i);
if (text instanceof Spanned) {
?? spannableString = new SpannableString(string);
TextUtils.copySpansFrom((SpannedString) text, 0, string.length(), Object.class, spannableString, 0);
int i5 = k + 69;
n = i5 % 128;
int i6 = i5 % 2;
string = spannableString;
}
}
return e(string);
}
public final boolean b() {
TabLayout tabLayout = this.h;
if (tabLayout == null) {
throw new IllegalArgumentException("Tab not attached to a TabLayout");
}
RVV rvv = tabLayout.f;
int i = rvv != null ? rvv.i : -1;
return i != -1 && i == this.i;
}
public final C5745byp c() {
TabView tabView = this.g;
if (tabView.d == null) {
tabView.d = new C5745byp(tabView.getContext(), C5745byp.d, C5745byp.a, null);
}
tabView.e();
C5745byp c5745byp = tabView.d;
if (c5745byp != null) {
return c5745byp;
}
throw new IllegalStateException("Unable to create badge");
}
final void e() {
this.h = null;
this.g = null;
this.j = null;
this.b = null;
this.d = -1;
this.f = null;
this.a = null;
this.i = -1;
this.c = null;
}
}
@Override // android.widget.FrameLayout, android.view.ViewGroup
public /* bridge */ /* synthetic */ ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
return generateLayoutParams(attributeSet);
}
public TabLayout(Context context) {
this(context, null);
}
public TabLayout(Context context, AttributeSet attributeSet) {
this(context, attributeSet, C17052tZT.IeS.tabStyle);
}
/* JADX WARN: Illegal instructions before constructor call */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public TabLayout(android.content.Context r12, android.util.AttributeSet r13, int r14) {
/*
Method dump skipped, instructions count: 582
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.tabs.TabLayout.<init>(android.content.Context, android.util.AttributeSet, int):void");
}
@Deprecated
public void setSelectedTabIndicatorHeight(int i) {
this.W = i;
this.U.b(i);
}
public void setScrollPosition(int i, float f, boolean z) {
setScrollPosition(i, f, z, true);
}
public void setScrollPosition(int i, float f, boolean z, boolean z2) {
d(i, f, z, z2, true);
}
/* JADX WARN: Code restructure failed: missing block: B:42:0x007a, code lost:
if (r7 == (r10 != null ? r10.i : -1)) goto L56;
*/
/* JADX WARN: Code restructure failed: missing block: B:44:0x0081, code lost:
if (r6.z == 1) goto L56;
*/
/* JADX WARN: Code restructure failed: missing block: B:45:0x0083, code lost:
if (r11 == false) goto L59;
*/
/* JADX WARN: Code restructure failed: missing block: B:48:0x007d, code lost:
if (r1 == false) goto L53;
*/
/* JADX WARN: Removed duplicated region for block: B:21:0x005c */
/* JADX WARN: Removed duplicated region for block: B:48:0x007d */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void d(int r7, float r8, boolean r9, boolean r10, boolean r11) {
/*
r6 = this;
float r0 = (float) r7
float r0 = r0 + r8
int r0 = java.lang.Math.round(r0)
if (r0 < 0) goto L90
com.google.android.material.tabs.TabLayout$SlidingTabIndicator r1 = r6.U
int r1 = r1.getChildCount()
if (r0 >= r1) goto L90
if (r10 == 0) goto L17
com.google.android.material.tabs.TabLayout$SlidingTabIndicator r10 = r6.U
r10.a(r7, r8)
L17:
android.animation.ValueAnimator r10 = r6.O
if (r10 == 0) goto L26
boolean r10 = r10.isRunning()
if (r10 == 0) goto L26
android.animation.ValueAnimator r10 = r6.O
r10.cancel()
L26:
int r8 = r6.e(r7, r8)
int r10 = r6.getScrollX()
com.google.android.material.tabs.TabLayout$RVV r1 = r6.f
r2 = -1
if (r1 == 0) goto L36
int r1 = r1.i
goto L37
L36:
r1 = r2
L37:
r3 = 0
r4 = 1
if (r7 >= r1) goto L3d
if (r8 >= r10) goto L53
L3d:
com.google.android.material.tabs.TabLayout$RVV r1 = r6.f
if (r1 == 0) goto L44
int r1 = r1.i
goto L45
L44:
r1 = r2
L45:
if (r7 <= r1) goto L49
if (r8 <= r10) goto L53
L49:
com.google.android.material.tabs.TabLayout$RVV r1 = r6.f
if (r1 == 0) goto L50
int r1 = r1.i
goto L51
L50:
r1 = r2
L51:
if (r7 != r1) goto L55
L53:
r1 = r4
goto L56
L55:
r1 = r3
L56:
int r5 = androidx.core.view.ViewCompat.m(r6)
if (r5 != r4) goto L7d
com.google.android.material.tabs.TabLayout$RVV r1 = r6.f
if (r1 == 0) goto L63
int r1 = r1.i
goto L64
L63:
r1 = r2
L64:
if (r7 >= r1) goto L68
if (r8 <= r10) goto L85
L68:
com.google.android.material.tabs.TabLayout$RVV r1 = r6.f
if (r1 == 0) goto L6f
int r1 = r1.i
goto L70
L6f:
r1 = r2
L70:
if (r7 <= r1) goto L74
if (r8 >= r10) goto L85
L74:
com.google.android.material.tabs.TabLayout$RVV r10 = r6.f
if (r10 == 0) goto L7a
int r2 = r10.i
L7a:
if (r7 != r2) goto L7f
goto L85
L7d:
if (r1 != 0) goto L85
L7f:
int r10 = r6.z
if (r10 == r4) goto L85
if (r11 == 0) goto L8b
L85:
if (r7 >= 0) goto L88
r8 = r3
L88:
r6.scrollTo(r8, r3)
L8b:
if (r9 == 0) goto L90
r6.e(r0)
L90:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.tabs.TabLayout.d(int, float, boolean, boolean, boolean):void");
}
public final void d(RVV rvv, int i, boolean z) {
if (rvv.h != this) {
throw new IllegalArgumentException("Tab belongs to a different TabLayout.");
}
rvv.i = i;
this.A.add(i, rvv);
int size = this.A.size();
int i2 = -1;
for (int i3 = i + 1; i3 < size; i3++) {
if (this.A.get(i3).i == this.c) {
i2 = i3;
}
this.A.get(i3).i = i3;
}
this.c = i2;
TabView tabView = rvv.g;
tabView.setSelected(false);
tabView.setActivated(false);
SlidingTabIndicator slidingTabIndicator = this.U;
int i4 = rvv.i;
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -1);
LT_(layoutParams);
slidingTabIndicator.addView(tabView, i4, layoutParams);
if (z) {
TabLayout tabLayout = rvv.h;
if (tabLayout == null) {
throw new IllegalArgumentException("Tab not attached to a TabLayout");
}
tabLayout.a(rvv, true);
}
}
@Override // android.widget.HorizontalScrollView, android.view.View
public boolean onTouchEvent(MotionEvent motionEvent) {
int i;
if (motionEvent.getActionMasked() != 8 || (i = this.a) == 0 || i == 2) {
return super.onTouchEvent(motionEvent);
}
return false;
}
@Deprecated
public void setOnTabSelectedListener(IeS ieS) {
setOnTabSelectedListener((Sts) ieS);
}
@Deprecated
public void setOnTabSelectedListener(Sts sts) {
Sts sts2 = this.P;
if (sts2 != null) {
this.d.remove(sts2);
}
this.P = sts;
if (sts == null || this.d.contains(sts)) {
return;
}
this.d.add(sts);
}
public final RVV c() {
RVV d = E.d();
if (d == null) {
d = new RVV();
}
d.h = this;
d.g = b(d);
if (d.d != -1) {
d.g.setId(d.d);
}
return d;
}
public final RVV a(int i) {
if (i < 0 || i >= this.A.size()) {
return null;
}
return this.A.get(i);
}
public final void a() {
for (int childCount = this.U.getChildCount() - 1; childCount >= 0; childCount--) {
b(childCount);
}
Iterator<RVV> it = this.A.iterator();
while (it.hasNext()) {
RVV next = it.next();
it.remove();
next.e();
E.d(next);
}
this.f = null;
}
public void setTabMode(int i) {
if (i != this.a) {
this.a = i;
e();
}
}
public void setTabGravity(int i) {
if (this.g != i) {
this.g = i;
e();
}
}
public void setSelectedTabIndicatorGravity(int i) {
if (this.m != i) {
this.m = i;
ViewCompat.N(this.U);
}
}
public void setTabIndicatorAnimationMode(int i) {
this.V = i;
if (i == 0) {
this.k = new VTa();
return;
}
if (i == 1) {
this.k = new qEr();
} else {
if (i == 2) {
this.k = new C7684csv();
return;
}
StringBuilder sb = new StringBuilder();
sb.append(i);
sb.append(" is not a valid TabIndicatorAnimationMode");
throw new IllegalArgumentException(sb.toString());
}
}
public void setInlineLabel(boolean z) {
if (this.e != z) {
this.e = z;
for (int i = 0; i < this.U.getChildCount(); i++) {
View childAt = this.U.getChildAt(i);
if (childAt instanceof TabView) {
TabView tabView = (TabView) childAt;
tabView.setOrientation(!tabView.f.e ? 1 : 0);
TextView textView = tabView.c;
if (textView != null || tabView.e != null) {
tabView.LU_(textView, tabView.e, false);
} else {
tabView.LU_(tabView.j, tabView.i, true);
}
}
}
e();
}
}
public void setInlineLabelResource(int i) {
setInlineLabel(getResources().getBoolean(i));
}
public void setUnboundedRipple(boolean z) {
if (this.C != z) {
this.C = z;
for (int i = 0; i < this.U.getChildCount(); i++) {
View childAt = this.U.getChildAt(i);
if (childAt instanceof TabView) {
((TabView) childAt).c(getContext());
}
}
}
}
public void setUnboundedRippleResource(int i) {
setUnboundedRipple(getResources().getBoolean(i));
}
public void setTabTextColors(ColorStateList colorStateList) {
if (this.x != colorStateList) {
this.x = colorStateList;
j();
}
}
public void setTabTextColors(int i, int i2) {
setTabTextColors(LS_(i, i2));
}
public void setTabIconTint(ColorStateList colorStateList) {
if (this.h != colorStateList) {
this.h = colorStateList;
j();
}
}
public void setTabIconTintResource(int i) {
setTabIconTint(AgY.dS_(getContext(), i));
}
public void setTabRippleColor(ColorStateList colorStateList) {
if (this.u != colorStateList) {
this.u = colorStateList;
for (int i = 0; i < this.U.getChildCount(); i++) {
View childAt = this.U.getChildAt(i);
if (childAt instanceof TabView) {
((TabView) childAt).c(getContext());
}
}
}
}
public void setTabRippleColorResource(int i) {
setTabRippleColor(AgY.dS_(getContext(), i));
}
public void setSelectedTabIndicator(Drawable drawable) {
if (drawable == null) {
drawable = new GradientDrawable();
}
Drawable mutate = Tlu.pI_(drawable).mutate();
this.v = mutate;
int i = this.ac;
if (i != 0) {
Tlu.pE_(mutate, i);
} else {
Tlu.pF_(mutate, null);
}
int i2 = this.W;
if (i2 == -1) {
i2 = this.v.getIntrinsicHeight();
}
this.U.b(i2);
}
public void setSelectedTabIndicator(int i) {
if (i != 0) {
setSelectedTabIndicator(AgY.dT_(getContext(), i));
} else {
setSelectedTabIndicator((Drawable) null);
}
}
public void setupWithViewPager(ViewPager viewPager) {
setupWithViewPager(viewPager, true);
}
public void setupWithViewPager(ViewPager viewPager, boolean z) {
b(viewPager, z, false);
}
private void b(ViewPager viewPager, boolean z, boolean z2) {
ViewPager viewPager2 = this.D;
if (viewPager2 != null) {
saX sax = this.J;
if (sax != null) {
viewPager2.removeOnPageChangeListener(sax);
}
LWm lWm = this.I;
if (lWm != null) {
this.D.removeOnAdapterChangeListener(lWm);
}
}
Sts sts = this.F;
if (sts != null) {
this.d.remove(sts);
this.F = null;
}
if (viewPager == null) {
this.D = null;
b(null, false);
} else {
this.D = viewPager;
if (this.J == null) {
this.J = new saX(this);
}
saX sax2 = this.J;
sax2.a = 0;
sax2.c = 0;
viewPager.addOnPageChangeListener(this.J);
ZqN zqN = new ZqN(viewPager);
this.F = zqN;
if (!this.d.contains(zqN)) {
this.d.add(zqN);
}
WYJ adapter = viewPager.getAdapter();
if (adapter != null) {
b(adapter, z);
}
if (this.I == null) {
this.I = new LWm(this);
}
this.I.e = z;
viewPager.addOnAdapterChangeListener(this.I);
setScrollPosition(viewPager.getCurrentItem(), BitmapDescriptorFactory.HUE_RED, true);
}
this.S = z2;
}
@Deprecated
public void setTabsFromPagerAdapter(WYJ wyj) {
b(wyj, false);
}
@Override // android.widget.HorizontalScrollView, android.widget.FrameLayout, android.view.ViewGroup
public boolean shouldDelayChildPressedState() {
return Math.max(0, ((this.U.getWidth() - getWidth()) - getPaddingLeft()) - getPaddingRight()) > 0;
}
@Override // android.view.ViewGroup, android.view.View
protected void onAttachedToWindow() {
super.onAttachedToWindow();
Drawable background = getBackground();
if (background instanceof C4363bXv) {
C4363bXv c4363bXv = (C4363bXv) background;
if (c4363bXv.B.c != null && c4363bXv.B.c.a) {
c4363bXv.k(Lot.e(this));
}
}
if (this.D == null) {
ViewParent parent = getParent();
if (parent instanceof ViewPager) {
b((ViewPager) parent, true, true);
}
}
}
@Override // android.view.ViewGroup, android.view.View
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (this.S) {
setupWithViewPager(null);
this.S = false;
}
}
final void b(WYJ wyj, boolean z) {
DataSetObserver dataSetObserver;
WYJ wyj2 = this.M;
if (wyj2 != null && (dataSetObserver = this.N) != null) {
wyj2.unregisterDataSetObserver(dataSetObserver);
}
this.M = wyj;
if (z && wyj != null) {
if (this.N == null) {
this.N = new HBt(this);
}
wyj.registerDataSetObserver(this.N);
}
b();
}
final void b() {
a();
WYJ wyj = this.M;
if (wyj != null) {
int count = wyj.getCount();
for (int i = 0; i < count; i++) {
d(c().e(this.M.getPageTitle(i)), this.A.size(), false);
}
ViewPager viewPager = this.D;
if (viewPager == null || count <= 0) {
return;
}
int currentItem = viewPager.getCurrentItem();
RVV rvv = this.f;
if (currentItem == (rvv != null ? rvv.i : -1) || currentItem >= this.A.size()) {
return;
}
a(a(currentItem), true);
}
}
private void j() {
int size = this.A.size();
for (int i = 0; i < size; i++) {
TabView tabView = this.A.get(i).g;
if (tabView != null) {
tabView.b();
}
}
}
private TabView b(RVV rvv) {
RDy.Sts<TabView> sts = this.aa;
TabView d = sts != null ? sts.d() : null;
if (d == null) {
d = new TabView(this, getContext());
}
if (rvv != d.h) {
d.h = rvv;
d.b();
}
d.setFocusable(true);
d.setMinimumWidth(d());
if (TextUtils.isEmpty(rvv.a)) {
d.setContentDescription(rvv.f);
} else {
d.setContentDescription(rvv.a);
}
return d;
}
@Override // android.widget.HorizontalScrollView, android.view.ViewGroup
public void addView(View view) {
e(view);
}
@Override // android.widget.HorizontalScrollView, android.view.ViewGroup
public void addView(View view, int i) {
e(view);
}
@Override // android.widget.HorizontalScrollView, android.view.ViewGroup, android.view.ViewManager
public void addView(View view, ViewGroup.LayoutParams layoutParams) {
e(view);
}
@Override // android.widget.HorizontalScrollView, android.view.ViewGroup
public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) {
e(view);
}
private void e(View view) {
if (view instanceof TabItem) {
TabItem tabItem = (TabItem) view;
RVV c = c();
if (tabItem.c != null) {
c.e(tabItem.c);
}
if (tabItem.d != null) {
c.b = tabItem.d;
if (c.h.g == 1 || c.h.a == 2) {
c.h.c(true);
}
TabView tabView = c.g;
if (tabView != null) {
tabView.b();
}
}
if (tabItem.a != 0) {
c.c = LayoutInflater.from(c.g.getContext()).inflate(tabItem.a, (ViewGroup) c.g, false);
TabView tabView2 = c.g;
if (tabView2 != null) {
tabView2.b();
}
}
if (!TextUtils.isEmpty(tabItem.getContentDescription())) {
c.a = tabItem.getContentDescription();
TabView tabView3 = c.g;
if (tabView3 != null) {
tabView3.b();
}
}
d(c, this.A.size(), this.A.isEmpty());
return;
}
throw new IllegalArgumentException("Only TabItem instances can be added to TabLayout");
}
private void LT_(LinearLayout.LayoutParams layoutParams) {
if (this.a == 1 && this.g == 0) {
((ViewGroup.LayoutParams) layoutParams).width = 0;
layoutParams.weight = 1.0f;
} else {
((ViewGroup.LayoutParams) layoutParams).width = -2;
layoutParams.weight = BitmapDescriptorFactory.HUE_RED;
}
}
@Override // android.view.View
public void setElevation(float f) {
super.setElevation(f);
Drawable background = getBackground();
if (background instanceof C4363bXv) {
((C4363bXv) background).n(f);
}
}
@Override // android.view.View
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
AccessibilityNodeInfoCompat.tU_(accessibilityNodeInfo).e(AccessibilityNodeInfoCompat.CollectionInfoCompat.e(1, this.A.size(), false, 1));
}
@Override // android.view.View
protected void onDraw(Canvas canvas) {
TabView tabView;
Drawable drawable;
for (int i = 0; i < this.U.getChildCount(); i++) {
View childAt = this.U.getChildAt(i);
if ((childAt instanceof TabView) && (drawable = (tabView = (TabView) childAt).b) != null) {
drawable.setBounds(tabView.getLeft(), tabView.getTop(), tabView.getRight(), tabView.getBottom());
tabView.b.draw(canvas);
}
}
super.onDraw(canvas);
}
@Override // android.widget.HorizontalScrollView, android.widget.FrameLayout, android.view.View
protected void onMeasure(int i, int i2) {
int i3;
Context context = getContext();
int size = this.A.size();
int i4 = 0;
while (true) {
if (i4 >= size) {
break;
}
RVV rvv = this.A.get(i4);
if (rvv == null || rvv.b == null || TextUtils.isEmpty(rvv.f)) {
i4++;
} else if (!this.e) {
i3 = 72;
}
}
i3 = 48;
int round = Math.round(TypedValue.applyDimension(1, i3, context.getResources().getDisplayMetrics()));
int mode = View.MeasureSpec.getMode(i2);
if (mode != Integer.MIN_VALUE) {
if (mode == 0) {
i2 = View.MeasureSpec.makeMeasureSpec(round + getPaddingTop() + getPaddingBottom(), 1073741824);
}
} else if (getChildCount() == 1 && View.MeasureSpec.getSize(i2) >= round) {
getChildAt(0).setMinimumHeight(round);
}
int size2 = View.MeasureSpec.getSize(i);
if (View.MeasureSpec.getMode(i) != 0) {
int i5 = this.K;
if (i5 <= 0) {
i5 = (int) (size2 - TypedValue.applyDimension(1, 56.0f, getContext().getResources().getDisplayMetrics()));
}
this.r = i5;
}
super.onMeasure(i, i2);
if (getChildCount() == 1) {
View childAt = getChildAt(0);
int i6 = this.a;
if (i6 != 0) {
if (i6 == 1) {
if (childAt.getMeasuredWidth() == getMeasuredWidth()) {
return;
}
childAt.measure(View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), 1073741824), getChildMeasureSpec(i2, getPaddingTop() + getPaddingBottom(), childAt.getLayoutParams().height));
}
if (i6 != 2) {
return;
}
}
if (childAt.getMeasuredWidth() >= getMeasuredWidth()) {
return;
}
childAt.measure(View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), 1073741824), getChildMeasureSpec(i2, getPaddingTop() + getPaddingBottom(), childAt.getLayoutParams().height));
}
}
private void b(int i) {
TabView tabView = (TabView) this.U.getChildAt(i);
this.U.removeViewAt(i);
if (tabView != null) {
if (tabView.h != null) {
tabView.h = null;
tabView.b();
}
tabView.setSelected(false);
this.aa.d(tabView);
}
requestLayout();
}
private void c(int i) {
if (i == -1) {
return;
}
if (getWindowToken() != null && ViewCompat.G(this)) {
SlidingTabIndicator slidingTabIndicator = this.U;
int childCount = slidingTabIndicator.getChildCount();
for (int i2 = 0; i2 < childCount; i2++) {
if (slidingTabIndicator.getChildAt(i2).getWidth() > 0) {
}
}
int scrollX = getScrollX();
int e = e(i, BitmapDescriptorFactory.HUE_RED);
if (scrollX != e) {
if (this.O == null) {
ValueAnimator valueAnimator = new ValueAnimator();
this.O = valueAnimator;
valueAnimator.setInterpolator(this.f6483o);
this.O.setDuration(this.T);
this.O.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this) { // from class: com.google.android.material.tabs.TabLayout.2
private TabLayout e;
{
this.e = this;
}
@Override // android.animation.ValueAnimator.AnimatorUpdateListener
public final void onAnimationUpdate(ValueAnimator valueAnimator2) {
this.e.scrollTo(((Integer) valueAnimator2.getAnimatedValue()).intValue(), 0);
}
});
}
this.O.setIntValues(scrollX, e);
this.O.start();
}
SlidingTabIndicator slidingTabIndicator2 = this.U;
int i3 = this.T;
ValueAnimator valueAnimator2 = slidingTabIndicator2.a;
if (valueAnimator2 != null && valueAnimator2.isRunning() && slidingTabIndicator2.b.c != i) {
slidingTabIndicator2.a.cancel();
}
slidingTabIndicator2.b(true, i, i3);
return;
}
setScrollPosition(i, BitmapDescriptorFactory.HUE_RED, true);
}
private void e(int i) {
int childCount = this.U.getChildCount();
if (i < childCount) {
int i2 = 0;
while (i2 < childCount) {
View childAt = this.U.getChildAt(i2);
if ((i2 == i && !childAt.isSelected()) || (i2 != i && childAt.isSelected())) {
childAt.setSelected(i2 == i);
childAt.setActivated(i2 == i);
if (childAt instanceof TabView) {
((TabView) childAt).d();
}
} else {
childAt.setSelected(i2 == i);
childAt.setActivated(i2 == i);
}
i2++;
}
}
}
public final void a(RVV rvv, boolean z) {
RVV rvv2 = this.f;
if (rvv2 == rvv) {
if (rvv2 != null) {
e(rvv);
c(rvv.i);
return;
}
return;
}
int i = rvv != null ? rvv.i : -1;
if (z) {
if ((rvv2 == null || rvv2.i == -1) && i != -1) {
setScrollPosition(i, BitmapDescriptorFactory.HUE_RED, true);
} else {
c(i);
}
if (i != -1) {
e(i);
}
}
this.f = rvv;
if (rvv2 != null && rvv2.h != null) {
a(rvv2);
}
if (rvv != null) {
d(rvv);
}
}
private void d(RVV rvv) {
for (int size = this.d.size() - 1; size >= 0; size--) {
this.d.get(size).e(rvv);
}
}
private void a(RVV rvv) {
for (int size = this.d.size() - 1; size >= 0; size--) {
this.d.get(size).a(rvv);
}
}
private void e(RVV rvv) {
for (int size = this.d.size() - 1; size >= 0; size--) {
this.d.get(size).d(rvv);
}
}
private int e(int i, float f) {
View childAt;
int i2 = this.a;
if ((i2 != 0 && i2 != 2) || (childAt = this.U.getChildAt(i)) == null) {
return 0;
}
int i3 = i + 1;
View childAt2 = i3 < this.U.getChildCount() ? this.U.getChildAt(i3) : null;
int width = childAt.getWidth();
int width2 = childAt2 != null ? childAt2.getWidth() : 0;
int left = (childAt.getLeft() + (width / 2)) - (getWidth() / 2);
int i4 = (int) ((width + width2) * 0.5f * f);
return ViewCompat.m(this) == 0 ? left + i4 : left - i4;
}
private void e() {
int i = this.a;
ViewCompat.a(this.U, (i == 0 || i == 2) ? Math.max(0, this.G - this.t) : 0, 0, 0, 0);
int i2 = this.a;
if (i2 == 0) {
d(this.g);
} else if (i2 == 1 || i2 == 2) {
this.U.setGravity(1);
}
c(true);
}
private void d(int i) {
if (i != 0) {
if (i == 1) {
this.U.setGravity(1);
return;
} else if (i != 2) {
return;
}
}
this.U.setGravity(8388611);
}
final void c(boolean z) {
for (int i = 0; i < this.U.getChildCount(); i++) {
View childAt = this.U.getChildAt(i);
childAt.setMinimumWidth(d());
LT_((LinearLayout.LayoutParams) childAt.getLayoutParams());
if (z) {
childAt.requestLayout();
}
}
}
/* loaded from: classes2.dex */
public final class TabView extends LinearLayout {
View a;
Drawable b;
TextView c;
C5745byp d;
ImageView e;
final TabLayout f;
public View g;
RVV h;
public ImageView i;
public TextView j;
private int n;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public TabView(TabLayout tabLayout, Context context) {
super(context);
this.f = tabLayout;
this.n = 2;
c(context);
ViewCompat.a(this, tabLayout.t, tabLayout.p, tabLayout.q, tabLayout.s);
setGravity(17);
setOrientation(!tabLayout.e ? 1 : 0);
setClickable(true);
ViewCompat.d(this, C0912RjT.a(getContext(), 1002));
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r0v8, types: [android.graphics.drawable.RippleDrawable] */
final void c(Context context) {
if (this.f.i != 0) {
Drawable dT_ = AgY.dT_(context, this.f.i);
this.b = dT_;
if (dT_ != null && dT_.isStateful()) {
this.b.setState(getDrawableState());
}
} else {
this.b = null;
}
GradientDrawable gradientDrawable = new GradientDrawable();
gradientDrawable.setColor(0);
if (this.f.u != null) {
GradientDrawable gradientDrawable2 = new GradientDrawable();
gradientDrawable2.setCornerRadius(1.0E-5f);
gradientDrawable2.setColor(-1);
ColorStateList KG_ = C0459HUs.KG_(this.f.u);
if (this.f.C) {
gradientDrawable = null;
}
gradientDrawable = new RippleDrawable(KG_, gradientDrawable, this.f.C ? null : gradientDrawable2);
}
ViewCompat.sn_(this, gradientDrawable);
this.f.invalidate();
}
@Override // android.view.ViewGroup, android.view.View
protected final void drawableStateChanged() {
super.drawableStateChanged();
int[] drawableState = getDrawableState();
Drawable drawable = this.b;
if (drawable != null && drawable.isStateful() && this.b.setState(drawableState)) {
invalidate();
this.f.invalidate();
}
}
@Override // android.view.View
public final boolean performClick() {
boolean performClick = super.performClick();
if (this.h == null) {
return performClick;
}
if (!performClick) {
playSoundEffect(0);
}
RVV rvv = this.h;
TabLayout tabLayout = rvv.h;
if (tabLayout == null) {
throw new IllegalArgumentException("Tab not attached to a TabLayout");
}
tabLayout.a(rvv, true);
return true;
}
@Override // android.view.View
public final void setSelected(boolean z) {
isSelected();
super.setSelected(z);
TextView textView = this.j;
if (textView != null) {
textView.setSelected(z);
}
ImageView imageView = this.i;
if (imageView != null) {
imageView.setSelected(z);
}
View view = this.g;
if (view != null) {
view.setSelected(z);
}
}
@Override // android.view.View
public final void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
C5745byp c5745byp = this.d;
if (c5745byp != null && c5745byp.isVisible()) {
CharSequence contentDescription = getContentDescription();
StringBuilder sb = new StringBuilder();
sb.append((Object) contentDescription);
sb.append(", ");
sb.append((Object) this.d.b());
accessibilityNodeInfo.setContentDescription(sb.toString());
}
AccessibilityNodeInfoCompat tU_ = AccessibilityNodeInfoCompat.tU_(accessibilityNodeInfo);
tU_.d(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.c(0, 1, this.h.i, 1, false, isSelected()));
if (isSelected()) {
tU_.d(false);
tU_.a(AccessibilityNodeInfoCompat.AccessibilityActionCompat.e);
}
tU_.j(getResources().getString(C17052tZT.ojQ.item_view_role_description));
}
@Override // android.widget.LinearLayout, android.view.View
public final void onMeasure(int i, int i2) {
Layout layout;
int size = View.MeasureSpec.getSize(i);
int mode = View.MeasureSpec.getMode(i);
int i3 = this.f.r;
if (i3 > 0 && (mode == 0 || size > i3)) {
i = View.MeasureSpec.makeMeasureSpec(this.f.r, PKIFailureInfo.systemUnavail);
}
super.onMeasure(i, i2);
if (this.j != null) {
float f = this.f.B;
int i4 = this.n;
ImageView imageView = this.i;
if (imageView == null || imageView.getVisibility() != 0) {
TextView textView = this.j;
if (textView != null && textView.getLineCount() > 1) {
f = this.f.w;
}
} else {
i4 = 1;
}
float textSize = this.j.getTextSize();
int lineCount = this.j.getLineCount();
int vR_ = URz.vR_(this.j);
if (f != textSize || (vR_ >= 0 && i4 != vR_)) {
if (this.f.a != 1 || f <= textSize || lineCount != 1 || ((layout = this.j.getLayout()) != null && layout.getLineWidth(0) * (f / layout.getPaint().getTextSize()) <= (getMeasuredWidth() - getPaddingLeft()) - getPaddingRight())) {
this.j.setTextSize(0, f);
this.j.setMaxLines(i4);
super.onMeasure(i, i2);
}
}
}
}
public final void b() {
d();
RVV rvv = this.h;
setSelected(rvv != null && rvv.b());
}
private void a() {
ImageView imageView = (ImageView) LayoutInflater.from(getContext()).inflate(C17052tZT.tOB.design_layout_tab_icon, (ViewGroup) this, false);
this.i = imageView;
addView(imageView, 0);
}
private void c() {
TextView textView = (TextView) LayoutInflater.from(getContext()).inflate(C17052tZT.tOB.design_layout_tab_text, (ViewGroup) this, false);
this.j = textView;
addView(textView);
}
private void d(boolean z) {
setClipChildren(z);
setClipToPadding(z);
ViewGroup viewGroup = (ViewGroup) getParent();
if (viewGroup != null) {
viewGroup.setClipChildren(z);
viewGroup.setClipToPadding(z);
}
}
private void b(View view) {
if (this.d == null || view == null) {
return;
}
d(false);
C6759cbV.e(this.d, view);
this.a = view;
}
private void j() {
if (this.d != null) {
d(true);
View view = this.a;
if (view != null) {
C6759cbV.d(this.d, view);
this.a = null;
}
}
}
final void e() {
RVV rvv;
RVV rvv2;
if (this.d != null) {
if (this.g == null) {
if (this.i != null && (rvv2 = this.h) != null && rvv2.b != null) {
View view = this.a;
ImageView imageView = this.i;
if (view != imageView) {
j();
b(this.i);
return;
}
C5745byp c5745byp = this.d;
if (c5745byp == null || imageView != view) {
return;
}
Rect rect = new Rect();
imageView.getDrawingRect(rect);
c5745byp.setBounds(rect);
c5745byp.HZ_(imageView, null);
return;
}
if (this.j != null && (rvv = this.h) != null && rvv.e == 1) {
View view2 = this.a;
TextView textView = this.j;
if (view2 != textView) {
j();
b(this.j);
return;
}
C5745byp c5745byp2 = this.d;
if (c5745byp2 == null || textView != view2) {
return;
}
Rect rect2 = new Rect();
textView.getDrawingRect(rect2);
c5745byp2.setBounds(rect2);
c5745byp2.HZ_(textView, null);
return;
}
}
j();
}
}
final void LU_(TextView textView, ImageView imageView, boolean z) {
boolean z2;
RVV rvv = this.h;
Drawable mutate = (rvv == null || rvv.b == null) ? null : Tlu.pI_(this.h.b).mutate();
if (mutate != null) {
Tlu.pF_(mutate, this.f.h);
if (this.f.l != null) {
Tlu.pG_(mutate, this.f.l);
}
}
RVV rvv2 = this.h;
CharSequence charSequence = rvv2 != null ? rvv2.f : null;
if (imageView != null) {
if (mutate != null) {
imageView.setImageDrawable(mutate);
imageView.setVisibility(0);
setVisibility(0);
} else {
imageView.setVisibility(8);
imageView.setImageDrawable(null);
}
}
boolean z3 = !TextUtils.isEmpty(charSequence);
if (textView != null) {
z2 = z3 && this.h.e == 1;
textView.setText(z3 ? charSequence : null);
textView.setVisibility(z2 ? 0 : 8);
if (z3) {
setVisibility(0);
}
} else {
z2 = false;
}
if (z && imageView != null) {
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) imageView.getLayoutParams();
int applyDimension = (z2 && imageView.getVisibility() == 0) ? (int) TypedValue.applyDimension(1, 8.0f, getContext().getResources().getDisplayMetrics()) : 0;
if (this.f.e) {
if (applyDimension != CYM.rx_(marginLayoutParams)) {
CYM.rz_(marginLayoutParams, applyDimension);
marginLayoutParams.bottomMargin = 0;
imageView.setLayoutParams(marginLayoutParams);
imageView.requestLayout();
}
} else if (applyDimension != marginLayoutParams.bottomMargin) {
marginLayoutParams.bottomMargin = applyDimension;
CYM.rz_(marginLayoutParams, 0);
imageView.setLayoutParams(marginLayoutParams);
imageView.requestLayout();
}
}
RVV rvv3 = this.h;
CharSequence charSequence2 = rvv3 != null ? rvv3.a : null;
if (!z3) {
charSequence = charSequence2;
}
C6286cOZ.e(this, charSequence);
}
final void d() {
ViewParent parent;
RVV rvv = this.h;
View view = rvv != null ? rvv.c : null;
if (view != null) {
ViewParent parent2 = view.getParent();
if (parent2 != this) {
if (parent2 != null) {
((ViewGroup) parent2).removeView(view);
}
View view2 = this.g;
if (view2 != null && (parent = view2.getParent()) != null) {
((ViewGroup) parent).removeView(this.g);
}
addView(view);
}
this.g = view;
TextView textView = this.j;
if (textView != null) {
textView.setVisibility(8);
}
ImageView imageView = this.i;
if (imageView != null) {
imageView.setVisibility(8);
this.i.setImageDrawable(null);
}
TextView textView2 = (TextView) view.findViewById(R.id.text1);
this.c = textView2;
if (textView2 != null) {
this.n = URz.vR_(textView2);
}
this.e = (ImageView) view.findViewById(R.id.icon);
} else {
View view3 = this.g;
if (view3 != null) {
removeView(view3);
this.g = null;
}
this.c = null;
this.e = null;
}
if (this.g == null) {
if (this.i == null) {
a();
}
if (this.j == null) {
c();
this.n = URz.vR_(this.j);
}
URz.we_(this.j, this.f.b);
if (isSelected() && this.f.j != -1) {
URz.we_(this.j, this.f.j);
} else {
URz.we_(this.j, this.f.y);
}
if (this.f.x != null) {
this.j.setTextColor(this.f.x);
}
LU_(this.j, this.i, true);
e();
ImageView imageView2 = this.i;
if (imageView2 != null) {
imageView2.addOnLayoutChangeListener(new View.OnLayoutChangeListener(this, imageView2) { // from class: com.google.android.material.tabs.TabLayout.TabView.3
private TabView b;
private View d;
{
this.b = this;
this.d = imageView2;
}
@Override // android.view.View.OnLayoutChangeListener
public final void onLayoutChange(View view4, int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8) {
if (this.d.getVisibility() == 0) {
TabView tabView = this.b;
View view5 = this.d;
if (tabView.d == null || view5 != tabView.a) {
return;
}
C5745byp c5745byp = tabView.d;
if (view5 != tabView.i) {
TextView textView3 = tabView.j;
}
Rect rect = new Rect();
view5.getDrawingRect(rect);
c5745byp.setBounds(rect);
c5745byp.HZ_(view5, null);
}
}
});
}
TextView textView3 = this.j;
if (textView3 != null) {
textView3.addOnLayoutChangeListener(new View.OnLayoutChangeListener(this, textView3) { // from class: com.google.android.material.tabs.TabLayout.TabView.3
private TabView b;
private View d;
{
this.b = this;
this.d = textView3;
}
@Override // android.view.View.OnLayoutChangeListener
public final void onLayoutChange(View view4, int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8) {
if (this.d.getVisibility() == 0) {
TabView tabView = this.b;
View view5 = this.d;
if (tabView.d == null || view5 != tabView.a) {
return;
}
C5745byp c5745byp = tabView.d;
if (view5 != tabView.i) {
TextView textView32 = tabView.j;
}
Rect rect = new Rect();
view5.getDrawingRect(rect);
c5745byp.setBounds(rect);
c5745byp.HZ_(view5, null);
}
}
});
}
} else {
TextView textView4 = this.c;
if (textView4 != null || this.e != null) {
LU_(textView4, this.e, false);
}
}
if (rvv == null || TextUtils.isEmpty(rvv.a)) {
return;
}
setContentDescription(rvv.a);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class SlidingTabIndicator extends LinearLayout {
ValueAnimator a;
final TabLayout b;
private int d;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
SlidingTabIndicator(TabLayout tabLayout, Context context) {
super(context);
this.b = tabLayout;
this.d = -1;
setWillNotDraw(false);
}
final void b(int i) {
Rect bounds = this.b.v.getBounds();
this.b.v.setBounds(bounds.left, 0, bounds.right, i);
requestLayout();
}
final void a(int i, float f) {
this.b.c = Math.round(i + f);
ValueAnimator valueAnimator = this.a;
if (valueAnimator != null && valueAnimator.isRunning()) {
this.a.cancel();
}
c(getChildAt(i), getChildAt(i + 1), f);
}
@Override // android.widget.LinearLayout, android.view.View
public void onRtlPropertiesChanged(int i) {
super.onRtlPropertiesChanged(i);
}
@Override // android.widget.LinearLayout, android.view.View
protected void onMeasure(int i, int i2) {
super.onMeasure(i, i2);
if (View.MeasureSpec.getMode(i) != 1073741824) {
return;
}
if (this.b.g == 1 || this.b.a == 2) {
int childCount = getChildCount();
int i3 = 0;
for (int i4 = 0; i4 < childCount; i4++) {
View childAt = getChildAt(i4);
if (childAt.getVisibility() == 0) {
i3 = Math.max(i3, childAt.getMeasuredWidth());
}
}
if (i3 <= 0) {
return;
}
if (i3 * childCount <= getMeasuredWidth() - (((int) TypedValue.applyDimension(1, 16.0f, getContext().getResources().getDisplayMetrics())) << 1)) {
boolean z = false;
for (int i5 = 0; i5 < childCount; i5++) {
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) getChildAt(i5).getLayoutParams();
if (((ViewGroup.LayoutParams) layoutParams).width != i3 || layoutParams.weight != BitmapDescriptorFactory.HUE_RED) {
((ViewGroup.LayoutParams) layoutParams).width = i3;
layoutParams.weight = BitmapDescriptorFactory.HUE_RED;
z = true;
}
}
if (!z) {
return;
}
} else {
this.b.g = 0;
this.b.c(false);
}
super.onMeasure(i, i2);
}
}
@Override // android.widget.LinearLayout, android.view.ViewGroup, android.view.View
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
super.onLayout(z, i, i2, i3, i4);
ValueAnimator valueAnimator = this.a;
if (valueAnimator != null && valueAnimator.isRunning()) {
RVV rvv = this.b.f;
b(false, rvv != null ? rvv.i : -1, -1);
return;
}
if (this.b.c == -1) {
TabLayout tabLayout = this.b;
RVV rvv2 = tabLayout.f;
tabLayout.c = rvv2 != null ? rvv2.i : -1;
}
a(this.b.c);
}
final void c(View view, View view2, float f) {
if (view == null || view.getWidth() <= 0) {
this.b.v.setBounds(-1, this.b.v.getBounds().top, -1, this.b.v.getBounds().bottom);
} else {
VTa vTa = this.b.k;
TabLayout tabLayout = this.b;
vTa.LR_(tabLayout, view, view2, f, tabLayout.v);
}
ViewCompat.N(this);
}
final void b(boolean z, int i, int i2) {
if (this.b.c == i) {
return;
}
RVV rvv = this.b.f;
View childAt = getChildAt(rvv != null ? rvv.i : -1);
View childAt2 = getChildAt(i);
if (childAt2 != null) {
this.b.c = i;
ValueAnimator.AnimatorUpdateListener animatorUpdateListener = new ValueAnimator.AnimatorUpdateListener(this, childAt, childAt2) { // from class: com.google.android.material.tabs.TabLayout.SlidingTabIndicator.3
private View a;
private View c;
private SlidingTabIndicator d;
{
this.d = this;
this.c = childAt;
this.a = childAt2;
}
@Override // android.animation.ValueAnimator.AnimatorUpdateListener
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
this.d.c(this.c, this.a, valueAnimator.getAnimatedFraction());
}
};
if (z) {
ValueAnimator valueAnimator = new ValueAnimator();
this.a = valueAnimator;
valueAnimator.setInterpolator(this.b.f6483o);
valueAnimator.setDuration(i2);
valueAnimator.setFloatValues(BitmapDescriptorFactory.HUE_RED, 1.0f);
valueAnimator.addUpdateListener(animatorUpdateListener);
valueAnimator.start();
return;
}
this.a.removeAllUpdateListeners();
this.a.addUpdateListener(animatorUpdateListener);
return;
}
RVV rvv2 = this.b.f;
a(rvv2 != null ? rvv2.i : -1);
}
@Override // android.view.View
public void draw(Canvas canvas) {
int height;
int height2 = this.b.v.getBounds().height();
if (height2 < 0) {
height2 = this.b.v.getIntrinsicHeight();
}
int i = this.b.m;
if (i == 0) {
height = getHeight() - height2;
height2 = getHeight();
} else if (i != 1) {
height = 0;
if (i != 2) {
height2 = i != 3 ? 0 : getHeight();
}
} else {
height = (getHeight() - height2) / 2;
height2 = (getHeight() + height2) / 2;
}
if (this.b.v.getBounds().width() > 0) {
Rect bounds = this.b.v.getBounds();
this.b.v.setBounds(bounds.left, height, bounds.right, height2);
this.b.v.draw(canvas);
}
super.draw(canvas);
}
final void a(int i) {
if (this.b.z == 0 || (this.b.v.getBounds().left == -1 && this.b.v.getBounds().right == -1)) {
View childAt = getChildAt(i);
VTa vTa = this.b.k;
TabLayout tabLayout = this.b;
VTa.LQ_(tabLayout, childAt, tabLayout.v);
this.b.c = i;
}
}
}
private static ColorStateList LS_(int i, int i2) {
return new ColorStateList(new int[][]{SELECTED_STATE_SET, EMPTY_STATE_SET}, new int[]{i2, i});
}
@Override // android.widget.FrameLayout, android.view.ViewGroup
public FrameLayout.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
return generateDefaultLayoutParams();
}
/* loaded from: classes2.dex */
public static class saX implements ViewPager.ojQ {
int a;
int c;
private final WeakReference<TabLayout> e;
public saX(TabLayout tabLayout) {
this.e = new WeakReference<>(tabLayout);
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageScrollStateChanged(int i) {
this.c = this.a;
this.a = i;
TabLayout tabLayout = this.e.get();
if (tabLayout != null) {
tabLayout.z = this.a;
}
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageScrolled(int i, float f, int i2) {
TabLayout tabLayout = this.e.get();
if (tabLayout != null) {
int i3 = this.a;
tabLayout.d(i, f, i3 != 2 || this.c == 1, (i3 == 2 && this.c == 0) ? false : true, false);
}
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageSelected(int i) {
TabLayout tabLayout = this.e.get();
if (tabLayout != null) {
RVV rvv = tabLayout.f;
if ((rvv != null ? rvv.i : -1) == i || i >= tabLayout.A.size()) {
return;
}
int i2 = this.a;
tabLayout.a(tabLayout.a(i), i2 == 0 || (i2 == 2 && this.c == 0));
}
}
}
/* loaded from: classes2.dex */
public static class ZqN implements IeS {
private final ViewPager b;
@Override // com.google.android.material.tabs.TabLayout.Sts
public final void a(RVV rvv) {
}
@Override // com.google.android.material.tabs.TabLayout.Sts
public final void d(RVV rvv) {
}
public ZqN(ViewPager viewPager) {
this.b = viewPager;
}
@Override // com.google.android.material.tabs.TabLayout.Sts
public final void e(RVV rvv) {
this.b.setCurrentItem(rvv.i);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class HBt extends DataSetObserver {
private TabLayout d;
HBt(TabLayout tabLayout) {
this.d = tabLayout;
}
@Override // android.database.DataSetObserver
public final void onChanged() {
this.d.b();
}
@Override // android.database.DataSetObserver
public final void onInvalidated() {
this.d.b();
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class LWm implements ViewPager.LWm {
private TabLayout d;
boolean e;
LWm(TabLayout tabLayout) {
this.d = tabLayout;
}
@Override // androidx.viewpager.widget.ViewPager.LWm
public final void b(ViewPager viewPager, WYJ wyj, WYJ wyj2) {
if (this.d.D == viewPager) {
this.d.b(wyj2, this.e);
}
}
}
@Override // android.widget.HorizontalScrollView, android.view.ViewGroup
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
int i = this.a;
return (i == 0 || i == 2) && super.onInterceptTouchEvent(motionEvent);
}
public void setSelectedTabIndicatorColor(int i) {
this.ac = i;
Drawable drawable = this.v;
if (i != 0) {
Tlu.pE_(drawable, i);
} else {
Tlu.pF_(drawable, null);
}
c(false);
}
public void setTabIndicatorFullWidth(boolean z) {
this.n = z;
SlidingTabIndicator slidingTabIndicator = this.U;
RVV rvv = slidingTabIndicator.b.f;
slidingTabIndicator.a(rvv != null ? rvv.i : -1);
ViewCompat.N(this.U);
}
private int d() {
int i = this.L;
if (i != -1) {
return i;
}
int i2 = this.a;
if (i2 == 0 || i2 == 2) {
return this.R;
}
return 0;
}
}