-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from tomoima525/tomoima525-read-me
Create README.md
- Loading branch information
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Circular auto scrolling RecyclerView | ||
|
||
This is the implemention of a circular auto scrolling RecyclerView using Kotlin and RxJava | ||
|
||
![gif](https://github.com/tomoima525/InfiniteRotation/blob/master/art/result.gif) | ||
|
||
# Circular RecyclerView | ||
A basic idea behind a circular view is to looping back to the same item in a different element of an array. The diagram below explains how. | ||
Let's say there are 3 items(item1, item2, item3) in our array. Since the array only need the first and last elements of its content, the logic can be more efficient by appending the first element to the end of the array and adding the last element to the front of the array. | ||
|
||
![img2](https://github.com/tomoima525/InfiniteRotation/blob/master/art/img2.png) | ||
|
||
# Auto scrolling | ||
To make RecyclerView auto scroll, we have to call smoothScrollToPosition every specified interval of time. We can use Flowable.interval to emit sequential Long value. | ||
To stop auto scroll if a user swipes RecyclerView, we can listen to the scroll state change. |