Skip to content

Catch gesture and simulate lnput gesture (可用来捕获手势,模拟手势输入)

Notifications You must be signed in to change notification settings

FlodCoding/GestureCatchView

Repository files navigation

GestureCatchView GestureCatchView

Catching gesture and load gesture with animation, similar to GestureOverlayView

Feature

  • Collecting multiple gesture
  • Load gesture list or gesture path
  • fade path anim
  • Custom path color or width

How to install 中文说明

root directory build.gradle

	allprojects {
	
		  repositories {
		  	...
		  	maven { url 'https://jitpack.io' }
		  	 
		  }
	}

App module build.gradle

 	dependencies {
		//need Androidx and kotlin
 		implementation 'com.github.FlodCoding:GestureCatchView:1.0.0-alpha01'
		
	}

image.png

Demo screenshot

1.gif

2.gif

Basic usage

XML

<com.flod.widget.gesture.GestureCatchView
        android:id="@+id/gestureView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:fadeStyle="Delay"
        app:pathColor="@android:color/tab_indicator_text"
        app:pathDrawLayer="TOP"
        app:pathWidth="10dp">
        
</com.flod.widget.gesture.GestureCatchView>

Code

// Start collect
gestureView.startCollect()
// Stop collect and get getsture list
val gestureInfoList = gestureView.stopCollect()

// Clear all path
gestureView.clear() 

Callback

gestureView.onGestureListener = object : GestureCatchView.OnGestureListener() {
    override fun onGesturing(motionEvent: MotionEvent) {

    }

    override fun onGestureFinish(gestureInfo: GestureInfo) {
       
    }

    override fun onCollectionDone(list: ArrayList<GestureInfo>) {
        
    }
}


Attribute

XML

Attribute name type Default value Description
enabled boolean true disable catching any gesture
globalPoint boolean false according to the screen as coordinates,or view
pathWidth dimension 15px path stroke width
pathColor color black path color
pathDrawLayer enum
(Top,Bottom)
Top draw layer,Top or bottom
fadeEnabled boolean true enable fade path
fadeStyle enum
(Delay,Next,Keep)
Delay Delay:start fade after delay
Next:start fade after next gesture
Keep:keep all
fadeDelay integer 0 set delay time when fadeStyle is Delay
fadeDuration integer 1500 set fade animation time
tapMaxLimit dimension 15px lower than the set value is Tap or Press
(GestureCatchView.Type:Gesture, Tap, LongPress)
longPressDuration integer 1500 minimum time to trigger longPress when gesture type is LongPress

Public Func

Method name Parameter Description
startCollect - start collect gesture list
stopCollect - stop collect gesture and get list
clear - clear all gesture path on view
loadGestureInfoWithAnim ArrayList load GestureInfo list, simulate input gestures
loadGestureInfo ArrayList load GestureInfo list without anim
loadPath ArrayList load path

About

Catch gesture and simulate lnput gesture (可用来捕获手势,模拟手势输入)

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages