202 lines
6.2 KiB
Java
202 lines
6.2 KiB
Java
package o;
|
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import androidx.viewpager2.widget.ViewPager2;
|
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
import com.google.android.material.tabs.TabLayout;
|
|
import java.lang.ref.WeakReference;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class MrX {
|
|
private RecyclerView.Sts<?> a;
|
|
private final boolean b;
|
|
private IeS c;
|
|
private boolean d;
|
|
private TabLayout.IeS e;
|
|
private final ViewPager2 f;
|
|
private RecyclerView.LWm g;
|
|
private final TabLayout h;
|
|
private final Sts i;
|
|
private final boolean j;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public interface Sts {
|
|
void b(TabLayout.RVV rvv, int i);
|
|
}
|
|
|
|
public MrX(TabLayout tabLayout, ViewPager2 viewPager2, Sts sts) {
|
|
this(tabLayout, viewPager2, sts, (byte) 0);
|
|
}
|
|
|
|
private MrX(TabLayout tabLayout, ViewPager2 viewPager2, Sts sts, byte b) {
|
|
this(tabLayout, viewPager2, sts, (char) 0);
|
|
}
|
|
|
|
private MrX(TabLayout tabLayout, ViewPager2 viewPager2, Sts sts, char c) {
|
|
this.h = tabLayout;
|
|
this.f = viewPager2;
|
|
this.b = true;
|
|
this.j = true;
|
|
this.i = sts;
|
|
}
|
|
|
|
public final void b() {
|
|
if (this.d) {
|
|
throw new IllegalStateException("TabLayoutMediator is already attached");
|
|
}
|
|
RecyclerView.Sts<?> sts = this.f.f.g;
|
|
this.a = sts;
|
|
if (sts == null) {
|
|
throw new IllegalStateException("TabLayoutMediator attached before ViewPager2 has an adapter");
|
|
}
|
|
this.d = true;
|
|
IeS ieS = new IeS(this.h);
|
|
this.c = ieS;
|
|
this.f.a.e.add(ieS);
|
|
RVV rvv = new RVV(this.f, this.j);
|
|
this.e = rvv;
|
|
TabLayout tabLayout = this.h;
|
|
if (!tabLayout.d.contains(rvv)) {
|
|
tabLayout.d.add(rvv);
|
|
}
|
|
if (this.b) {
|
|
LWm lWm = new LWm(this);
|
|
this.g = lWm;
|
|
this.a.registerAdapterDataObserver(lWm);
|
|
}
|
|
a();
|
|
this.h.setScrollPosition(this.f.d, BitmapDescriptorFactory.HUE_RED, true);
|
|
}
|
|
|
|
final void a() {
|
|
this.h.a();
|
|
RecyclerView.Sts<?> sts = this.a;
|
|
if (sts != null) {
|
|
int itemCount = sts.getItemCount();
|
|
for (int i = 0; i < itemCount; i++) {
|
|
TabLayout.RVV c = this.h.c();
|
|
this.i.b(c, i);
|
|
TabLayout tabLayout = this.h;
|
|
tabLayout.d(c, tabLayout.A.size(), false);
|
|
}
|
|
if (itemCount > 0) {
|
|
int min = Math.min(this.f.d, this.h.A.size() - 1);
|
|
TabLayout.RVV rvv = this.h.f;
|
|
if (min != (rvv != null ? rvv.i : -1)) {
|
|
TabLayout tabLayout2 = this.h;
|
|
tabLayout2.a(tabLayout2.a(min), true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public static class IeS extends ViewPager2.IeS {
|
|
private final WeakReference<TabLayout> d;
|
|
private int e = 0;
|
|
private int c = 0;
|
|
|
|
IeS(TabLayout tabLayout) {
|
|
this.d = new WeakReference<>(tabLayout);
|
|
}
|
|
|
|
@Override // androidx.viewpager2.widget.ViewPager2.IeS
|
|
public final void b(int i) {
|
|
this.c = this.e;
|
|
this.e = i;
|
|
TabLayout tabLayout = this.d.get();
|
|
if (tabLayout != null) {
|
|
tabLayout.z = this.e;
|
|
}
|
|
}
|
|
|
|
@Override // androidx.viewpager2.widget.ViewPager2.IeS
|
|
public final void d(int i, float f, int i2) {
|
|
TabLayout tabLayout = this.d.get();
|
|
if (tabLayout != null) {
|
|
int i3 = this.e;
|
|
tabLayout.d(i, f, i3 != 2 || this.c == 1, (i3 == 2 && this.c == 0) ? false : true, false);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.viewpager2.widget.ViewPager2.IeS
|
|
public final void c(int i) {
|
|
TabLayout tabLayout = this.d.get();
|
|
if (tabLayout != null) {
|
|
TabLayout.RVV rvv = tabLayout.f;
|
|
if ((rvv != null ? rvv.i : -1) == i || i >= tabLayout.A.size()) {
|
|
return;
|
|
}
|
|
int i2 = this.e;
|
|
tabLayout.a(tabLayout.a(i), i2 == 0 || (i2 == 2 && this.c == 0));
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public static class RVV implements TabLayout.IeS {
|
|
private final ViewPager2 a;
|
|
private final boolean e;
|
|
|
|
@Override // com.google.android.material.tabs.TabLayout.Sts
|
|
public final void a(TabLayout.RVV rvv) {
|
|
}
|
|
|
|
@Override // com.google.android.material.tabs.TabLayout.Sts
|
|
public final void d(TabLayout.RVV rvv) {
|
|
}
|
|
|
|
RVV(ViewPager2 viewPager2, boolean z) {
|
|
this.a = viewPager2;
|
|
this.e = z;
|
|
}
|
|
|
|
@Override // com.google.android.material.tabs.TabLayout.Sts
|
|
public final void e(TabLayout.RVV rvv) {
|
|
this.a.setCurrentItem(rvv.i, this.e);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public class LWm extends RecyclerView.LWm {
|
|
private MrX b;
|
|
|
|
LWm(MrX mrX) {
|
|
this.b = mrX;
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.LWm
|
|
public final void c() {
|
|
this.b.a();
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.LWm
|
|
public final void c(int i, int i2) {
|
|
this.b.a();
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.LWm
|
|
public final void c(int i, int i2, Object obj) {
|
|
this.b.a();
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.LWm
|
|
public final void b(int i, int i2) {
|
|
this.b.a();
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.LWm
|
|
public final void a(int i, int i2) {
|
|
this.b.a();
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.LWm
|
|
public final void d(int i, int i2) {
|
|
this.b.a();
|
|
}
|
|
}
|
|
}
|