Skip to content

Instantly share code, notes, and snippets.

@sagar-viradiya
Created August 15, 2017 11:02
Show Gist options
  • Save sagar-viradiya/7d400e40901eca6a300ca15735db2efc to your computer and use it in GitHub Desktop.
Save sagar-viradiya/7d400e40901eca6a300ca15735db2efc to your computer and use it in GitHub Desktop.
android_bot.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
flingAnimationX.setMinValue(0f).setMaxValue((screenSize.x - android_bot.width).toFloat())
flingAnimationY.setMinValue(0f).setMaxValue((screenSize.y - android_bot.height).toFloat())
android_bot.viewTreeObserver.removeOnGlobalLayoutListener(this)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment