Skip to content

s2g090123/GestureListener

Repository files navigation

GestureListener

About

A Custom TouchListener that detects gesture operations, currently supporting the following operations:

  1. single tap
  2. double tap
  3. long press
  4. drag
  5. two-finger operations

How to use

view.setOnTouchListener(
            object : GestureListener() {
                override fun onStart(event: MotionEvent): Boolean = true

                override fun onFinish(event: MotionEvent) {}

                override fun onClick(event: MotionEvent) {
                    // onClick
                }

                override fun onLongClick(event: MotionEvent) {
                    // onLongClick
                }

                override fun onDoubleTap(event: MotionEvent) {
                    // onDoubleTap
                }

                override fun onDrag(event: MotionEvent, dx: Float, dy: Float) {
                    // onDrag
                }

                override fun onGesture(
                    event: MotionEvent,
                    ds: Float,
                    dr: Float,
                    dx: Float,
                    dy: Float,
                    centerPoint: PointF
                ) {
                    // onGesture
                }
            }
        )

Video

screen-20230226-155834.mp4

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages