Advertisement
Guest User

guga

a guest
Jul 25th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. override fun onOffsetChanged(appBarLayout: AppBarLayout, verticalOffset: Int) {
  2. if(maxScrollSize == 0)
  3. maxScrollSize = appBarLayout.totalScrollRange
  4.  
  5. val currentScrollPercentage = (Math.abs(verticalOffset)) * 100 / maxScrollSize
  6.  
  7. if(currentScrollPercentage >= IMAGE_SHOW_PERCENT)
  8. if(!isImageHidden){
  9. isImageHidden = true
  10. ViewCompat.animate(reserveIconFAB).scaleY(0f).scaleX(0f).start()
  11. }
  12. if(currentScrollPercentage < IMAGE_SHOW_PERCENT)
  13. if(isImageHidden){
  14. isImageHidden = false
  15. ViewCompat.animate(reserveIconFAB).scaleY(1f).scaleX(1f).start()
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement