Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val iconMargin = (itemView.height - icon.intrinsicHeight) / 2
- val iconTop = itemView.top + (itemView.height - icon.intrinsicHeight) / 2
- val iconBottom = iconTop + icon.intrinsicHeight
- if (dX < 0) { // Swiping to the left
- val iconLeft = itemView.right - iconMargin - icon.intrinsicWidth
- val iconRight = itemView.right - iconMargin
- icon.setBounds(iconLeft, iconTop, iconRight, iconBottom)
- background.setBounds(itemView.right + dX.toInt() - backgroundCornerOffset,
- itemView.top, itemView.right, itemView.bottom)
- } else { // view is unSwiped
- background.setBounds(0, 0, 0, 0)
- icon.setBounds(0, 0, 0, 0)
- }
- background.draw(c)
- icon.draw(c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement