2207 lines
76 KiB
Java
2207 lines
76 KiB
Java
package androidx.viewpager.widget;
|
|
|
|
import android.R;
|
|
import android.content.Context;
|
|
import android.content.res.TypedArray;
|
|
import android.database.DataSetObserver;
|
|
import android.graphics.Canvas;
|
|
import android.graphics.Rect;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.os.Bundle;
|
|
import android.os.Parcel;
|
|
import android.os.Parcelable;
|
|
import android.os.SystemClock;
|
|
import android.util.AttributeSet;
|
|
import android.view.KeyEvent;
|
|
import android.view.MotionEvent;
|
|
import android.view.VelocityTracker;
|
|
import android.view.View;
|
|
import android.view.ViewConfiguration;
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewParent;
|
|
import android.view.accessibility.AccessibilityEvent;
|
|
import android.view.animation.Interpolator;
|
|
import android.widget.EdgeEffect;
|
|
import android.widget.Scroller;
|
|
import androidx.core.view.ViewCompat;
|
|
import androidx.core.view.WindowInsetsCompat;
|
|
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
|
|
import com.airbnb.deeplinkdispatch.UrlTreeKt;
|
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
import java.lang.annotation.ElementType;
|
|
import java.lang.annotation.Inherited;
|
|
import java.lang.annotation.Retention;
|
|
import java.lang.annotation.RetentionPolicy;
|
|
import java.lang.annotation.Target;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.List;
|
|
import o.LbT;
|
|
import o.WYJ;
|
|
import o.XgG;
|
|
import o.nMh;
|
|
import o.yZt;
|
|
import org.bouncycastle.asn1.cmp.PKIFailureInfo;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class ViewPager extends ViewGroup {
|
|
private static final int CLOSE_ENOUGH = 2;
|
|
private static final boolean DEBUG = false;
|
|
private static final int DEFAULT_GUTTER_SIZE = 16;
|
|
private static final int DEFAULT_OFFSCREEN_PAGES = 1;
|
|
private static final int DRAW_ORDER_DEFAULT = 0;
|
|
private static final int DRAW_ORDER_FORWARD = 1;
|
|
private static final int DRAW_ORDER_REVERSE = 2;
|
|
private static final int INVALID_POINTER = -1;
|
|
private static final int MAX_SETTLE_DURATION = 600;
|
|
private static final int MIN_DISTANCE_FOR_FLING = 25;
|
|
private static final int MIN_FLING_VELOCITY = 400;
|
|
public static final int SCROLL_STATE_DRAGGING = 1;
|
|
public static final int SCROLL_STATE_IDLE = 0;
|
|
public static final int SCROLL_STATE_SETTLING = 2;
|
|
private static final String TAG = "ViewPager";
|
|
private static final boolean USE_CACHE = false;
|
|
private int mActivePointerId;
|
|
WYJ mAdapter;
|
|
private List<LWm> mAdapterChangeListeners;
|
|
private int mBottomPageBounds;
|
|
private boolean mCalledSuper;
|
|
private int mChildHeightMeasureSpec;
|
|
private int mChildWidthMeasureSpec;
|
|
private int mCloseEnough;
|
|
int mCurItem;
|
|
private int mDecorChildCount;
|
|
private int mDefaultGutterSize;
|
|
private int mDrawingOrder;
|
|
private ArrayList<View> mDrawingOrderedChildren;
|
|
private final Runnable mEndScrollRunnable;
|
|
private int mExpectedAdapterCount;
|
|
private long mFakeDragBeginTime;
|
|
private boolean mFakeDragging;
|
|
private boolean mFirstLayout;
|
|
private float mFirstOffset;
|
|
private int mFlingDistance;
|
|
private int mGutterSize;
|
|
private boolean mInLayout;
|
|
private float mInitialMotionX;
|
|
private float mInitialMotionY;
|
|
private ojQ mInternalPageChangeListener;
|
|
private boolean mIsBeingDragged;
|
|
private boolean mIsScrollStarted;
|
|
private boolean mIsUnableToDrag;
|
|
private final ArrayList<Sts> mItems;
|
|
private float mLastMotionX;
|
|
private float mLastMotionY;
|
|
private float mLastOffset;
|
|
private EdgeEffect mLeftEdge;
|
|
private Drawable mMarginDrawable;
|
|
private int mMaximumVelocity;
|
|
private int mMinimumVelocity;
|
|
private boolean mNeedCalculatePageOffsets;
|
|
private ZqN mObserver;
|
|
private int mOffscreenPageLimit;
|
|
private ojQ mOnPageChangeListener;
|
|
private List<ojQ> mOnPageChangeListeners;
|
|
private int mPageMargin;
|
|
private tOB mPageTransformer;
|
|
private int mPageTransformerLayerType;
|
|
private boolean mPopulatePending;
|
|
private Parcelable mRestoredAdapterState;
|
|
private ClassLoader mRestoredClassLoader;
|
|
private int mRestoredCurItem;
|
|
private EdgeEffect mRightEdge;
|
|
private int mScrollState;
|
|
private Scroller mScroller;
|
|
private boolean mScrollingCacheEnabled;
|
|
private final Sts mTempItem;
|
|
private final Rect mTempRect;
|
|
private int mTopPageBounds;
|
|
private int mTouchSlop;
|
|
private VelocityTracker mVelocityTracker;
|
|
static final int[] LAYOUT_ATTRS = {R.attr.layout_gravity};
|
|
private static final Comparator<Sts> COMPARATOR = new Comparator<Sts>() { // from class: androidx.viewpager.widget.ViewPager.1
|
|
@Override // java.util.Comparator
|
|
public final /* bridge */ /* synthetic */ int compare(Sts sts, Sts sts2) {
|
|
return sts.a - sts2.a;
|
|
}
|
|
};
|
|
private static final Interpolator sInterpolator = new Interpolator() { // from class: androidx.viewpager.widget.ViewPager.5
|
|
@Override // android.animation.TimeInterpolator
|
|
public final float getInterpolation(float f) {
|
|
float f2 = f - 1.0f;
|
|
return (f2 * f2 * f2 * f2 * f2) + 1.0f;
|
|
}
|
|
};
|
|
private static final vUG sPositionComparator = new vUG();
|
|
|
|
/* loaded from: classes.dex */
|
|
public interface LWm {
|
|
void b(ViewPager viewPager, WYJ wyj, WYJ wyj2);
|
|
}
|
|
|
|
@Target({ElementType.TYPE})
|
|
@Inherited
|
|
@Retention(RetentionPolicy.RUNTIME)
|
|
/* loaded from: classes.dex */
|
|
public @interface RVV {
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public static class jbe implements ojQ {
|
|
@Override // androidx.viewpager.widget.ViewPager.ojQ
|
|
public void onPageScrollStateChanged(int i) {
|
|
}
|
|
|
|
@Override // androidx.viewpager.widget.ViewPager.ojQ
|
|
public void onPageScrolled(int i, float f, int i2) {
|
|
}
|
|
|
|
@Override // androidx.viewpager.widget.ViewPager.ojQ
|
|
public void onPageSelected(int i) {
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public interface ojQ {
|
|
void onPageScrollStateChanged(int i);
|
|
|
|
void onPageScrolled(int i, float f, int i2);
|
|
|
|
void onPageSelected(int i);
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public interface tOB {
|
|
void transformPage(View view, float f);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public static class Sts {
|
|
int a;
|
|
float b;
|
|
float c;
|
|
boolean d;
|
|
Object e;
|
|
|
|
Sts() {
|
|
}
|
|
}
|
|
|
|
public ViewPager(Context context) {
|
|
super(context);
|
|
this.mItems = new ArrayList<>();
|
|
this.mTempItem = new Sts();
|
|
this.mTempRect = new Rect();
|
|
this.mRestoredCurItem = -1;
|
|
this.mRestoredAdapterState = null;
|
|
this.mRestoredClassLoader = null;
|
|
this.mFirstOffset = -3.4028235E38f;
|
|
this.mLastOffset = Float.MAX_VALUE;
|
|
this.mOffscreenPageLimit = 1;
|
|
this.mActivePointerId = -1;
|
|
this.mFirstLayout = true;
|
|
this.mNeedCalculatePageOffsets = false;
|
|
this.mEndScrollRunnable = new Runnable(this) { // from class: androidx.viewpager.widget.ViewPager.2
|
|
final ViewPager b;
|
|
|
|
{
|
|
this.b = this;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
this.b.setScrollState(0);
|
|
this.b.populate();
|
|
}
|
|
};
|
|
this.mScrollState = 0;
|
|
initViewPager();
|
|
}
|
|
|
|
public ViewPager(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
this.mItems = new ArrayList<>();
|
|
this.mTempItem = new Sts();
|
|
this.mTempRect = new Rect();
|
|
this.mRestoredCurItem = -1;
|
|
this.mRestoredAdapterState = null;
|
|
this.mRestoredClassLoader = null;
|
|
this.mFirstOffset = -3.4028235E38f;
|
|
this.mLastOffset = Float.MAX_VALUE;
|
|
this.mOffscreenPageLimit = 1;
|
|
this.mActivePointerId = -1;
|
|
this.mFirstLayout = true;
|
|
this.mNeedCalculatePageOffsets = false;
|
|
this.mEndScrollRunnable = new Runnable(this) { // from class: androidx.viewpager.widget.ViewPager.2
|
|
final ViewPager b;
|
|
|
|
{
|
|
this.b = this;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
this.b.setScrollState(0);
|
|
this.b.populate();
|
|
}
|
|
};
|
|
this.mScrollState = 0;
|
|
initViewPager();
|
|
}
|
|
|
|
void initViewPager() {
|
|
setWillNotDraw(false);
|
|
setDescendantFocusability(262144);
|
|
setFocusable(true);
|
|
Context context = getContext();
|
|
this.mScroller = new Scroller(context, sInterpolator);
|
|
ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
|
|
float f = context.getResources().getDisplayMetrics().density;
|
|
this.mTouchSlop = viewConfiguration.getScaledPagingTouchSlop();
|
|
this.mMinimumVelocity = (int) (400.0f * f);
|
|
this.mMaximumVelocity = viewConfiguration.getScaledMaximumFlingVelocity();
|
|
this.mLeftEdge = new EdgeEffect(context);
|
|
this.mRightEdge = new EdgeEffect(context);
|
|
this.mFlingDistance = (int) (25.0f * f);
|
|
this.mCloseEnough = (int) (2.0f * f);
|
|
this.mDefaultGutterSize = (int) (f * 16.0f);
|
|
ViewCompat.e(this, new HBt(this));
|
|
if (ViewCompat.n(this) == 0) {
|
|
ViewCompat.g(this, 1);
|
|
}
|
|
ViewCompat.c(this, new LbT(this) { // from class: androidx.viewpager.widget.ViewPager.4
|
|
final ViewPager b;
|
|
private final Rect d = new Rect();
|
|
|
|
{
|
|
this.b = this;
|
|
}
|
|
|
|
@Override // o.LbT
|
|
public final WindowInsetsCompat e(View view, WindowInsetsCompat windowInsetsCompat) {
|
|
WindowInsetsCompat e = ViewCompat.e(view, windowInsetsCompat);
|
|
if (e.h()) {
|
|
return e;
|
|
}
|
|
Rect rect = this.d;
|
|
rect.left = e.g();
|
|
rect.top = e.i();
|
|
rect.right = e.j();
|
|
rect.bottom = e.f();
|
|
int childCount = this.b.getChildCount();
|
|
for (int i = 0; i < childCount; i++) {
|
|
WindowInsetsCompat b = ViewCompat.b(this.b.getChildAt(i), e);
|
|
rect.left = Math.min(b.g(), rect.left);
|
|
rect.top = Math.min(b.i(), rect.top);
|
|
rect.right = Math.min(b.j(), rect.right);
|
|
rect.bottom = Math.min(b.f(), rect.bottom);
|
|
}
|
|
return e.e(rect.left, rect.top, rect.right, rect.bottom);
|
|
}
|
|
});
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onDetachedFromWindow() {
|
|
removeCallbacks(this.mEndScrollRunnable);
|
|
Scroller scroller = this.mScroller;
|
|
if (scroller != null && !scroller.isFinished()) {
|
|
this.mScroller.abortAnimation();
|
|
}
|
|
super.onDetachedFromWindow();
|
|
}
|
|
|
|
void setScrollState(int i) {
|
|
if (this.mScrollState == i) {
|
|
return;
|
|
}
|
|
this.mScrollState = i;
|
|
if (this.mPageTransformer != null) {
|
|
enableLayers(i != 0);
|
|
}
|
|
dispatchOnScrollStateChanged(i);
|
|
}
|
|
|
|
public void setAdapter(WYJ wyj) {
|
|
WYJ wyj2 = this.mAdapter;
|
|
if (wyj2 != null) {
|
|
wyj2.setViewPagerObserver(null);
|
|
this.mAdapter.startUpdate((ViewGroup) this);
|
|
for (int i = 0; i < this.mItems.size(); i++) {
|
|
Sts sts = this.mItems.get(i);
|
|
this.mAdapter.destroyItem((ViewGroup) this, sts.a, sts.e);
|
|
}
|
|
this.mAdapter.finishUpdate((ViewGroup) this);
|
|
this.mItems.clear();
|
|
removeNonDecorViews();
|
|
this.mCurItem = 0;
|
|
scrollTo(0, 0);
|
|
}
|
|
WYJ wyj3 = this.mAdapter;
|
|
this.mAdapter = wyj;
|
|
this.mExpectedAdapterCount = 0;
|
|
if (wyj != null) {
|
|
if (this.mObserver == null) {
|
|
this.mObserver = new ZqN(this);
|
|
}
|
|
this.mAdapter.setViewPagerObserver(this.mObserver);
|
|
this.mPopulatePending = false;
|
|
boolean z = this.mFirstLayout;
|
|
this.mFirstLayout = true;
|
|
this.mExpectedAdapterCount = this.mAdapter.getCount();
|
|
if (this.mRestoredCurItem >= 0) {
|
|
this.mAdapter.restoreState(this.mRestoredAdapterState, this.mRestoredClassLoader);
|
|
setCurrentItemInternal(this.mRestoredCurItem, false, true);
|
|
this.mRestoredCurItem = -1;
|
|
this.mRestoredAdapterState = null;
|
|
this.mRestoredClassLoader = null;
|
|
} else if (!z) {
|
|
populate();
|
|
} else {
|
|
requestLayout();
|
|
}
|
|
}
|
|
List<LWm> list = this.mAdapterChangeListeners;
|
|
if (list == null || list.isEmpty()) {
|
|
return;
|
|
}
|
|
int size = this.mAdapterChangeListeners.size();
|
|
for (int i2 = 0; i2 < size; i2++) {
|
|
this.mAdapterChangeListeners.get(i2).b(this, wyj3, wyj);
|
|
}
|
|
}
|
|
|
|
private void removeNonDecorViews() {
|
|
int i = 0;
|
|
while (i < getChildCount()) {
|
|
if (!((IeS) getChildAt(i).getLayoutParams()).c) {
|
|
removeViewAt(i);
|
|
i--;
|
|
}
|
|
i++;
|
|
}
|
|
}
|
|
|
|
public void addOnAdapterChangeListener(LWm lWm) {
|
|
if (this.mAdapterChangeListeners == null) {
|
|
this.mAdapterChangeListeners = new ArrayList();
|
|
}
|
|
this.mAdapterChangeListeners.add(lWm);
|
|
}
|
|
|
|
public void removeOnAdapterChangeListener(LWm lWm) {
|
|
List<LWm> list = this.mAdapterChangeListeners;
|
|
if (list != null) {
|
|
list.remove(lWm);
|
|
}
|
|
}
|
|
|
|
private int getClientWidth() {
|
|
return (getMeasuredWidth() - getPaddingLeft()) - getPaddingRight();
|
|
}
|
|
|
|
public void setCurrentItem(int i) {
|
|
this.mPopulatePending = false;
|
|
setCurrentItemInternal(i, !this.mFirstLayout, false);
|
|
}
|
|
|
|
public void setCurrentItem(int i, boolean z) {
|
|
this.mPopulatePending = false;
|
|
setCurrentItemInternal(i, z, false);
|
|
}
|
|
|
|
void setCurrentItemInternal(int i, boolean z, boolean z2) {
|
|
setCurrentItemInternal(i, z, z2, 0);
|
|
}
|
|
|
|
void setCurrentItemInternal(int i, boolean z, boolean z2, int i2) {
|
|
WYJ wyj = this.mAdapter;
|
|
if (wyj == null || wyj.getCount() <= 0) {
|
|
setScrollingCacheEnabled(false);
|
|
return;
|
|
}
|
|
if (!z2 && this.mCurItem == i && this.mItems.size() != 0) {
|
|
setScrollingCacheEnabled(false);
|
|
return;
|
|
}
|
|
if (i < 0) {
|
|
i = 0;
|
|
} else if (i >= this.mAdapter.getCount()) {
|
|
i = this.mAdapter.getCount() - 1;
|
|
}
|
|
int i3 = this.mOffscreenPageLimit;
|
|
int i4 = this.mCurItem;
|
|
if (i > i4 + i3 || i < i4 - i3) {
|
|
for (int i5 = 0; i5 < this.mItems.size(); i5++) {
|
|
this.mItems.get(i5).d = true;
|
|
}
|
|
}
|
|
boolean z3 = this.mCurItem != i;
|
|
if (this.mFirstLayout) {
|
|
this.mCurItem = i;
|
|
if (z3) {
|
|
dispatchOnPageSelected(i);
|
|
}
|
|
requestLayout();
|
|
return;
|
|
}
|
|
populate(i);
|
|
scrollToItem(i, z, i2, z3);
|
|
}
|
|
|
|
private void scrollToItem(int i, boolean z, int i2, boolean z2) {
|
|
Sts infoForPosition = infoForPosition(i);
|
|
int clientWidth = infoForPosition != null ? (int) (getClientWidth() * Math.max(this.mFirstOffset, Math.min(infoForPosition.b, this.mLastOffset))) : 0;
|
|
if (z) {
|
|
smoothScrollTo(clientWidth, 0, i2);
|
|
if (z2) {
|
|
dispatchOnPageSelected(i);
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
if (z2) {
|
|
dispatchOnPageSelected(i);
|
|
}
|
|
completeScroll(false);
|
|
scrollTo(clientWidth, 0);
|
|
pageScrolled(clientWidth);
|
|
}
|
|
|
|
public void addOnPageChangeListener(ojQ ojq) {
|
|
if (this.mOnPageChangeListeners == null) {
|
|
this.mOnPageChangeListeners = new ArrayList();
|
|
}
|
|
this.mOnPageChangeListeners.add(ojq);
|
|
}
|
|
|
|
public void removeOnPageChangeListener(ojQ ojq) {
|
|
List<ojQ> list = this.mOnPageChangeListeners;
|
|
if (list != null) {
|
|
list.remove(ojq);
|
|
}
|
|
}
|
|
|
|
public void clearOnPageChangeListeners() {
|
|
List<ojQ> list = this.mOnPageChangeListeners;
|
|
if (list != null) {
|
|
list.clear();
|
|
}
|
|
}
|
|
|
|
public void setPageTransformer(boolean z, tOB tob) {
|
|
setPageTransformer(z, tob, 2);
|
|
}
|
|
|
|
public void setPageTransformer(boolean z, tOB tob, int i) {
|
|
boolean z2 = tob != null;
|
|
boolean z3 = z2 != (this.mPageTransformer != null);
|
|
this.mPageTransformer = tob;
|
|
setChildrenDrawingOrderEnabled(z2);
|
|
if (z2) {
|
|
this.mDrawingOrder = z ? 2 : 1;
|
|
this.mPageTransformerLayerType = i;
|
|
} else {
|
|
this.mDrawingOrder = 0;
|
|
}
|
|
if (z3) {
|
|
populate();
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
protected int getChildDrawingOrder(int i, int i2) {
|
|
if (this.mDrawingOrder == 2) {
|
|
i2 = (i - 1) - i2;
|
|
}
|
|
return ((IeS) this.mDrawingOrderedChildren.get(i2).getLayoutParams()).e;
|
|
}
|
|
|
|
public void setOffscreenPageLimit(int i) {
|
|
if (i <= 0) {
|
|
i = 1;
|
|
}
|
|
if (i != this.mOffscreenPageLimit) {
|
|
this.mOffscreenPageLimit = i;
|
|
populate();
|
|
}
|
|
}
|
|
|
|
public void setPageMargin(int i) {
|
|
int i2 = this.mPageMargin;
|
|
this.mPageMargin = i;
|
|
int width = getWidth();
|
|
recomputeScrollPosition(width, width, i, i2);
|
|
requestLayout();
|
|
}
|
|
|
|
public void setPageMarginDrawable(Drawable drawable) {
|
|
this.mMarginDrawable = drawable;
|
|
if (drawable != null) {
|
|
refreshDrawableState();
|
|
}
|
|
setWillNotDraw(drawable == null);
|
|
invalidate();
|
|
}
|
|
|
|
public void setPageMarginDrawable(int i) {
|
|
setPageMarginDrawable(nMh.getDrawable(getContext(), i));
|
|
}
|
|
|
|
@Override // android.view.View
|
|
protected boolean verifyDrawable(Drawable drawable) {
|
|
return super.verifyDrawable(drawable) || drawable == this.mMarginDrawable;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
protected void drawableStateChanged() {
|
|
super.drawableStateChanged();
|
|
Drawable drawable = this.mMarginDrawable;
|
|
if (drawable == null || !drawable.isStateful()) {
|
|
return;
|
|
}
|
|
drawable.setState(getDrawableState());
|
|
}
|
|
|
|
float distanceInfluenceForSnapDuration(float f) {
|
|
return (float) Math.sin((f - 0.5f) * 0.47123894f);
|
|
}
|
|
|
|
void smoothScrollTo(int i, int i2) {
|
|
smoothScrollTo(i, i2, 0);
|
|
}
|
|
|
|
void smoothScrollTo(int i, int i2, int i3) {
|
|
int scrollX;
|
|
int abs;
|
|
if (getChildCount() == 0) {
|
|
setScrollingCacheEnabled(false);
|
|
return;
|
|
}
|
|
Scroller scroller = this.mScroller;
|
|
if (scroller != null && !scroller.isFinished()) {
|
|
scrollX = this.mIsScrollStarted ? this.mScroller.getCurrX() : this.mScroller.getStartX();
|
|
this.mScroller.abortAnimation();
|
|
setScrollingCacheEnabled(false);
|
|
} else {
|
|
scrollX = getScrollX();
|
|
}
|
|
int i4 = scrollX;
|
|
int scrollY = getScrollY();
|
|
int i5 = i - i4;
|
|
int i6 = i2 - scrollY;
|
|
if (i5 == 0 && i6 == 0) {
|
|
completeScroll(false);
|
|
populate();
|
|
setScrollState(0);
|
|
return;
|
|
}
|
|
setScrollingCacheEnabled(true);
|
|
setScrollState(2);
|
|
int clientWidth = getClientWidth();
|
|
int i7 = clientWidth / 2;
|
|
float f = clientWidth;
|
|
float f2 = i7;
|
|
float distanceInfluenceForSnapDuration = distanceInfluenceForSnapDuration(Math.min(1.0f, Math.abs(i5) / f));
|
|
int abs2 = Math.abs(i3);
|
|
if (abs2 > 0) {
|
|
abs = Math.round(Math.abs((f2 + (distanceInfluenceForSnapDuration * f2)) / abs2) * 1000.0f) << 2;
|
|
} else {
|
|
abs = (int) (((Math.abs(i5) / ((f * this.mAdapter.getPageWidth(this.mCurItem)) + this.mPageMargin)) + 1.0f) * 100.0f);
|
|
}
|
|
int min = Math.min(abs, MAX_SETTLE_DURATION);
|
|
this.mIsScrollStarted = false;
|
|
this.mScroller.startScroll(i4, scrollY, i5, i6, min);
|
|
ViewCompat.N(this);
|
|
}
|
|
|
|
Sts addNewItem(int i, int i2) {
|
|
Sts sts = new Sts();
|
|
sts.a = i;
|
|
sts.e = this.mAdapter.instantiateItem((ViewGroup) this, i);
|
|
sts.c = this.mAdapter.getPageWidth(i);
|
|
if (i2 < 0 || i2 >= this.mItems.size()) {
|
|
this.mItems.add(sts);
|
|
} else {
|
|
this.mItems.add(i2, sts);
|
|
}
|
|
return sts;
|
|
}
|
|
|
|
void dataSetChanged() {
|
|
int count = this.mAdapter.getCount();
|
|
this.mExpectedAdapterCount = count;
|
|
boolean z = this.mItems.size() < (this.mOffscreenPageLimit << 1) + 1 && this.mItems.size() < count;
|
|
int i = this.mCurItem;
|
|
int i2 = 0;
|
|
boolean z2 = false;
|
|
while (i2 < this.mItems.size()) {
|
|
Sts sts = this.mItems.get(i2);
|
|
int itemPosition = this.mAdapter.getItemPosition(sts.e);
|
|
if (itemPosition != -1) {
|
|
if (itemPosition == -2) {
|
|
this.mItems.remove(i2);
|
|
i2--;
|
|
if (!z2) {
|
|
this.mAdapter.startUpdate((ViewGroup) this);
|
|
z2 = true;
|
|
}
|
|
this.mAdapter.destroyItem((ViewGroup) this, sts.a, sts.e);
|
|
if (this.mCurItem == sts.a) {
|
|
i = Math.max(0, Math.min(this.mCurItem, count - 1));
|
|
}
|
|
} else if (sts.a != itemPosition) {
|
|
if (sts.a == this.mCurItem) {
|
|
i = itemPosition;
|
|
}
|
|
sts.a = itemPosition;
|
|
}
|
|
z = true;
|
|
}
|
|
i2++;
|
|
}
|
|
if (z2) {
|
|
this.mAdapter.finishUpdate((ViewGroup) this);
|
|
}
|
|
Collections.sort(this.mItems, COMPARATOR);
|
|
if (z) {
|
|
int childCount = getChildCount();
|
|
for (int i3 = 0; i3 < childCount; i3++) {
|
|
IeS ieS = (IeS) getChildAt(i3).getLayoutParams();
|
|
if (!ieS.c) {
|
|
ieS.f = BitmapDescriptorFactory.HUE_RED;
|
|
}
|
|
}
|
|
setCurrentItemInternal(i, false, true);
|
|
requestLayout();
|
|
}
|
|
}
|
|
|
|
void populate() {
|
|
populate(this.mCurItem);
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:26:0x0064, code lost:
|
|
|
|
if (r8.a == r17.mCurItem) goto L29;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:27:0x006a, code lost:
|
|
|
|
r8 = null;
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
void populate(int r18) {
|
|
/*
|
|
Method dump skipped, instructions count: 612
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.viewpager.widget.ViewPager.populate(int):void");
|
|
}
|
|
|
|
private void sortChildDrawingOrder() {
|
|
if (this.mDrawingOrder != 0) {
|
|
ArrayList<View> arrayList = this.mDrawingOrderedChildren;
|
|
if (arrayList == null) {
|
|
this.mDrawingOrderedChildren = new ArrayList<>();
|
|
} else {
|
|
arrayList.clear();
|
|
}
|
|
int childCount = getChildCount();
|
|
for (int i = 0; i < childCount; i++) {
|
|
this.mDrawingOrderedChildren.add(getChildAt(i));
|
|
}
|
|
Collections.sort(this.mDrawingOrderedChildren, sPositionComparator);
|
|
}
|
|
}
|
|
|
|
private void calculatePageOffsets(Sts sts, int i, Sts sts2) {
|
|
Sts sts3;
|
|
Sts sts4;
|
|
int count = this.mAdapter.getCount();
|
|
int clientWidth = getClientWidth();
|
|
float f = clientWidth > 0 ? this.mPageMargin / clientWidth : BitmapDescriptorFactory.HUE_RED;
|
|
if (sts2 != null) {
|
|
int i2 = sts2.a;
|
|
if (i2 < sts.a) {
|
|
float f2 = sts2.b + sts2.c + f;
|
|
int i3 = i2 + 1;
|
|
int i4 = 0;
|
|
while (i3 <= sts.a && i4 < this.mItems.size()) {
|
|
Sts sts5 = this.mItems.get(i4);
|
|
while (true) {
|
|
sts4 = sts5;
|
|
if (i3 <= sts4.a || i4 >= this.mItems.size() - 1) {
|
|
break;
|
|
}
|
|
i4++;
|
|
sts5 = this.mItems.get(i4);
|
|
}
|
|
while (i3 < sts4.a) {
|
|
f2 += this.mAdapter.getPageWidth(i3) + f;
|
|
i3++;
|
|
}
|
|
sts4.b = f2;
|
|
f2 += sts4.c + f;
|
|
i3++;
|
|
}
|
|
} else if (i2 > sts.a) {
|
|
int size = this.mItems.size() - 1;
|
|
float f3 = sts2.b;
|
|
while (true) {
|
|
i2--;
|
|
if (i2 < sts.a || size < 0) {
|
|
break;
|
|
}
|
|
Sts sts6 = this.mItems.get(size);
|
|
while (true) {
|
|
sts3 = sts6;
|
|
if (i2 >= sts3.a || size <= 0) {
|
|
break;
|
|
}
|
|
size--;
|
|
sts6 = this.mItems.get(size);
|
|
}
|
|
while (i2 > sts3.a) {
|
|
f3 -= this.mAdapter.getPageWidth(i2) + f;
|
|
i2--;
|
|
}
|
|
f3 -= sts3.c + f;
|
|
sts3.b = f3;
|
|
}
|
|
}
|
|
}
|
|
int size2 = this.mItems.size();
|
|
float f4 = sts.b;
|
|
int i5 = sts.a - 1;
|
|
this.mFirstOffset = sts.a == 0 ? sts.b : -3.4028235E38f;
|
|
int i6 = count - 1;
|
|
this.mLastOffset = sts.a == i6 ? (sts.b + sts.c) - 1.0f : Float.MAX_VALUE;
|
|
int i7 = i - 1;
|
|
while (i7 >= 0) {
|
|
Sts sts7 = this.mItems.get(i7);
|
|
while (i5 > sts7.a) {
|
|
f4 -= this.mAdapter.getPageWidth(i5) + f;
|
|
i5--;
|
|
}
|
|
f4 -= sts7.c + f;
|
|
sts7.b = f4;
|
|
if (sts7.a == 0) {
|
|
this.mFirstOffset = f4;
|
|
}
|
|
i7--;
|
|
i5--;
|
|
}
|
|
float f5 = sts.b + sts.c + f;
|
|
int i8 = sts.a + 1;
|
|
int i9 = i + 1;
|
|
while (i9 < size2) {
|
|
Sts sts8 = this.mItems.get(i9);
|
|
while (i8 < sts8.a) {
|
|
f5 += this.mAdapter.getPageWidth(i8) + f;
|
|
i8++;
|
|
}
|
|
if (sts8.a == i6) {
|
|
this.mLastOffset = (sts8.c + f5) - 1.0f;
|
|
}
|
|
sts8.b = f5;
|
|
f5 += sts8.c + f;
|
|
i9++;
|
|
i8++;
|
|
}
|
|
this.mNeedCalculatePageOffsets = false;
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public static class saX extends XgG {
|
|
public static final Parcelable.Creator<saX> CREATOR = new Parcelable.ClassLoaderCreator<saX>() { // from class: androidx.viewpager.widget.ViewPager.saX.5
|
|
@Override // android.os.Parcelable.Creator
|
|
public final /* synthetic */ Object createFromParcel(Parcel parcel) {
|
|
return new saX(parcel, null);
|
|
}
|
|
|
|
@Override // android.os.Parcelable.ClassLoaderCreator
|
|
public final /* synthetic */ saX createFromParcel(Parcel parcel, ClassLoader classLoader) {
|
|
return new saX(parcel, classLoader);
|
|
}
|
|
|
|
@Override // android.os.Parcelable.Creator
|
|
public final /* bridge */ /* synthetic */ Object[] newArray(int i) {
|
|
return new saX[i];
|
|
}
|
|
};
|
|
Parcelable c;
|
|
int d;
|
|
ClassLoader e;
|
|
|
|
public saX(Parcelable parcelable) {
|
|
super(parcelable);
|
|
}
|
|
|
|
@Override // o.XgG, android.os.Parcelable
|
|
public final void writeToParcel(Parcel parcel, int i) {
|
|
super.writeToParcel(parcel, i);
|
|
parcel.writeInt(this.d);
|
|
parcel.writeParcelable(this.c, i);
|
|
}
|
|
|
|
public final String toString() {
|
|
StringBuilder sb = new StringBuilder("FragmentPager.SavedState{");
|
|
sb.append(Integer.toHexString(System.identityHashCode(this)));
|
|
sb.append(" position=");
|
|
sb.append(this.d);
|
|
sb.append(UrlTreeKt.componentParamSuffix);
|
|
return sb.toString();
|
|
}
|
|
|
|
saX(Parcel parcel, ClassLoader classLoader) {
|
|
super(parcel, classLoader);
|
|
classLoader = classLoader == null ? getClass().getClassLoader() : classLoader;
|
|
this.d = parcel.readInt();
|
|
this.c = parcel.readParcelable(classLoader);
|
|
this.e = classLoader;
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public Parcelable onSaveInstanceState() {
|
|
saX sax = new saX(super.onSaveInstanceState());
|
|
sax.d = this.mCurItem;
|
|
WYJ wyj = this.mAdapter;
|
|
if (wyj != null) {
|
|
sax.c = wyj.saveState();
|
|
}
|
|
return sax;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onRestoreInstanceState(Parcelable parcelable) {
|
|
if (!(parcelable instanceof saX)) {
|
|
super.onRestoreInstanceState(parcelable);
|
|
return;
|
|
}
|
|
saX sax = (saX) parcelable;
|
|
super.onRestoreInstanceState(sax.b);
|
|
WYJ wyj = this.mAdapter;
|
|
if (wyj != null) {
|
|
wyj.restoreState(sax.c, sax.e);
|
|
setCurrentItemInternal(sax.d, false, true);
|
|
} else {
|
|
this.mRestoredCurItem = sax.d;
|
|
this.mRestoredAdapterState = sax.c;
|
|
this.mRestoredClassLoader = sax.e;
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) {
|
|
if (!checkLayoutParams(layoutParams)) {
|
|
layoutParams = generateLayoutParams(layoutParams);
|
|
}
|
|
IeS ieS = (IeS) layoutParams;
|
|
ieS.c |= isDecorView(view);
|
|
if (this.mInLayout) {
|
|
if (ieS != null && ieS.c) {
|
|
throw new IllegalStateException("Cannot add pager decor view during layout");
|
|
}
|
|
ieS.b = true;
|
|
addViewInLayout(view, i, layoutParams);
|
|
return;
|
|
}
|
|
super.addView(view, i, layoutParams);
|
|
}
|
|
|
|
private static boolean isDecorView(View view) {
|
|
return view.getClass().getAnnotation(RVV.class) != null;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewManager
|
|
public void removeView(View view) {
|
|
if (this.mInLayout) {
|
|
removeViewInLayout(view);
|
|
} else {
|
|
super.removeView(view);
|
|
}
|
|
}
|
|
|
|
Sts infoForChild(View view) {
|
|
for (int i = 0; i < this.mItems.size(); i++) {
|
|
Sts sts = this.mItems.get(i);
|
|
if (this.mAdapter.isViewFromObject(view, sts.e)) {
|
|
return sts;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
Sts infoForAnyChild(View view) {
|
|
while (true) {
|
|
Object parent = view.getParent();
|
|
if (parent != this) {
|
|
if (parent == null || !(parent instanceof View)) {
|
|
return null;
|
|
}
|
|
view = (View) parent;
|
|
} else {
|
|
return infoForChild(view);
|
|
}
|
|
}
|
|
}
|
|
|
|
Sts infoForPosition(int i) {
|
|
for (int i2 = 0; i2 < this.mItems.size(); i2++) {
|
|
Sts sts = this.mItems.get(i2);
|
|
if (sts.a == i) {
|
|
return sts;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onAttachedToWindow() {
|
|
super.onAttachedToWindow();
|
|
this.mFirstLayout = true;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onMeasure(int i, int i2) {
|
|
IeS ieS;
|
|
IeS ieS2;
|
|
int i3;
|
|
int i4;
|
|
int i5;
|
|
int i6;
|
|
boolean z = false;
|
|
setMeasuredDimension(getDefaultSize(0, i), getDefaultSize(0, i2));
|
|
int measuredWidth = getMeasuredWidth();
|
|
this.mGutterSize = Math.min(measuredWidth / 10, this.mDefaultGutterSize);
|
|
int paddingLeft = (measuredWidth - getPaddingLeft()) - getPaddingRight();
|
|
int measuredHeight = (getMeasuredHeight() - getPaddingTop()) - getPaddingBottom();
|
|
int childCount = getChildCount();
|
|
int i7 = 0;
|
|
while (true) {
|
|
boolean z2 = true;
|
|
int i8 = 1073741824;
|
|
if (i7 >= childCount) {
|
|
break;
|
|
}
|
|
View childAt = getChildAt(i7);
|
|
if (childAt.getVisibility() != 8 && (ieS2 = (IeS) childAt.getLayoutParams()) != null && ieS2.c) {
|
|
int i9 = ieS2.a & 7;
|
|
int i10 = ieS2.a & 112;
|
|
boolean z3 = (i10 == 48 || i10 == 80) ? true : z;
|
|
if (i9 != 3 && i9 != 5) {
|
|
z2 = z;
|
|
}
|
|
int i11 = PKIFailureInfo.systemUnavail;
|
|
if (z3) {
|
|
i3 = Integer.MIN_VALUE;
|
|
i11 = 1073741824;
|
|
} else {
|
|
i3 = z2 ? 1073741824 : Integer.MIN_VALUE;
|
|
}
|
|
if (((ViewGroup.LayoutParams) ieS2).width != -2) {
|
|
i5 = ((ViewGroup.LayoutParams) ieS2).width != -1 ? ((ViewGroup.LayoutParams) ieS2).width : paddingLeft;
|
|
i4 = 1073741824;
|
|
} else {
|
|
i4 = i11;
|
|
i5 = paddingLeft;
|
|
}
|
|
if (((ViewGroup.LayoutParams) ieS2).height != -2) {
|
|
i6 = ((ViewGroup.LayoutParams) ieS2).height != -1 ? ((ViewGroup.LayoutParams) ieS2).height : measuredHeight;
|
|
} else {
|
|
i6 = measuredHeight;
|
|
i8 = i3;
|
|
}
|
|
childAt.measure(View.MeasureSpec.makeMeasureSpec(i5, i4), View.MeasureSpec.makeMeasureSpec(i6, i8));
|
|
if (z3) {
|
|
measuredHeight -= childAt.getMeasuredHeight();
|
|
} else if (z2) {
|
|
paddingLeft -= childAt.getMeasuredWidth();
|
|
}
|
|
}
|
|
i7++;
|
|
z = false;
|
|
}
|
|
this.mChildWidthMeasureSpec = View.MeasureSpec.makeMeasureSpec(paddingLeft, 1073741824);
|
|
this.mChildHeightMeasureSpec = View.MeasureSpec.makeMeasureSpec(measuredHeight, 1073741824);
|
|
this.mInLayout = true;
|
|
populate();
|
|
this.mInLayout = false;
|
|
int childCount2 = getChildCount();
|
|
for (int i12 = 0; i12 < childCount2; i12++) {
|
|
View childAt2 = getChildAt(i12);
|
|
if (childAt2.getVisibility() != 8 && ((ieS = (IeS) childAt2.getLayoutParams()) == null || !ieS.c)) {
|
|
childAt2.measure(View.MeasureSpec.makeMeasureSpec((int) (paddingLeft * ieS.f), 1073741824), this.mChildHeightMeasureSpec);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
protected void onSizeChanged(int i, int i2, int i3, int i4) {
|
|
super.onSizeChanged(i, i2, i3, i4);
|
|
if (i != i3) {
|
|
int i5 = this.mPageMargin;
|
|
recomputeScrollPosition(i, i3, i5, i5);
|
|
}
|
|
}
|
|
|
|
private void recomputeScrollPosition(int i, int i2, int i3, int i4) {
|
|
if (i2 > 0 && !this.mItems.isEmpty()) {
|
|
if (!this.mScroller.isFinished()) {
|
|
this.mScroller.setFinalX(getCurrentItem() * getClientWidth());
|
|
return;
|
|
}
|
|
int paddingLeft = getPaddingLeft();
|
|
int paddingRight = getPaddingRight();
|
|
scrollTo((int) ((getScrollX() / (((i2 - getPaddingLeft()) - getPaddingRight()) + i4)) * (((i - paddingLeft) - paddingRight) + i3)), getScrollY());
|
|
return;
|
|
}
|
|
Sts infoForPosition = infoForPosition(this.mCurItem);
|
|
int min = (int) ((infoForPosition != null ? Math.min(infoForPosition.b, this.mLastOffset) : BitmapDescriptorFactory.HUE_RED) * ((i - getPaddingLeft()) - getPaddingRight()));
|
|
if (min != getScrollX()) {
|
|
completeScroll(false);
|
|
scrollTo(min, getScrollY());
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:17:0x0073 */
|
|
/* JADX WARN: Removed duplicated region for block: B:28:0x0090 */
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
protected void onLayout(boolean r19, int r20, int r21, int r22, int r23) {
|
|
/*
|
|
Method dump skipped, instructions count: 287
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.viewpager.widget.ViewPager.onLayout(boolean, int, int, int, int):void");
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void computeScroll() {
|
|
this.mIsScrollStarted = true;
|
|
if (!this.mScroller.isFinished() && this.mScroller.computeScrollOffset()) {
|
|
int scrollX = getScrollX();
|
|
int scrollY = getScrollY();
|
|
int currX = this.mScroller.getCurrX();
|
|
int currY = this.mScroller.getCurrY();
|
|
if (scrollX != currX || scrollY != currY) {
|
|
scrollTo(currX, currY);
|
|
if (!pageScrolled(currX)) {
|
|
this.mScroller.abortAnimation();
|
|
scrollTo(0, currY);
|
|
}
|
|
}
|
|
ViewCompat.N(this);
|
|
return;
|
|
}
|
|
completeScroll(true);
|
|
}
|
|
|
|
private boolean pageScrolled(int i) {
|
|
if (this.mItems.size() == 0) {
|
|
if (this.mFirstLayout) {
|
|
return false;
|
|
}
|
|
this.mCalledSuper = false;
|
|
onPageScrolled(0, BitmapDescriptorFactory.HUE_RED, 0);
|
|
if (this.mCalledSuper) {
|
|
return false;
|
|
}
|
|
throw new IllegalStateException("onPageScrolled did not call superclass implementation");
|
|
}
|
|
Sts infoForCurrentScrollPosition = infoForCurrentScrollPosition();
|
|
int clientWidth = getClientWidth();
|
|
int i2 = this.mPageMargin;
|
|
float f = clientWidth;
|
|
int i3 = infoForCurrentScrollPosition.a;
|
|
float f2 = ((i / f) - infoForCurrentScrollPosition.b) / (infoForCurrentScrollPosition.c + (i2 / f));
|
|
this.mCalledSuper = false;
|
|
onPageScrolled(i3, f2, (int) ((clientWidth + i2) * f2));
|
|
if (this.mCalledSuper) {
|
|
return true;
|
|
}
|
|
throw new IllegalStateException("onPageScrolled did not call superclass implementation");
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:16:0x0063 */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
protected void onPageScrolled(int r13, float r14, int r15) {
|
|
/*
|
|
r12 = this;
|
|
int r0 = r12.mDecorChildCount
|
|
r1 = 0
|
|
r2 = 1
|
|
if (r0 <= 0) goto L6a
|
|
int r0 = r12.getScrollX()
|
|
int r3 = r12.getPaddingLeft()
|
|
int r4 = r12.getPaddingRight()
|
|
int r5 = r12.getWidth()
|
|
int r6 = r12.getChildCount()
|
|
r7 = r1
|
|
L1b:
|
|
if (r7 >= r6) goto L6a
|
|
android.view.View r8 = r12.getChildAt(r7)
|
|
android.view.ViewGroup$LayoutParams r9 = r8.getLayoutParams()
|
|
androidx.viewpager.widget.ViewPager$IeS r9 = (androidx.viewpager.widget.ViewPager.IeS) r9
|
|
boolean r10 = r9.c
|
|
if (r10 == 0) goto L67
|
|
int r9 = r9.a
|
|
r9 = r9 & 7
|
|
if (r9 == r2) goto L4c
|
|
r10 = 3
|
|
if (r9 == r10) goto L46
|
|
r10 = 5
|
|
if (r9 == r10) goto L39
|
|
r9 = r3
|
|
goto L5b
|
|
L39:
|
|
int r9 = r5 - r4
|
|
int r10 = r8.getMeasuredWidth()
|
|
int r9 = r9 - r10
|
|
int r10 = r8.getMeasuredWidth()
|
|
int r4 = r4 + r10
|
|
goto L58
|
|
L46:
|
|
int r9 = r8.getWidth()
|
|
int r9 = r9 + r3
|
|
goto L5b
|
|
L4c:
|
|
int r9 = r8.getMeasuredWidth()
|
|
int r9 = r5 - r9
|
|
int r9 = r9 / 2
|
|
int r9 = java.lang.Math.max(r9, r3)
|
|
L58:
|
|
r11 = r9
|
|
r9 = r3
|
|
r3 = r11
|
|
L5b:
|
|
int r3 = r3 + r0
|
|
int r10 = r8.getLeft()
|
|
int r3 = r3 - r10
|
|
if (r3 == 0) goto L66
|
|
r8.offsetLeftAndRight(r3)
|
|
L66:
|
|
r3 = r9
|
|
L67:
|
|
int r7 = r7 + 1
|
|
goto L1b
|
|
L6a:
|
|
r12.dispatchOnPageScrolled(r13, r14, r15)
|
|
androidx.viewpager.widget.ViewPager$tOB r13 = r12.mPageTransformer
|
|
if (r13 == 0) goto L9d
|
|
int r13 = r12.getScrollX()
|
|
int r14 = r12.getChildCount()
|
|
L79:
|
|
if (r1 >= r14) goto L9d
|
|
android.view.View r15 = r12.getChildAt(r1)
|
|
android.view.ViewGroup$LayoutParams r0 = r15.getLayoutParams()
|
|
androidx.viewpager.widget.ViewPager$IeS r0 = (androidx.viewpager.widget.ViewPager.IeS) r0
|
|
boolean r0 = r0.c
|
|
if (r0 != 0) goto L9a
|
|
int r0 = r15.getLeft()
|
|
int r0 = r0 - r13
|
|
float r0 = (float) r0
|
|
int r3 = r12.getClientWidth()
|
|
float r3 = (float) r3
|
|
float r0 = r0 / r3
|
|
androidx.viewpager.widget.ViewPager$tOB r3 = r12.mPageTransformer
|
|
r3.transformPage(r15, r0)
|
|
L9a:
|
|
int r1 = r1 + 1
|
|
goto L79
|
|
L9d:
|
|
r12.mCalledSuper = r2
|
|
return
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.viewpager.widget.ViewPager.onPageScrolled(int, float, int):void");
|
|
}
|
|
|
|
private void dispatchOnPageScrolled(int i, float f, int i2) {
|
|
ojQ ojq = this.mOnPageChangeListener;
|
|
if (ojq != null) {
|
|
ojq.onPageScrolled(i, f, i2);
|
|
}
|
|
List<ojQ> list = this.mOnPageChangeListeners;
|
|
if (list != null) {
|
|
int size = list.size();
|
|
for (int i3 = 0; i3 < size; i3++) {
|
|
ojQ ojq2 = this.mOnPageChangeListeners.get(i3);
|
|
if (ojq2 != null) {
|
|
ojq2.onPageScrolled(i, f, i2);
|
|
}
|
|
}
|
|
}
|
|
ojQ ojq3 = this.mInternalPageChangeListener;
|
|
if (ojq3 != null) {
|
|
ojq3.onPageScrolled(i, f, i2);
|
|
}
|
|
}
|
|
|
|
private void dispatchOnPageSelected(int i) {
|
|
ojQ ojq = this.mOnPageChangeListener;
|
|
if (ojq != null) {
|
|
ojq.onPageSelected(i);
|
|
}
|
|
List<ojQ> list = this.mOnPageChangeListeners;
|
|
if (list != null) {
|
|
int size = list.size();
|
|
for (int i2 = 0; i2 < size; i2++) {
|
|
ojQ ojq2 = this.mOnPageChangeListeners.get(i2);
|
|
if (ojq2 != null) {
|
|
ojq2.onPageSelected(i);
|
|
}
|
|
}
|
|
}
|
|
ojQ ojq3 = this.mInternalPageChangeListener;
|
|
if (ojq3 != null) {
|
|
ojq3.onPageSelected(i);
|
|
}
|
|
}
|
|
|
|
private void dispatchOnScrollStateChanged(int i) {
|
|
ojQ ojq = this.mOnPageChangeListener;
|
|
if (ojq != null) {
|
|
ojq.onPageScrollStateChanged(i);
|
|
}
|
|
List<ojQ> list = this.mOnPageChangeListeners;
|
|
if (list != null) {
|
|
int size = list.size();
|
|
for (int i2 = 0; i2 < size; i2++) {
|
|
ojQ ojq2 = this.mOnPageChangeListeners.get(i2);
|
|
if (ojq2 != null) {
|
|
ojq2.onPageScrollStateChanged(i);
|
|
}
|
|
}
|
|
}
|
|
ojQ ojq3 = this.mInternalPageChangeListener;
|
|
if (ojq3 != null) {
|
|
ojq3.onPageScrollStateChanged(i);
|
|
}
|
|
}
|
|
|
|
private void completeScroll(boolean z) {
|
|
boolean z2 = this.mScrollState == 2;
|
|
if (z2) {
|
|
setScrollingCacheEnabled(false);
|
|
if (!this.mScroller.isFinished()) {
|
|
this.mScroller.abortAnimation();
|
|
int scrollX = getScrollX();
|
|
int scrollY = getScrollY();
|
|
int currX = this.mScroller.getCurrX();
|
|
int currY = this.mScroller.getCurrY();
|
|
if (scrollX != currX || scrollY != currY) {
|
|
scrollTo(currX, currY);
|
|
if (currX != scrollX) {
|
|
pageScrolled(currX);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.mPopulatePending = false;
|
|
for (int i = 0; i < this.mItems.size(); i++) {
|
|
Sts sts = this.mItems.get(i);
|
|
if (sts.d) {
|
|
sts.d = false;
|
|
z2 = true;
|
|
}
|
|
}
|
|
if (z2) {
|
|
if (z) {
|
|
ViewCompat.e(this, this.mEndScrollRunnable);
|
|
} else {
|
|
this.mEndScrollRunnable.run();
|
|
}
|
|
}
|
|
}
|
|
|
|
private boolean isGutterDrag(float f, float f2) {
|
|
return (f < ((float) this.mGutterSize) && f2 > BitmapDescriptorFactory.HUE_RED) || (f > ((float) (getWidth() - this.mGutterSize)) && f2 < BitmapDescriptorFactory.HUE_RED);
|
|
}
|
|
|
|
private void enableLayers(boolean z) {
|
|
int childCount = getChildCount();
|
|
for (int i = 0; i < childCount; i++) {
|
|
getChildAt(i).setLayerType(z ? this.mPageTransformerLayerType : 0, null);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
|
|
int action = motionEvent.getAction() & 255;
|
|
if (action == 3 || action == 1) {
|
|
resetTouch();
|
|
return false;
|
|
}
|
|
if (action != 0) {
|
|
if (this.mIsBeingDragged) {
|
|
return true;
|
|
}
|
|
if (this.mIsUnableToDrag) {
|
|
return false;
|
|
}
|
|
}
|
|
if (action == 0) {
|
|
float x = motionEvent.getX();
|
|
this.mInitialMotionX = x;
|
|
this.mLastMotionX = x;
|
|
float y = motionEvent.getY();
|
|
this.mInitialMotionY = y;
|
|
this.mLastMotionY = y;
|
|
this.mActivePointerId = motionEvent.getPointerId(0);
|
|
this.mIsUnableToDrag = false;
|
|
this.mIsScrollStarted = true;
|
|
this.mScroller.computeScrollOffset();
|
|
if (this.mScrollState == 2 && Math.abs(this.mScroller.getFinalX() - this.mScroller.getCurrX()) > this.mCloseEnough) {
|
|
this.mScroller.abortAnimation();
|
|
this.mPopulatePending = false;
|
|
populate();
|
|
this.mIsBeingDragged = true;
|
|
requestParentDisallowInterceptTouchEvent(true);
|
|
setScrollState(1);
|
|
} else {
|
|
completeScroll(false);
|
|
this.mIsBeingDragged = false;
|
|
}
|
|
} else if (action == 2) {
|
|
int i = this.mActivePointerId;
|
|
if (i != -1) {
|
|
int findPointerIndex = motionEvent.findPointerIndex(i);
|
|
float x2 = motionEvent.getX(findPointerIndex);
|
|
float f = x2 - this.mLastMotionX;
|
|
float abs = Math.abs(f);
|
|
float y2 = motionEvent.getY(findPointerIndex);
|
|
float abs2 = Math.abs(y2 - this.mInitialMotionY);
|
|
if (f != BitmapDescriptorFactory.HUE_RED && !isGutterDrag(this.mLastMotionX, f) && canScroll(this, false, (int) f, (int) x2, (int) y2)) {
|
|
this.mLastMotionX = x2;
|
|
this.mLastMotionY = y2;
|
|
this.mIsUnableToDrag = true;
|
|
return false;
|
|
}
|
|
float f2 = this.mTouchSlop;
|
|
if (abs > f2 && abs * 0.5f > abs2) {
|
|
this.mIsBeingDragged = true;
|
|
requestParentDisallowInterceptTouchEvent(true);
|
|
setScrollState(1);
|
|
float f3 = this.mInitialMotionX;
|
|
float f4 = this.mTouchSlop;
|
|
this.mLastMotionX = f > BitmapDescriptorFactory.HUE_RED ? f3 + f4 : f3 - f4;
|
|
this.mLastMotionY = y2;
|
|
setScrollingCacheEnabled(true);
|
|
} else if (abs2 > f2) {
|
|
this.mIsUnableToDrag = true;
|
|
}
|
|
if (this.mIsBeingDragged && performDrag(x2)) {
|
|
ViewCompat.N(this);
|
|
}
|
|
}
|
|
} else if (action == 6) {
|
|
onSecondaryPointerUp(motionEvent);
|
|
}
|
|
if (this.mVelocityTracker == null) {
|
|
this.mVelocityTracker = VelocityTracker.obtain();
|
|
}
|
|
this.mVelocityTracker.addMovement(motionEvent);
|
|
return this.mIsBeingDragged;
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:35:0x0135 */
|
|
@Override // android.view.View
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public boolean onTouchEvent(android.view.MotionEvent r8) {
|
|
/*
|
|
Method dump skipped, instructions count: 347
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.viewpager.widget.ViewPager.onTouchEvent(android.view.MotionEvent):boolean");
|
|
}
|
|
|
|
private boolean resetTouch() {
|
|
this.mActivePointerId = -1;
|
|
endDrag();
|
|
this.mLeftEdge.onRelease();
|
|
this.mRightEdge.onRelease();
|
|
return this.mLeftEdge.isFinished() || this.mRightEdge.isFinished();
|
|
}
|
|
|
|
private void requestParentDisallowInterceptTouchEvent(boolean z) {
|
|
ViewParent parent = getParent();
|
|
if (parent != null) {
|
|
parent.requestDisallowInterceptTouchEvent(z);
|
|
}
|
|
}
|
|
|
|
private boolean performDrag(float f) {
|
|
boolean z;
|
|
boolean z2;
|
|
float f2 = this.mLastMotionX;
|
|
this.mLastMotionX = f;
|
|
float scrollX = getScrollX() + (f2 - f);
|
|
float clientWidth = getClientWidth();
|
|
float f3 = this.mFirstOffset * clientWidth;
|
|
float f4 = this.mLastOffset * clientWidth;
|
|
boolean z3 = false;
|
|
Sts sts = this.mItems.get(0);
|
|
ArrayList<Sts> arrayList = this.mItems;
|
|
Sts sts2 = arrayList.get(arrayList.size() - 1);
|
|
if (sts.a != 0) {
|
|
f3 = sts.b * clientWidth;
|
|
z = false;
|
|
} else {
|
|
z = true;
|
|
}
|
|
if (sts2.a != this.mAdapter.getCount() - 1) {
|
|
f4 = sts2.b * clientWidth;
|
|
z2 = false;
|
|
} else {
|
|
z2 = true;
|
|
}
|
|
if (scrollX < f3) {
|
|
if (z) {
|
|
this.mLeftEdge.onPull(Math.abs(f3 - scrollX) / clientWidth);
|
|
z3 = true;
|
|
}
|
|
scrollX = f3;
|
|
} else if (scrollX > f4) {
|
|
if (z2) {
|
|
this.mRightEdge.onPull(Math.abs(scrollX - f4) / clientWidth);
|
|
z3 = true;
|
|
}
|
|
scrollX = f4;
|
|
}
|
|
int i = (int) scrollX;
|
|
this.mLastMotionX += scrollX - i;
|
|
scrollTo(i, getScrollY());
|
|
pageScrolled(i);
|
|
return z3;
|
|
}
|
|
|
|
private Sts infoForCurrentScrollPosition() {
|
|
int i;
|
|
int clientWidth = getClientWidth();
|
|
float f = BitmapDescriptorFactory.HUE_RED;
|
|
float scrollX = clientWidth > 0 ? getScrollX() / clientWidth : 0.0f;
|
|
float f2 = clientWidth > 0 ? this.mPageMargin / clientWidth : 0.0f;
|
|
int i2 = 0;
|
|
boolean z = true;
|
|
int i3 = -1;
|
|
Sts sts = null;
|
|
float f3 = 0.0f;
|
|
while (i2 < this.mItems.size()) {
|
|
Sts sts2 = this.mItems.get(i2);
|
|
if (!z && sts2.a != (i = i3 + 1)) {
|
|
sts2 = this.mTempItem;
|
|
sts2.b = f + f3 + f2;
|
|
sts2.a = i;
|
|
sts2.c = this.mAdapter.getPageWidth(sts2.a);
|
|
i2--;
|
|
}
|
|
Sts sts3 = sts2;
|
|
f = sts3.b;
|
|
float f4 = sts3.c;
|
|
if (!z && scrollX < f) {
|
|
return sts;
|
|
}
|
|
if (scrollX < f4 + f + f2 || i2 == this.mItems.size() - 1) {
|
|
return sts3;
|
|
}
|
|
i3 = sts3.a;
|
|
i2++;
|
|
z = false;
|
|
sts = sts3;
|
|
f3 = sts3.c;
|
|
}
|
|
return sts;
|
|
}
|
|
|
|
private int determineTargetPage(int i, float f, int i2, int i3) {
|
|
if (Math.abs(i3) <= this.mFlingDistance || Math.abs(i2) <= this.mMinimumVelocity) {
|
|
i += (int) (f + (i >= this.mCurItem ? 0.4f : 0.6f));
|
|
} else if (i2 <= 0) {
|
|
i++;
|
|
}
|
|
if (this.mItems.size() <= 0) {
|
|
return i;
|
|
}
|
|
return Math.max(this.mItems.get(0).a, Math.min(i, this.mItems.get(r4.size() - 1).a));
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void draw(Canvas canvas) {
|
|
boolean z;
|
|
WYJ wyj;
|
|
super.draw(canvas);
|
|
int overScrollMode = getOverScrollMode();
|
|
if (overScrollMode == 0 || (overScrollMode == 1 && (wyj = this.mAdapter) != null && wyj.getCount() > 1)) {
|
|
if (this.mLeftEdge.isFinished()) {
|
|
z = false;
|
|
} else {
|
|
int save = canvas.save();
|
|
int height = (getHeight() - getPaddingTop()) - getPaddingBottom();
|
|
int width = getWidth();
|
|
canvas.rotate(270.0f);
|
|
canvas.translate((-height) + getPaddingTop(), this.mFirstOffset * width);
|
|
this.mLeftEdge.setSize(height, width);
|
|
z = this.mLeftEdge.draw(canvas);
|
|
canvas.restoreToCount(save);
|
|
}
|
|
if (!this.mRightEdge.isFinished()) {
|
|
int save2 = canvas.save();
|
|
int width2 = getWidth();
|
|
int height2 = getHeight();
|
|
int paddingTop = getPaddingTop();
|
|
int paddingBottom = getPaddingBottom();
|
|
canvas.rotate(90.0f);
|
|
canvas.translate(-getPaddingTop(), (-(this.mLastOffset + 1.0f)) * width2);
|
|
this.mRightEdge.setSize((height2 - paddingTop) - paddingBottom, width2);
|
|
z |= this.mRightEdge.draw(canvas);
|
|
canvas.restoreToCount(save2);
|
|
}
|
|
if (z) {
|
|
ViewCompat.N(this);
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
this.mLeftEdge.finish();
|
|
this.mRightEdge.finish();
|
|
}
|
|
|
|
@Override // android.view.View
|
|
protected void onDraw(Canvas canvas) {
|
|
float f;
|
|
float f2;
|
|
float f3;
|
|
super.onDraw(canvas);
|
|
if (this.mPageMargin <= 0 || this.mMarginDrawable == null || this.mItems.size() <= 0 || this.mAdapter == null) {
|
|
return;
|
|
}
|
|
int scrollX = getScrollX();
|
|
float width = getWidth();
|
|
float f4 = this.mPageMargin / width;
|
|
int i = 0;
|
|
Sts sts = this.mItems.get(0);
|
|
float f5 = sts.b;
|
|
int size = this.mItems.size();
|
|
int i2 = sts.a;
|
|
int i3 = this.mItems.get(size - 1).a;
|
|
while (i2 < i3) {
|
|
while (i2 > sts.a && i < size) {
|
|
i++;
|
|
sts = this.mItems.get(i);
|
|
}
|
|
if (i2 == sts.a) {
|
|
f = (sts.b + sts.c) * width;
|
|
f2 = sts.b + sts.c + f4;
|
|
} else {
|
|
float pageWidth = this.mAdapter.getPageWidth(i2);
|
|
float f6 = pageWidth + f4 + f5;
|
|
f = (f5 + pageWidth) * width;
|
|
f2 = f6;
|
|
}
|
|
if (this.mPageMargin + f > scrollX) {
|
|
f3 = f4;
|
|
this.mMarginDrawable.setBounds(Math.round(f), this.mTopPageBounds, Math.round(this.mPageMargin + f), this.mBottomPageBounds);
|
|
this.mMarginDrawable.draw(canvas);
|
|
} else {
|
|
f3 = f4;
|
|
}
|
|
if (f > scrollX + r2) {
|
|
return;
|
|
}
|
|
i2++;
|
|
f5 = f2;
|
|
f4 = f3;
|
|
}
|
|
}
|
|
|
|
public boolean beginFakeDrag() {
|
|
if (this.mIsBeingDragged) {
|
|
return false;
|
|
}
|
|
this.mFakeDragging = true;
|
|
setScrollState(1);
|
|
this.mLastMotionX = BitmapDescriptorFactory.HUE_RED;
|
|
this.mInitialMotionX = BitmapDescriptorFactory.HUE_RED;
|
|
VelocityTracker velocityTracker = this.mVelocityTracker;
|
|
if (velocityTracker == null) {
|
|
this.mVelocityTracker = VelocityTracker.obtain();
|
|
} else {
|
|
velocityTracker.clear();
|
|
}
|
|
long uptimeMillis = SystemClock.uptimeMillis();
|
|
MotionEvent obtain = MotionEvent.obtain(uptimeMillis, uptimeMillis, 0, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, 0);
|
|
this.mVelocityTracker.addMovement(obtain);
|
|
obtain.recycle();
|
|
this.mFakeDragBeginTime = uptimeMillis;
|
|
return true;
|
|
}
|
|
|
|
public void endFakeDrag() {
|
|
if (!this.mFakeDragging) {
|
|
throw new IllegalStateException("No fake drag in progress. Call beginFakeDrag first.");
|
|
}
|
|
if (this.mAdapter != null) {
|
|
VelocityTracker velocityTracker = this.mVelocityTracker;
|
|
velocityTracker.computeCurrentVelocity(1000, this.mMaximumVelocity);
|
|
int xVelocity = (int) velocityTracker.getXVelocity(this.mActivePointerId);
|
|
this.mPopulatePending = true;
|
|
int clientWidth = getClientWidth();
|
|
int scrollX = getScrollX();
|
|
Sts infoForCurrentScrollPosition = infoForCurrentScrollPosition();
|
|
setCurrentItemInternal(determineTargetPage(infoForCurrentScrollPosition.a, ((scrollX / clientWidth) - infoForCurrentScrollPosition.b) / infoForCurrentScrollPosition.c, xVelocity, (int) (this.mLastMotionX - this.mInitialMotionX)), true, true, xVelocity);
|
|
}
|
|
endDrag();
|
|
this.mFakeDragging = false;
|
|
}
|
|
|
|
public void fakeDragBy(float f) {
|
|
if (!this.mFakeDragging) {
|
|
throw new IllegalStateException("No fake drag in progress. Call beginFakeDrag first.");
|
|
}
|
|
if (this.mAdapter == null) {
|
|
return;
|
|
}
|
|
this.mLastMotionX += f;
|
|
float scrollX = getScrollX() - f;
|
|
float clientWidth = getClientWidth();
|
|
float f2 = this.mFirstOffset * clientWidth;
|
|
float f3 = this.mLastOffset * clientWidth;
|
|
Sts sts = this.mItems.get(0);
|
|
Sts sts2 = this.mItems.get(r4.size() - 1);
|
|
if (sts.a != 0) {
|
|
f2 = sts.b * clientWidth;
|
|
}
|
|
if (sts2.a != this.mAdapter.getCount() - 1) {
|
|
f3 = sts2.b * clientWidth;
|
|
}
|
|
if (scrollX < f2) {
|
|
scrollX = f2;
|
|
} else if (scrollX > f3) {
|
|
scrollX = f3;
|
|
}
|
|
int i = (int) scrollX;
|
|
this.mLastMotionX += scrollX - i;
|
|
scrollTo(i, getScrollY());
|
|
pageScrolled(i);
|
|
MotionEvent obtain = MotionEvent.obtain(this.mFakeDragBeginTime, SystemClock.uptimeMillis(), 2, this.mLastMotionX, BitmapDescriptorFactory.HUE_RED, 0);
|
|
this.mVelocityTracker.addMovement(obtain);
|
|
obtain.recycle();
|
|
}
|
|
|
|
private void onSecondaryPointerUp(MotionEvent motionEvent) {
|
|
int actionIndex = motionEvent.getActionIndex();
|
|
if (motionEvent.getPointerId(actionIndex) == this.mActivePointerId) {
|
|
int i = actionIndex == 0 ? 1 : 0;
|
|
this.mLastMotionX = motionEvent.getX(i);
|
|
this.mActivePointerId = motionEvent.getPointerId(i);
|
|
VelocityTracker velocityTracker = this.mVelocityTracker;
|
|
if (velocityTracker != null) {
|
|
velocityTracker.clear();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void endDrag() {
|
|
this.mIsBeingDragged = false;
|
|
this.mIsUnableToDrag = false;
|
|
VelocityTracker velocityTracker = this.mVelocityTracker;
|
|
if (velocityTracker != null) {
|
|
velocityTracker.recycle();
|
|
this.mVelocityTracker = null;
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean canScrollHorizontally(int i) {
|
|
if (this.mAdapter == null) {
|
|
return false;
|
|
}
|
|
int clientWidth = getClientWidth();
|
|
int scrollX = getScrollX();
|
|
return i < 0 ? scrollX > ((int) (((float) clientWidth) * this.mFirstOffset)) : i > 0 && scrollX < ((int) (((float) clientWidth) * this.mLastOffset));
|
|
}
|
|
|
|
protected boolean canScroll(View view, boolean z, int i, int i2, int i3) {
|
|
int i4;
|
|
if (view instanceof ViewGroup) {
|
|
ViewGroup viewGroup = (ViewGroup) view;
|
|
int scrollX = view.getScrollX();
|
|
int scrollY = view.getScrollY();
|
|
for (int childCount = viewGroup.getChildCount() - 1; childCount >= 0; childCount--) {
|
|
View childAt = viewGroup.getChildAt(childCount);
|
|
int i5 = i2 + scrollX;
|
|
if (i5 >= childAt.getLeft() && i5 < childAt.getRight() && (i4 = i3 + scrollY) >= childAt.getTop() && i4 < childAt.getBottom()) {
|
|
if (canScroll(childAt, true, i, i5 - childAt.getLeft(), i4 - childAt.getTop())) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return z && view.canScrollHorizontally(-i);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
|
|
return super.dispatchKeyEvent(keyEvent) || executeKeyEvent(keyEvent);
|
|
}
|
|
|
|
public boolean executeKeyEvent(KeyEvent keyEvent) {
|
|
if (keyEvent.getAction() == 0) {
|
|
int keyCode = keyEvent.getKeyCode();
|
|
if (keyCode == 21) {
|
|
if (keyEvent.hasModifiers(2)) {
|
|
return pageLeft();
|
|
}
|
|
return arrowScroll(17);
|
|
}
|
|
if (keyCode == 22) {
|
|
if (keyEvent.hasModifiers(2)) {
|
|
return pageRight();
|
|
}
|
|
return arrowScroll(66);
|
|
}
|
|
if (keyCode == 61) {
|
|
if (keyEvent.hasNoModifiers()) {
|
|
return arrowScroll(2);
|
|
}
|
|
if (keyEvent.hasModifiers(1)) {
|
|
return arrowScroll(1);
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:25:0x0089 */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public boolean arrowScroll(int r5) {
|
|
/*
|
|
r4 = this;
|
|
android.view.View r0 = r4.findFocus()
|
|
if (r0 != r4) goto L7
|
|
goto L26
|
|
L7:
|
|
if (r0 == 0) goto L27
|
|
android.view.ViewParent r1 = r0.getParent()
|
|
Ld:
|
|
boolean r2 = r1 instanceof android.view.ViewGroup
|
|
if (r2 == 0) goto L19
|
|
if (r1 != r4) goto L14
|
|
goto L27
|
|
L14:
|
|
android.view.ViewParent r1 = r1.getParent()
|
|
goto Ld
|
|
L19:
|
|
android.view.ViewParent r0 = r0.getParent()
|
|
L1d:
|
|
boolean r1 = r0 instanceof android.view.ViewGroup
|
|
if (r1 == 0) goto L26
|
|
android.view.ViewParent r0 = r0.getParent()
|
|
goto L1d
|
|
L26:
|
|
r0 = 0
|
|
L27:
|
|
android.view.FocusFinder r1 = android.view.FocusFinder.getInstance()
|
|
android.view.View r1 = r1.findNextFocus(r4, r0, r5)
|
|
r2 = 66
|
|
r3 = 17
|
|
if (r1 == 0) goto L72
|
|
if (r1 == r0) goto L72
|
|
if (r5 != r3) goto L52
|
|
android.graphics.Rect r2 = r4.mTempRect
|
|
android.graphics.Rect r2 = r4.getChildRectInPagerCoordinates(r2, r1)
|
|
int r2 = r2.left
|
|
android.graphics.Rect r3 = r4.mTempRect
|
|
android.graphics.Rect r3 = r4.getChildRectInPagerCoordinates(r3, r0)
|
|
int r3 = r3.left
|
|
if (r0 == 0) goto L4d
|
|
if (r2 >= r3) goto L83
|
|
L4d:
|
|
boolean r0 = r1.requestFocus()
|
|
goto L87
|
|
L52:
|
|
if (r5 != r2) goto L7c
|
|
android.graphics.Rect r2 = r4.mTempRect
|
|
android.graphics.Rect r2 = r4.getChildRectInPagerCoordinates(r2, r1)
|
|
int r2 = r2.left
|
|
android.graphics.Rect r3 = r4.mTempRect
|
|
android.graphics.Rect r3 = r4.getChildRectInPagerCoordinates(r3, r0)
|
|
int r3 = r3.left
|
|
if (r0 == 0) goto L6d
|
|
if (r2 > r3) goto L6d
|
|
boolean r0 = r4.pageRight()
|
|
goto L87
|
|
L6d:
|
|
boolean r0 = r1.requestFocus()
|
|
goto L87
|
|
L72:
|
|
if (r5 == r3) goto L83
|
|
r0 = 1
|
|
if (r5 == r0) goto L83
|
|
if (r5 == r2) goto L7e
|
|
r0 = 2
|
|
if (r5 == r0) goto L7e
|
|
L7c:
|
|
r0 = 0
|
|
goto L87
|
|
L7e:
|
|
boolean r0 = r4.pageRight()
|
|
goto L87
|
|
L83:
|
|
boolean r0 = r4.pageLeft()
|
|
L87:
|
|
if (r0 == 0) goto L90
|
|
int r5 = android.view.SoundEffectConstants.getContantForFocusDirection(r5)
|
|
r4.playSoundEffect(r5)
|
|
L90:
|
|
return r0
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.viewpager.widget.ViewPager.arrowScroll(int):boolean");
|
|
}
|
|
|
|
private Rect getChildRectInPagerCoordinates(Rect rect, View view) {
|
|
if (rect == null) {
|
|
rect = new Rect();
|
|
}
|
|
if (view == null) {
|
|
rect.set(0, 0, 0, 0);
|
|
return rect;
|
|
}
|
|
rect.left = view.getLeft();
|
|
rect.right = view.getRight();
|
|
rect.top = view.getTop();
|
|
rect.bottom = view.getBottom();
|
|
ViewParent parent = view.getParent();
|
|
while ((parent instanceof ViewGroup) && parent != this) {
|
|
ViewGroup viewGroup = (ViewGroup) parent;
|
|
rect.left += viewGroup.getLeft();
|
|
rect.right += viewGroup.getRight();
|
|
rect.top += viewGroup.getTop();
|
|
rect.bottom += viewGroup.getBottom();
|
|
parent = viewGroup.getParent();
|
|
}
|
|
return rect;
|
|
}
|
|
|
|
boolean pageLeft() {
|
|
int i = this.mCurItem;
|
|
if (i <= 0) {
|
|
return false;
|
|
}
|
|
setCurrentItem(i - 1, true);
|
|
return true;
|
|
}
|
|
|
|
boolean pageRight() {
|
|
WYJ wyj = this.mAdapter;
|
|
if (wyj == null || this.mCurItem >= wyj.getCount() - 1) {
|
|
return false;
|
|
}
|
|
setCurrentItem(this.mCurItem + 1, true);
|
|
return true;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void addFocusables(ArrayList<View> arrayList, int i, int i2) {
|
|
Sts infoForChild;
|
|
int size = arrayList.size();
|
|
int descendantFocusability = getDescendantFocusability();
|
|
if (descendantFocusability != 393216) {
|
|
for (int i3 = 0; i3 < getChildCount(); i3++) {
|
|
View childAt = getChildAt(i3);
|
|
if (childAt.getVisibility() == 0 && (infoForChild = infoForChild(childAt)) != null && infoForChild.a == this.mCurItem) {
|
|
childAt.addFocusables(arrayList, i, i2);
|
|
}
|
|
}
|
|
}
|
|
if ((descendantFocusability != 262144 || size == arrayList.size()) && isFocusable()) {
|
|
if (((i2 & 1) == 1 && isInTouchMode() && !isFocusableInTouchMode()) || arrayList == null) {
|
|
return;
|
|
}
|
|
arrayList.add(this);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void addTouchables(ArrayList<View> arrayList) {
|
|
Sts infoForChild;
|
|
for (int i = 0; i < getChildCount(); i++) {
|
|
View childAt = getChildAt(i);
|
|
if (childAt.getVisibility() == 0 && (infoForChild = infoForChild(childAt)) != null && infoForChild.a == this.mCurItem) {
|
|
childAt.addTouchables(arrayList);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
protected boolean onRequestFocusInDescendants(int i, Rect rect) {
|
|
int i2;
|
|
int i3;
|
|
int i4;
|
|
Sts infoForChild;
|
|
int childCount = getChildCount();
|
|
if ((i & 2) != 0) {
|
|
i3 = childCount;
|
|
i2 = 0;
|
|
i4 = 1;
|
|
} else {
|
|
i2 = childCount - 1;
|
|
i3 = -1;
|
|
i4 = -1;
|
|
}
|
|
while (i2 != i3) {
|
|
View childAt = getChildAt(i2);
|
|
if (childAt.getVisibility() == 0 && (infoForChild = infoForChild(childAt)) != null && infoForChild.a == this.mCurItem && childAt.requestFocus(i, rect)) {
|
|
return true;
|
|
}
|
|
i2 += i4;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
|
|
Sts infoForChild;
|
|
if (accessibilityEvent.getEventType() == 4096) {
|
|
return super.dispatchPopulateAccessibilityEvent(accessibilityEvent);
|
|
}
|
|
int childCount = getChildCount();
|
|
for (int i = 0; i < childCount; i++) {
|
|
View childAt = getChildAt(i);
|
|
if (childAt.getVisibility() == 0 && (infoForChild = infoForChild(childAt)) != null && infoForChild.a == this.mCurItem && childAt.dispatchPopulateAccessibilityEvent(accessibilityEvent)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
protected ViewGroup.LayoutParams generateDefaultLayoutParams() {
|
|
return new IeS();
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
|
return generateDefaultLayoutParams();
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
protected boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
|
return (layoutParams instanceof IeS) && super.checkLayoutParams(layoutParams);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
|
|
return new IeS(getContext(), attributeSet);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public class HBt extends yZt {
|
|
final ViewPager b;
|
|
|
|
HBt(ViewPager viewPager) {
|
|
this.b = viewPager;
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:4:0x001b, code lost:
|
|
|
|
if (r1.b.mAdapter.getCount() <= 1) goto L6;
|
|
*/
|
|
@Override // o.yZt
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public final void onInitializeAccessibilityEvent(android.view.View r2, android.view.accessibility.AccessibilityEvent r3) {
|
|
/*
|
|
r1 = this;
|
|
super.onInitializeAccessibilityEvent(r2, r3)
|
|
java.lang.Class<androidx.viewpager.widget.ViewPager> r2 = androidx.viewpager.widget.ViewPager.class
|
|
java.lang.String r2 = r2.getName()
|
|
r3.setClassName(r2)
|
|
androidx.viewpager.widget.ViewPager r2 = r1.b
|
|
o.WYJ r2 = r2.mAdapter
|
|
if (r2 == 0) goto L1d
|
|
androidx.viewpager.widget.ViewPager r2 = r1.b
|
|
o.WYJ r2 = r2.mAdapter
|
|
int r2 = r2.getCount()
|
|
r0 = 1
|
|
if (r2 > r0) goto L1e
|
|
L1d:
|
|
r0 = 0
|
|
L1e:
|
|
r3.setScrollable(r0)
|
|
int r2 = r3.getEventType()
|
|
r0 = 4096(0x1000, float:5.74E-42)
|
|
if (r2 != r0) goto L48
|
|
androidx.viewpager.widget.ViewPager r2 = r1.b
|
|
o.WYJ r2 = r2.mAdapter
|
|
if (r2 == 0) goto L48
|
|
androidx.viewpager.widget.ViewPager r2 = r1.b
|
|
o.WYJ r2 = r2.mAdapter
|
|
int r2 = r2.getCount()
|
|
r3.setItemCount(r2)
|
|
androidx.viewpager.widget.ViewPager r2 = r1.b
|
|
int r2 = r2.mCurItem
|
|
r3.setFromIndex(r2)
|
|
androidx.viewpager.widget.ViewPager r2 = r1.b
|
|
int r2 = r2.mCurItem
|
|
r3.setToIndex(r2)
|
|
L48:
|
|
return
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.viewpager.widget.ViewPager.HBt.onInitializeAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent):void");
|
|
}
|
|
|
|
@Override // o.yZt
|
|
public final void onInitializeAccessibilityNodeInfo(View view, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
|
|
super.onInitializeAccessibilityNodeInfo(view, accessibilityNodeInfoCompat);
|
|
accessibilityNodeInfoCompat.e((CharSequence) ViewPager.class.getName());
|
|
accessibilityNodeInfoCompat.n(this.b.mAdapter != null && this.b.mAdapter.getCount() > 1);
|
|
if (this.b.canScrollHorizontally(1)) {
|
|
accessibilityNodeInfoCompat.d(4096);
|
|
}
|
|
if (this.b.canScrollHorizontally(-1)) {
|
|
accessibilityNodeInfoCompat.d(8192);
|
|
}
|
|
}
|
|
|
|
@Override // o.yZt
|
|
public final boolean performAccessibilityAction(View view, int i, Bundle bundle) {
|
|
if (super.performAccessibilityAction(view, i, bundle)) {
|
|
return true;
|
|
}
|
|
if (i == 4096) {
|
|
if (!this.b.canScrollHorizontally(1)) {
|
|
return false;
|
|
}
|
|
ViewPager viewPager = this.b;
|
|
viewPager.setCurrentItem(viewPager.mCurItem + 1);
|
|
return true;
|
|
}
|
|
if (i != 8192 || !this.b.canScrollHorizontally(-1)) {
|
|
return false;
|
|
}
|
|
ViewPager viewPager2 = this.b;
|
|
viewPager2.setCurrentItem(viewPager2.mCurItem - 1);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public class ZqN extends DataSetObserver {
|
|
final ViewPager b;
|
|
|
|
ZqN(ViewPager viewPager) {
|
|
this.b = viewPager;
|
|
}
|
|
|
|
@Override // android.database.DataSetObserver
|
|
public void onChanged() {
|
|
this.b.dataSetChanged();
|
|
}
|
|
|
|
@Override // android.database.DataSetObserver
|
|
public void onInvalidated() {
|
|
this.b.dataSetChanged();
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public static class IeS extends ViewGroup.LayoutParams {
|
|
public int a;
|
|
boolean b;
|
|
public boolean c;
|
|
int d;
|
|
int e;
|
|
float f;
|
|
|
|
public IeS() {
|
|
super(-1, -1);
|
|
this.f = BitmapDescriptorFactory.HUE_RED;
|
|
}
|
|
|
|
public IeS(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
this.f = BitmapDescriptorFactory.HUE_RED;
|
|
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, ViewPager.LAYOUT_ATTRS);
|
|
this.a = obtainStyledAttributes.getInteger(0, 48);
|
|
obtainStyledAttributes.recycle();
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public static class vUG implements Comparator<View> {
|
|
vUG() {
|
|
}
|
|
|
|
@Override // java.util.Comparator
|
|
public /* synthetic */ int compare(View view, View view2) {
|
|
IeS ieS = (IeS) view.getLayoutParams();
|
|
IeS ieS2 = (IeS) view2.getLayoutParams();
|
|
if (ieS.c != ieS2.c) {
|
|
return ieS.c ? 1 : -1;
|
|
}
|
|
return ieS.d - ieS2.d;
|
|
}
|
|
}
|
|
|
|
@Deprecated
|
|
public void setOnPageChangeListener(ojQ ojq) {
|
|
this.mOnPageChangeListener = ojq;
|
|
}
|
|
|
|
ojQ setInternalPageChangeListener(ojQ ojq) {
|
|
ojQ ojq2 = this.mInternalPageChangeListener;
|
|
this.mInternalPageChangeListener = ojq;
|
|
return ojq2;
|
|
}
|
|
|
|
public boolean isFakeDragging() {
|
|
return this.mFakeDragging;
|
|
}
|
|
|
|
public int getPageMargin() {
|
|
return this.mPageMargin;
|
|
}
|
|
|
|
public int getOffscreenPageLimit() {
|
|
return this.mOffscreenPageLimit;
|
|
}
|
|
|
|
public int getCurrentItem() {
|
|
return this.mCurItem;
|
|
}
|
|
|
|
public WYJ getAdapter() {
|
|
return this.mAdapter;
|
|
}
|
|
|
|
private void setScrollingCacheEnabled(boolean z) {
|
|
if (this.mScrollingCacheEnabled != z) {
|
|
this.mScrollingCacheEnabled = z;
|
|
}
|
|
}
|
|
}
|