Skip to content

Commit

Permalink
Merge pull request #104 from smarteist/dev
Browse files Browse the repository at this point in the history
Infinite scroll limit decreased ,back and forth division by zero exce…
  • Loading branch information
smarteist authored Feb 16, 2020
2 parents b031aea + efe1d27 commit 85eb300
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

public class InfinitePagerAdapter extends PagerAdapter {

public static final int INFINITE_SCROLL_LIMIT = 40000;
public static final int INFINITE_SCROLL_LIMIT = 32400;
private static final String TAG = "InfinitePagerAdapter";

private SliderViewAdapter adapter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ public interface OnPageChangeListener {
}

/**
* Simple implementation of the {@link OnPageChangeListener} interface with stub
* Simple implementation of the {@link ##OnPageChangeListener} interface with stub
* implementations of each method. Extend this if you do not intend to override
* every method of {@link OnPageChangeListener}.
* every method of {@link ##OnPageChangeListener}.
*/
public static class SimpleOnPageChangeListener implements OnPageChangeListener {
@Override
Expand Down Expand Up @@ -326,10 +326,10 @@ void onAdapterChanged(@NonNull SliderPager viewPager,
* pager.
*
* <p>Views marked with this annotation can be added to the view pager with a layout resource.
* An example being {@link PagerTitleStrip}.</p>
* An example being {@link ##PagerTitleStrip}.</p>
*
* <p>You can also control whether a view is a decor view but setting
* {@link LayoutParams#isDecor} on the child's layout params.</p>
* {@link ##LayoutParams#isDecor} on the child's layout params.</p>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
Expand Down Expand Up @@ -662,7 +662,7 @@ private void scrollToItem(int item, boolean smoothScroll, int velocity,

/**
* Set a listener that will be invoked whenever the page changes or is incrementally
* scrolled. See {@link OnPageChangeListener}.
* scrolled. See {@link ##OnPageChangeListener}.
*
* @param listener Listener to set
* @deprecated Use {@link #addOnPageChangeListener(OnPageChangeListener)}
Expand All @@ -675,7 +675,7 @@ public void setOnPageChangeListener(OnPageChangeListener listener) {

/**
* Add a listener that will be invoked whenever the page changes or is incrementally
* scrolled. See {@link OnPageChangeListener}.
* scrolled. See {@link ##OnPageChangeListener}.
*
* <p>Components that add a listener should take care to remove it when finished.
* Other components that take ownership of a view may call {@link #clearOnPageChangeListeners()}
Expand Down Expand Up @@ -712,17 +712,17 @@ public void clearOnPageChangeListeners() {
}

/**
* Sets a {@link PageTransformer} that will be called for each attached page whenever
* Sets a {@link ##PageTransformer} that will be called for each attached page whenever
* the scroll position is changed. This allows the application to apply custom property
* transformations to each page, overriding the default sliding behavior.
*
* <p><em>Note:</em> By default, calling this method will cause contained pages to use
* {@link View#LAYER_TYPE_HARDWARE}. This layer type allows custom alpha transformations,
* but it will cause issues if any of your pages contain a {@link android.view.SurfaceView}
* and you have not called {@link android.view.SurfaceView#setZOrderOnTop(boolean)} to put that
* {@link android.view.SurfaceView} above your app content. To disable this behavior, call
* {@link #View#LAYER_TYPE_HARDWARE}. This layer type allows custom alpha transformations,
* but it will cause issues if any of your pages contain a {@link ##android.view.SurfaceView}
* and you have not called {@link ##android.view.SurfaceView#setZOrderOnTop(boolean)} to put that
* {@link ##android.view.SurfaceView} above your app content. To disable this behavior, call
* {@link #setPageTransformer(boolean, PageTransformer, int)} and pass
* {@link View#LAYER_TYPE_NONE} for {@code pageLayerType}.</p>
* {@link #View#LAYER_TYPE_NONE} for {@code pageLayerType}.</p>
*
* @param reverseDrawingOrder true if the supplied PageTransformer requires page views
* to be drawn from last to first instead of first to last.
Expand All @@ -734,17 +734,17 @@ public void setPageTransformer(boolean reverseDrawingOrder,
}

/**
* Sets a {@link PageTransformer} that will be called for each attached page whenever
* Sets a {@link ##PageTransformer} that will be called for each attached page whenever
* the scroll position is changed. This allows the application to apply custom property
* transformations to each page, overriding the default sliding behavior.
*
* @param reverseDrawingOrder true if the supplied PageTransformer requires page views
* to be drawn from last to first instead of first to last.
* @param transformer PageTransformer that will modify each page's animation properties
* @param pageLayerType View layer type that should be used for SliderPager pages. It should be
* either {@link View#LAYER_TYPE_HARDWARE},
* {@link View#LAYER_TYPE_SOFTWARE}, or
* {@link View#LAYER_TYPE_NONE}.
* either {@link #View#LAYER_TYPE_HARDWARE},
* {@link #View#LAYER_TYPE_SOFTWARE}, or
* {@link #View#LAYER_TYPE_NONE}.
*/
public void setPageTransformer(boolean reverseDrawingOrder,
@Nullable PageTransformer transformer, int pageLayerType) {
Expand Down Expand Up @@ -908,7 +908,7 @@ float distanceInfluenceForSnapDuration(float f) {
}

/**
* Like {@link View#scrollBy}, but scroll smoothly instead of immediately.
* Like {@link #View#scrollBy}, but scroll smoothly instead of immediately.
*
* @param x the number of pixels to scroll by on the X axis
* @param y the number of pixels to scroll by on the Y axis
Expand All @@ -918,7 +918,7 @@ void smoothScrollTo(int x, int y) {
}

/**
* Like {@link View#scrollBy}, but scroll smoothly instead of immediately.
* Like {@link #View#scrollBy}, but scroll smoothly instead of immediately.
*
* @param x the number of pixels to scroll by on the X axis
* @param y the number of pixels to scroll by on the Y axis
Expand Down Expand Up @@ -2785,7 +2785,7 @@ public boolean executeKeyEvent(@NonNull KeyEvent event) {
* Handle scrolling in response to a left or right arrow click.
*
* @param direction The direction corresponding to the arrow key that was pressed. It should be
* either {@link View#FOCUS_LEFT} or {@link View#FOCUS_RIGHT}.
* either {@link #View#FOCUS_LEFT} or {@link #View#FOCUS_RIGHT}.
* @return Whether the scrolling was handled successfully.
*/
public boolean arrowScroll(int direction) {
Expand Down Expand Up @@ -3139,7 +3139,7 @@ public static class LayoutParams extends ViewGroup.LayoutParams {
/**
* Gravity setting for use on decor views only:
* Where to position the view page within the overall SliderPager
* container; constants are defined in {@link Gravity}.
* container; constants are defined in {@link ##Gravity}.
*/
public int gravity;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public boolean onTouch(View v, MotionEvent event) {

/**
* @param animation set slider animation manually .
* it accepts {@link SliderPager.PageTransformer} animation classes.
* it accepts {@link ##PageTransformer} animation classes.
*/
public void setCustomSliderTransformAnimation(SliderPager.PageTransformer animation) {
mSliderPager.setPageTransformer(false, animation);
Expand Down Expand Up @@ -400,7 +400,7 @@ public void setIndicatorAnimationDuration(long duration) {
}

/**
* @param gravity {@link View} integer gravity of indicator dots.
* @param gravity {@link #View} integer gravity of indicator dots.
*/
public void setIndicatorGravity(int gravity) {
FrameLayout.LayoutParams layoutParams = (LayoutParams) mPagerIndicator.getLayoutParams();
Expand Down Expand Up @@ -437,7 +437,7 @@ public void setIndicatorOrientation(Orientation orientation) {
}

/**
* @param animations {@link IndicatorAnimations} of indicator dots
* @param animations {@link #SliderView#IndicatorAnimations} of indicator dots
*/
public void setIndicatorAnimation(IndicatorAnimations animations) {

Expand Down Expand Up @@ -487,7 +487,7 @@ public void setIndicatorVisibility(boolean visibility) {
}

/**
* @return number of items in {@link SliderViewAdapter}
* @return number of items in {@link #SliderView#SliderViewAdapter)}
*/
private int getAdapterItemsCount() {
try {
Expand Down Expand Up @@ -520,7 +520,7 @@ public void stopAutoCycle() {

/**
* This method setting direction of sliders auto cycling
* accepts constant values defined in {@link SliderView} class
* accepts constant values defined in {@link #SliderView} class
* {@value AUTO_CYCLE_DIRECTION_LEFT}
* {@value AUTO_CYCLE_DIRECTION_RIGHT}
* {@value AUTO_CYCLE_DIRECTION_BACK_AND_FORTH}
Expand Down Expand Up @@ -602,9 +602,9 @@ public int getIndicatorUnselectedColor() {

/**
* This method handles sliding behaviors
* which passed into {@link SliderView#mHandler}
* which passed into {@link #SliderView#mHandler}
*
* @see {@link SliderView#startAutoCycle()}
* see {@link #SliderView#startAutoCycle()}
*/
@Override
public void run() {
Expand All @@ -626,7 +626,7 @@ public void slideToNextPosition() {
int currentPosition = mSliderPager.getCurrentItem();
int adapterItemsCount = getAdapterItemsCount();

if (mAutoCycleDirection == AUTO_CYCLE_DIRECTION_BACK_AND_FORTH && adapterItemsCount > 0) {
if (mAutoCycleDirection == AUTO_CYCLE_DIRECTION_BACK_AND_FORTH && adapterItemsCount > 1) {
if (currentPosition % (adapterItemsCount - 1) == 0) {
mFlagBackAndForth = !mFlagBackAndForth;
}
Expand Down

0 comments on commit 85eb300

Please sign in to comment.