Last active
May 27, 2020 12:43
-
-
Save baggednismo/fea80879eaa4d49a8e92505ea30166bc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
... | |
pager.registerOnPageChangeCallback(object : OnPageChangeCallback() { | |
override fun onPageSelected(position: Int) { | |
super.onPageSelected(position) | |
// Clear the messages so that every time an item has changed | |
// we reset our handler. | |
handler.removeMessages(0) | |
if (position == 0) btnBack.visibility = View.GONE | |
else btnBack.visibility = View.VISIBLE | |
val runnable = Runnable { pager.currentItem = position + 1 } | |
if (position < pager.adapter?.itemCount ?: 0) { | |
handler.postDelayed(runnable, timerDelay) | |
} | |
} | |
}) | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment