File tree Expand file tree Collapse file tree 3 files changed +6
-12
lines changed
src/main/java/com/smarteist/autoimageslider/InfiniteAdapter Expand file tree Collapse file tree 3 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ This is an amazing image slider for the Android .
1010You can easily load images with your custom layout, and there are many kinds of amazing animations you can choose.
1111
1212``` groovy
13- implementation 'com.github.smarteist:autoimageslider:1.3.9 '
13+ implementation 'com.github.smarteist:autoimageslider:1.4.0 '
1414```
1515If you are using appcompat libraries use this one, but please migrate to androidx as soon as you can.
1616``` groovy
@@ -220,7 +220,7 @@ here is an example for adapter implementation :
220220
221221## Set the adapter to the Sliderview
222222
223- After the instantiating of the sliderView (inside the activity or fragment with findViewById|BindView blah blah ...), set the adapter to the slider.
223+ After the instantiating of the sliderView (inside the activity or fragment with findViewById|BindView...), set the adapter to the slider.
224224
225225``` java
226226 SliderView sliderView = findViewById(R . id. imageSlider);
Original file line number Diff line number Diff line change 1515 siteUrl = ' https://github.com/smarteist'
1616 gitUrl = ' https://github.com/smarteist/android-image-slider.git'
1717
18- libraryVersion = ' 1.3.9 '
18+ libraryVersion = ' 1.4.0 '
1919 organization = ' smarteistbintray' // if you push to organization's repository.
2020 developerId = ' smarteist'
2121 developerName = ' Ali Hosseini'
Original file line number Diff line number Diff line change 22
33import android .database .DataSetObserver ;
44import android .os .Parcelable ;
5+ import android .util .Log ;
56import android .view .View ;
67import android .view .ViewGroup ;
78
@@ -57,15 +58,8 @@ public int getRealCount() {
5758 * @return virtual mid point
5859 */
5960 public int getMiddlePosition (int item ) {
60- int realCount = getRealCount ();
61- int adapterCount = realCount - 1 == 0 ? 1 : realCount - 1 ;
62- int midpoint = adapterCount * (InfinitePagerAdapter .INFINITE_SCROLL_LIMIT / 2 );
63-
64- if (realCount != 0 && midpoint % realCount != 0 ) {
65- return midpoint + (realCount - midpoint % realCount ) + item ;
66- } else {
67- return midpoint + item ;
68- }
61+ int midpoint = Math .max (0 , getRealCount ()) * (InfinitePagerAdapter .INFINITE_SCROLL_LIMIT / 2 );
62+ return item + midpoint ;
6963 }
7064
7165 @ NonNull
You can’t perform that action at this time.
0 commit comments