From 3eae5869c21eb9d6343def00df6298b66e3004b2 Mon Sep 17 00:00:00 2001 From: Tomoaki Imai Date: Sat, 26 Aug 2017 16:34:12 -0700 Subject: [PATCH] Create README.md --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..608cc6a --- /dev/null +++ b/README.md @@ -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.