File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
library/src/main/java/com/daimajia/slider/library Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -588,14 +588,27 @@ private SliderAdapter getRealAdapter(){
588588 return null ;
589589 }
590590
591+ /**
592+ * get the current item position
593+ * @return
594+ */
595+ public int getCurrentPosition (){
596+
597+ if (getRealAdapter () == null )
598+ throw new IllegalStateException ("You did not set a slider adapter" );
599+
600+ return mViewPager .getCurrentItem () % getRealAdapter ().getCount ();
601+
602+ }
603+
591604 /**
592605 * get current slider.
593606 * @return
594607 */
595608 public BaseSliderView getCurrentSlider (){
596609
597610 if (getRealAdapter () == null )
598- return null ;
611+ throw new IllegalStateException ( "You did not set a slider adapter" ) ;
599612
600613 int count = getRealAdapter ().getCount ();
601614 int realCount = mViewPager .getCurrentItem () % count ;
You can’t perform that action at this time.
0 commit comments