Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. val iconMargin = (itemView.height - icon.intrinsicHeight) / 2
  2. val iconTop = itemView.top + (itemView.height - icon.intrinsicHeight) / 2
  3. val iconBottom = iconTop + icon.intrinsicHeight
  4.  
  5. if (dX < 0) { // Swiping to the left
  6. val iconLeft = itemView.right - iconMargin - icon.intrinsicWidth
  7. val iconRight = itemView.right - iconMargin
  8. icon.setBounds(iconLeft, iconTop, iconRight, iconBottom)
  9.  
  10. background.setBounds(itemView.right + dX.toInt() - backgroundCornerOffset,
  11. itemView.top, itemView.right, itemView.bottom)
  12.  
  13. } else { // view is unSwiped
  14. background.setBounds(0, 0, 0, 0)
  15. icon.setBounds(0, 0, 0, 0)
  16. }
  17.  
  18. background.draw(c)
  19. icon.draw(c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement