Skip to content

Commit 85eb300

Browse files
authored
Merge pull request #104 from smarteist/dev
Infinite scroll limit decreased ,back and forth division by zero exce…
2 parents b031aea + efe1d27 commit 85eb300

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

autoimageslider/src/main/java/com/smarteist/autoimageslider/InfiniteAdapter/InfinitePagerAdapter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
public class InfinitePagerAdapter extends PagerAdapter {
1414

15-
public static final int INFINITE_SCROLL_LIMIT = 40000;
15+
public static final int INFINITE_SCROLL_LIMIT = 32400;
1616
private static final String TAG = "InfinitePagerAdapter";
1717

1818
private SliderViewAdapter adapter;

autoimageslider/src/main/java/com/smarteist/autoimageslider/SliderPager.java

+20-20
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,9 @@ public interface OnPageChangeListener {
264264
}
265265

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

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

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

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

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

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

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

autoimageslider/src/main/java/com/smarteist/autoimageslider/SliderView.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ public boolean onTouch(View v, MotionEvent event) {
345345

346346
/**
347347
* @param animation set slider animation manually .
348-
* it accepts {@link SliderPager.PageTransformer} animation classes.
348+
* it accepts {@link ##PageTransformer} animation classes.
349349
*/
350350
public void setCustomSliderTransformAnimation(SliderPager.PageTransformer animation) {
351351
mSliderPager.setPageTransformer(false, animation);
@@ -400,7 +400,7 @@ public void setIndicatorAnimationDuration(long duration) {
400400
}
401401

402402
/**
403-
* @param gravity {@link View} integer gravity of indicator dots.
403+
* @param gravity {@link #View} integer gravity of indicator dots.
404404
*/
405405
public void setIndicatorGravity(int gravity) {
406406
FrameLayout.LayoutParams layoutParams = (LayoutParams) mPagerIndicator.getLayoutParams();
@@ -437,7 +437,7 @@ public void setIndicatorOrientation(Orientation orientation) {
437437
}
438438

439439
/**
440-
* @param animations {@link IndicatorAnimations} of indicator dots
440+
* @param animations {@link #SliderView#IndicatorAnimations} of indicator dots
441441
*/
442442
public void setIndicatorAnimation(IndicatorAnimations animations) {
443443

@@ -487,7 +487,7 @@ public void setIndicatorVisibility(boolean visibility) {
487487
}
488488

489489
/**
490-
* @return number of items in {@link SliderViewAdapter}
490+
* @return number of items in {@link #SliderView#SliderViewAdapter)}
491491
*/
492492
private int getAdapterItemsCount() {
493493
try {
@@ -520,7 +520,7 @@ public void stopAutoCycle() {
520520

521521
/**
522522
* This method setting direction of sliders auto cycling
523-
* accepts constant values defined in {@link SliderView} class
523+
* accepts constant values defined in {@link #SliderView} class
524524
* {@value AUTO_CYCLE_DIRECTION_LEFT}
525525
* {@value AUTO_CYCLE_DIRECTION_RIGHT}
526526
* {@value AUTO_CYCLE_DIRECTION_BACK_AND_FORTH}
@@ -602,9 +602,9 @@ public int getIndicatorUnselectedColor() {
602602

603603
/**
604604
* This method handles sliding behaviors
605-
* which passed into {@link SliderView#mHandler}
605+
* which passed into {@link #SliderView#mHandler}
606606
*
607-
* @see {@link SliderView#startAutoCycle()}
607+
* see {@link #SliderView#startAutoCycle()}
608608
*/
609609
@Override
610610
public void run() {
@@ -626,7 +626,7 @@ public void slideToNextPosition() {
626626
int currentPosition = mSliderPager.getCurrentItem();
627627
int adapterItemsCount = getAdapterItemsCount();
628628

629-
if (mAutoCycleDirection == AUTO_CYCLE_DIRECTION_BACK_AND_FORTH && adapterItemsCount > 0) {
629+
if (mAutoCycleDirection == AUTO_CYCLE_DIRECTION_BACK_AND_FORTH && adapterItemsCount > 1) {
630630
if (currentPosition % (adapterItemsCount - 1) == 0) {
631631
mFlagBackAndForth = !mFlagBackAndForth;
632632
}

0 commit comments

Comments
 (0)