what-the-bank/sources/me/relex/circleindicator/CircleIndicator.java

227 lines
7.6 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package me.relex.circleindicator;
import android.content.Context;
import android.database.DataSetObserver;
import android.util.AttributeSet;
import androidx.viewpager.widget.ViewPager;
import me.relex.circleindicator.BaseCircleIndicator;
import o.C15106ghN;
import o.WYJ;
/* loaded from: classes6.dex */
public class CircleIndicator extends BaseCircleIndicator {
private ViewPager a;
private final ViewPager.ojQ b;
public final DataSetObserver c;
@Override // me.relex.circleindicator.BaseCircleIndicator
public final /* bridge */ /* synthetic */ void a(int i, int i2) {
super.a(i, i2);
}
@Override // me.relex.circleindicator.BaseCircleIndicator
public final /* bridge */ /* synthetic */ void a(C15106ghN c15106ghN) {
super.a(c15106ghN);
}
@Override // me.relex.circleindicator.BaseCircleIndicator
public final /* bridge */ /* synthetic */ void b(int i) {
super.b(i);
}
@Override // me.relex.circleindicator.BaseCircleIndicator
public /* bridge */ /* synthetic */ void setIndicatorCreatedListener(BaseCircleIndicator.IeS ieS) {
super.setIndicatorCreatedListener(ieS);
}
public CircleIndicator(Context context) {
super(context);
this.b = new ViewPager.ojQ(this) { // from class: me.relex.circleindicator.CircleIndicator.3
private CircleIndicator e;
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageScrollStateChanged(int i) {
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageScrolled(int i, float f, int i2) {
}
{
this.e = this;
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageSelected(int i) {
if (this.e.a.getAdapter() == null || this.e.a.getAdapter().getCount() <= 0) {
return;
}
this.e.b(i);
}
};
this.c = new DataSetObserver(this) { // from class: me.relex.circleindicator.CircleIndicator.2
private CircleIndicator e;
{
this.e = this;
}
@Override // android.database.DataSetObserver
public final void onChanged() {
super.onChanged();
if (this.e.a == null) {
return;
}
WYJ adapter = this.e.a.getAdapter();
int count = adapter != null ? adapter.getCount() : 0;
if (count == this.e.getChildCount()) {
return;
}
if (this.e.e < count) {
CircleIndicator circleIndicator = this.e;
circleIndicator.e = circleIndicator.a.getCurrentItem();
} else {
this.e.e = -1;
}
this.e.d();
}
};
}
public CircleIndicator(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.b = new ViewPager.ojQ(this) { // from class: me.relex.circleindicator.CircleIndicator.3
private CircleIndicator e;
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageScrollStateChanged(int i) {
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageScrolled(int i, float f, int i2) {
}
{
this.e = this;
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageSelected(int i) {
if (this.e.a.getAdapter() == null || this.e.a.getAdapter().getCount() <= 0) {
return;
}
this.e.b(i);
}
};
this.c = new DataSetObserver(this) { // from class: me.relex.circleindicator.CircleIndicator.2
private CircleIndicator e;
{
this.e = this;
}
@Override // android.database.DataSetObserver
public final void onChanged() {
super.onChanged();
if (this.e.a == null) {
return;
}
WYJ adapter = this.e.a.getAdapter();
int count = adapter != null ? adapter.getCount() : 0;
if (count == this.e.getChildCount()) {
return;
}
if (this.e.e < count) {
CircleIndicator circleIndicator = this.e;
circleIndicator.e = circleIndicator.a.getCurrentItem();
} else {
this.e.e = -1;
}
this.e.d();
}
};
}
public CircleIndicator(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.b = new ViewPager.ojQ(this) { // from class: me.relex.circleindicator.CircleIndicator.3
private CircleIndicator e;
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageScrollStateChanged(int i2) {
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageScrolled(int i2, float f, int i22) {
}
{
this.e = this;
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageSelected(int i2) {
if (this.e.a.getAdapter() == null || this.e.a.getAdapter().getCount() <= 0) {
return;
}
this.e.b(i2);
}
};
this.c = new DataSetObserver(this) { // from class: me.relex.circleindicator.CircleIndicator.2
private CircleIndicator e;
{
this.e = this;
}
@Override // android.database.DataSetObserver
public final void onChanged() {
super.onChanged();
if (this.e.a == null) {
return;
}
WYJ adapter = this.e.a.getAdapter();
int count = adapter != null ? adapter.getCount() : 0;
if (count == this.e.getChildCount()) {
return;
}
if (this.e.e < count) {
CircleIndicator circleIndicator = this.e;
circleIndicator.e = circleIndicator.a.getCurrentItem();
} else {
this.e.e = -1;
}
this.e.d();
}
};
}
public void setViewPager(ViewPager viewPager) {
this.a = viewPager;
if (viewPager == null || viewPager.getAdapter() == null) {
return;
}
this.e = -1;
d();
this.a.removeOnPageChangeListener(this.b);
this.a.addOnPageChangeListener(this.b);
this.b.onPageSelected(this.a.getCurrentItem());
}
/* JADX INFO: Access modifiers changed from: private */
public void d() {
WYJ adapter = this.a.getAdapter();
super.a(adapter == null ? 0 : adapter.getCount(), this.a.getCurrentItem());
}
@Deprecated
public void setOnPageChangeListener(ViewPager.ojQ ojq) {
ViewPager viewPager = this.a;
if (viewPager == null) {
throw new NullPointerException("can not find Viewpager , setViewPager first");
}
viewPager.removeOnPageChangeListener(ojq);
this.a.addOnPageChangeListener(ojq);
}
}