Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private fun startAnimate() {
compositeDisposable.add(Observable
.interval(0, 1, TimeUnit.SECONDS)
.flatMap {
return@flatMap Observable
.interval(0, 100, TimeUnit.MILLISECONDS)
.take(image.size.toLong())
}
.map { it.toInt() }
.doAfterNext { if (it == (image.size - 1)) control *= -1 }
.map { if (control == 1) it else image.size - 1 - it }
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe { showImage(it) })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.