All Projects → sephiroth74 → Androiduigesturerecognizer

sephiroth74 / Androiduigesturerecognizer

Licence: mit
AndroidGestureRecognizer is an Android implementation of the Apple's UIGestureRecognizer framework

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Androiduigesturerecognizer

Rotatable
Helper class to make any view rotatable
Stars: ✭ 295 (+147.9%)
Mutual labels:  swipe, rotation
gestures
A library for normalized events and gesture for desktop and mobile.
Stars: ✭ 31 (-73.95%)
Mutual labels:  tap, swipe
Any Touch
👋 手势库, 按需2kb~5kb, 兼容PC / 移动端
Stars: ✭ 567 (+376.47%)
Mutual labels:  tap, swipe
XamarinFormsGesture
Xamarin Form Gesture Effects
Stars: ✭ 85 (-28.57%)
Mutual labels:  tap, swipe
Gesturerecognizerclosures
Closure support for handling gesture recognizers in Swift.
Stars: ✭ 84 (-29.41%)
Mutual labels:  tap, swipe
Homebrew Core
🍻 Default formulae for the missing package manager for macOS (or Linux)
Stars: ✭ 10,450 (+8681.51%)
Mutual labels:  tap
React Swipeable Bottom Sheet
A swipeable material's bottom sheet implementation, using react-swipeable-views
Stars: ✭ 106 (-10.92%)
Mutual labels:  swipe
Godot Swipe Detector
Detect gestures and swipes in your game
Stars: ✭ 90 (-24.37%)
Mutual labels:  swipe
Ionic Tinder Ui
Just a Tinder UI on Ionic
Stars: ✭ 86 (-27.73%)
Mutual labels:  swipe
Multiscroll.js
multiscroll plugin by Alvaro Trigo. Create scrolling split websites. http://alvarotrigo.com/multiScroll/
Stars: ✭ 1,537 (+1191.6%)
Mutual labels:  swipe
Android Keyboard
Android Keyboard with 180+ dictionaries. Support swipe input (sliding input), Emoji keyboard, AI predictions, dictionaries downloading, and keyboard themes.
Stars: ✭ 108 (-9.24%)
Mutual labels:  swipe
React Rotation
React rotation component
Stars: ✭ 102 (-14.29%)
Mutual labels:  rotation
Mipivotpagecontroller
MIPivotPageController allows switching view controllers with an horizontal swipe
Stars: ✭ 95 (-20.17%)
Mutual labels:  swipe
Tappy
Python Test Anything Protocol (TAP) tools
Stars: ✭ 106 (-10.92%)
Mutual labels:  tap
Konamicode
Installs the Konami code easter-egg into your Android app ;)
Stars: ✭ 90 (-24.37%)
Mutual labels:  swipe
Zap
A streamable structured interface for real time reporting of developer tools.
Stars: ✭ 114 (-4.2%)
Mutual labels:  tap
Angular Swipe
Simple vertical and horizontal swipe gesture directive for angular js
Stars: ✭ 88 (-26.05%)
Mutual labels:  swipe
React Native Swiper
The best Swiper component for React Native.
Stars: ✭ 9,797 (+8132.77%)
Mutual labels:  swipe
Sweetcurtain
A framework that provides CurtainController. CurtainController is a container view controller that implements a content-curtain interface. You can find a similar implementation in applications like Apple Maps, Find My, Stocks, etc. Someone calls it "Pull Up" or "Bottom Sheet".
Stars: ✭ 109 (-8.4%)
Mutual labels:  swipe
React Swipeable
React swipe event handler hook
Stars: ✭ 1,348 (+1032.77%)
Mutual labels:  swipe

Android UIGestureRecognizer

Travis CI buils status:
Build Status

Code Coverage:
Coverage Status

Latest Version:
Download

Android Arsenal


AndroidGestureRecognizer is an Android implementation of the Apple's UIGestureRecognizer framework (Reverse engineered). https://developer.apple.com/reference/uikit/uigesturerecognizer

For more info about the ui gesture recognizers look this WWDC video https://developer.apple.com/videos/play/wwdc2012/233/

From Apple API reference:

UIGestureRecognizer is an abstract base class for concrete gesture-recognizer classes. A gesture-recognizer object—or, simply, a gesture recognizer—decouples the logic for recognizing a gesture and acting on that recognition. When one of these objects recognizes a common gesture or, in some cases, a change in the gesture, it sends an action message to each designated target object.

Available Recognizers

UIGestureRecognizer that looks for single or multiple taps. For the gesture to be recognized, the specified number of fingers must tap the view a specified number of times.

Pinching is a continuous gesture. The gesture begins (began) when the two touches have moved enough to be considered a pinch gesture. The gesture changes (changed) when a finger moves (with both fingers remaining pressed). The gesture ends (ended) when both fingers lift from the view.

Rotation is a continuous gesture. It begins when two touches have moved enough to be considered a rotation. The gesture changes when a finger moves while the two fingers are down. It ends when both fingers have lifted. At each stage in the gesture, the gesture recognizer sends its action message.

UISwipeGestureRecognizer recognizes a swipe when the specified number of touches (numberOfTouchesRequired) have moved mostly in an allowable direction (direction) far enough to be considered a swipe. Swipes can be slow or fast. A slow swipe requires high directional precision but a small distance; a fast swipe requires low directional precision but a large distance.

A panning gesture is continuous. It begins (began) when the minimum number of fingers allowed (minimumNumberOfTouches) has moved enough to be considered a pan. It changes (changed) when a finger moves while at least the minimum number of fingers are pressed down. It ends (ended) when all fingers are lifted.

A gesture recognizer that looks for panning (dragging) gestures that starts near the edge of the screen.
The maximum distance between the screen edge can be changed overriding the resource dimension of gestures_screen_edge_limit.

Long-press gestures are continuous. The gesture begins (began) when the number of allowable fingers (numberOfTouchesRequired) have been pressed for the specified period (minimumPressDuration) and the touches do not move beyond the allowable range of movement (allowableMovement). The gesture recognizer transitions to the Change state whenever a finger moves, and it ends (ended) when any of the fingers are lifted.

Discrete vs Continuous

The gesture interpreted by a gesture recognizer can be either discrete or continuous. A discrete gesture, such as a double tap, occurs but once in a multi-touch sequence and results in a single action sent. However, when a gesture recognizer interprets a continuous gesture such as a rotation gesture, it sends an action message for each incremental change until the multi-touch sequence concludes. (from https://developer.apple.com/reference/uikit/uigesturerecognizer)

There are 2 types of UI GestureRecognizers: UIContinuousRecognizer and UIDiscreteGestureRecognizer

UIDiscreteGestureRecognizer

Gesture Recognizers that implement this interface will only fire the Ended state change. Internally they will switch between Possible, Ended, Failed or Cancelled state.

UIContinuousRecognizer

A continuous gesture which will dispatch Began, Changed and Ended state changed events (for instance a pinch gesture, or a rotate gesture).


Demo

Single Tap Double Tap Double Tap 2 Fingers

Logn Press Long Press Double Tap

Pan 1 Finger Pan 2 Fingers

Pinch

Rotate Rotate min angle

Screen Edge 1 Finger Screen Edge 2 Fingers

Swipe Left 1 Finger Swipe Left 2 Fingers

Installation

Maven

Add the library dependency:

implementation 'it.sephiroth.android.library.uigestures:uigesture-recognizer-kotlin:**version**'

JitPack

Step 1. Add the JitPack repository to your build file:

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

Step 2. Add the dependency to your project's build.gradle file:

dependencies {
        implementation 'com.github.sephiroth74:AndroidUIGestureRecognizer:Tag'
}

To See the last release version: https://jitpack.io/#sephiroth74/AndroidUIGestureRecognizer/


Example

    class MainActivity : AppCompatActivity() {

        override fun onCreate(savedInstanceState: Bundle?) {
            ...

            val delegate = UIGestureRecognizerDelegate();

            // single tap gesture
            val recognizer1 = new UITapGestureRecognizer(this)
            recognizer1.tapsRequired = 1
            recognizer1.touchesRequired = 1
            recognizer1.tag = "single-tap";
            recognizer1.actionListener = actionListener

            // double tap gesture
            val recognizer2 = UITapGestureRecognizer(this)
            recognizer2.tag = "double-tap"
            recognizer2.tapsRequired = 2
            recognizer2.touchesRequired = 1
            recognizer2.actionListener = actionListener

            // We want to recognize a single tap and a double tap separately. Normally, when the user
            // performs a double tap, the single tap would be triggered twice.
            // In this way, however, the single tap will wait until the double tap will fail. So a single tap
            // and a double tap will be triggered separately.
            recognizer1.requireFailureOf = recognizer2

            // add both gestures to the delegate
            delegate.addGestureRecognizer(recognizer)
            delegate.addGestureRecognizer(recognizer2)

            // forward the touch events to the delegate
            val rootView = findViewById(R.id.root)
            rootView.setGestureDelegate(delegate)

            // optional delegate methods
            delegate.shouldReceiveTouch = { recognizer -> true }
            delegate.shouldBegin = { recognizer -> true }
            delegate.shouldRecognizeSimultaneouslyWithGestureRecognizer = { recognizer, other -> true }
        }

        // gesture recognizer actionlistener
        private val actionListener = { recognizer: UIGestureRecognizer ->
            // gesture recognized
        }


JavaDoc

https://github.com/sephiroth74/AndroidUIGestureRecognizer/blob/master/docs/it.sephiroth.android.library.uigestures/index.md

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].