Rabbit-R1/original r1/java/sources/androidx/viewpager2/widget/CompositeOnPageChangeCallback.java

68 lines
2.6 KiB
Java
Raw Normal View History

2024-05-21 16:08:36 -05:00
package androidx.viewpager2.widget;
import androidx.viewpager2.widget.ViewPager2;
import java.util.ArrayList;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.List;
/* loaded from: classes2.dex */
final class CompositeOnPageChangeCallback extends ViewPager2.OnPageChangeCallback {
private final List<ViewPager2.OnPageChangeCallback> mCallbacks;
/* JADX INFO: Access modifiers changed from: package-private */
public CompositeOnPageChangeCallback(int i) {
this.mCallbacks = new ArrayList(i);
}
/* JADX INFO: Access modifiers changed from: package-private */
public void addOnPageChangeCallback(ViewPager2.OnPageChangeCallback onPageChangeCallback) {
this.mCallbacks.add(onPageChangeCallback);
}
/* JADX INFO: Access modifiers changed from: package-private */
public void removeOnPageChangeCallback(ViewPager2.OnPageChangeCallback onPageChangeCallback) {
this.mCallbacks.remove(onPageChangeCallback);
}
@Override // androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
public void onPageScrolled(int i, float f, int i2) {
try {
Iterator<ViewPager2.OnPageChangeCallback> it = this.mCallbacks.iterator();
while (it.hasNext()) {
it.next().onPageScrolled(i, f, i2);
}
} catch (ConcurrentModificationException e) {
throwCallbackListModifiedWhileInUse(e);
}
}
@Override // androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
public void onPageSelected(int i) {
try {
Iterator<ViewPager2.OnPageChangeCallback> it = this.mCallbacks.iterator();
while (it.hasNext()) {
it.next().onPageSelected(i);
}
} catch (ConcurrentModificationException e) {
throwCallbackListModifiedWhileInUse(e);
}
}
@Override // androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
public void onPageScrollStateChanged(int i) {
try {
Iterator<ViewPager2.OnPageChangeCallback> it = this.mCallbacks.iterator();
while (it.hasNext()) {
it.next().onPageScrollStateChanged(i);
}
} catch (ConcurrentModificationException e) {
throwCallbackListModifiedWhileInUse(e);
}
}
private void throwCallbackListModifiedWhileInUse(ConcurrentModificationException concurrentModificationException) {
throw new IllegalStateException("Adding and removing callbacks during dispatch to callbacks is not supported", concurrentModificationException);
}
}