This file contains 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
class ScaleItemOnTouchListener : RecyclerView.OnItemTouchListener { | |
private var previousX = 0f | |
private var previousY = 0f | |
private var previousMotionX = 0f | |
private var previousMotionY = 0f | |
private object Constants { | |
const val SCALE_DEFAULT = 1f |
This file contains 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
class ScaleItemOnTouchListener : RecyclerView.OnItemTouchListener { | |
....... | |
override fun onInterceptTouchEvent(rv: RecyclerView, event: MotionEvent): Boolean { | |
var interceptTouch = false | |
when (event.actionMasked) { | |
MotionEvent.ACTION_DOWN -> { | |
previousMotionX = event.x | |
previousMotionY = event.y |
This file contains 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
class ScaleItemOnTouchListener : RecyclerView.OnItemTouchListener { | |
....... | |
override fun onTouchEvent(rv: RecyclerView, event: MotionEvent) { | |
val childView = rv.findChildViewUnder(event.x, event.y) | |
val previousChild = rv.findChildViewUnder(previousX, previousY) | |
if (childView != null) { | |
when (event.action) { |