Android Library to implement simple touch/tap/swipe gestures

Overview

SimpleFingerGestures

An android library to implement simple 1 or 2 finger gestures easily

Paypal Donate

Book session on Codementor

Build Status Android Arsenal Release

Example


Library

The library is inside the libSFG folder

Sample App

The sample App is inside the sample folder

Implementing SimpleFingerGestures

  1. Create an object of class SimpleFingerGestures
private SimpleFingerGestures mySfg = new SimpleFingerGestures();
  1. Implement the required gestures via this object
mySfg.setOnFingerGestureListener(new SimpleFingerGestures.OnFingerGestureListener() {
            @Override
            public boolean onSwipeUp(int fingers, long gestureDuration, double gestureDistance) {
                grtv.setText("swiped " + fingers + " up");
                return false;
            }

            @Override
            public boolean onSwipeDown(int fingers, long gestureDuration, double gestureDistance) {
                grtv.setText("swiped " + fingers + " down");
                return false;
            }

            @Override
            public boolean onSwipeLeft(int fingers, long gestureDuration, double gestureDistance) {
                grtv.setText("swiped " + fingers + " left");
                return false;
            }

            @Override
            public boolean onSwipeRight(int fingers, long gestureDuration, double gestureDistance) {
                grtv.setText("swiped " + fingers + " right");
                return false;
            }

            @Override
            public boolean onPinch(int fingers, long gestureDuration, double gestureDistance) {
                grtv.setText("pinch");
                return false;
            }

            @Override
            public boolean onUnpinch(int fingers, long gestureDuration, double gestureDistance) {
                grtv.setText("unpinch");
                return false;
            }

            @Override
            public boolean onDoubleTap(int fingers) {
                return false;
            }
        });
  1. And finally set this object onto your view's OnTouchListener

    myView.setOnTouchListener(mySfg);
    

    This can be set as the OnTouchListener of any object that is derived from android.view.View

How to add to your project

The easiest way to add to your project is the download the latest zip from the Releases tab. Inside you'll find a compiled library in .jar format that you can just drop in to the libs folder of your Android app project for it to get automatically added as a library

Also you can add it using jitpack maven distribution.
Add the jitpack maven repository

    repositories {
        jcenter()
        maven {
            url "https://jitpack.io"
        }
    }

Add the dependency

 
 dependencies {
	        compile 'in.championswimmer:SimpleFingerGestures_Android_Library:1.2'
	}

Documentation

Find documentation at

http://championswimmer.github.io/SimpleFingerGestures_Android_Library/documentation

Comments
  • squid:S1213 - The members of an interface declaration or class should…

    squid:S1213 - The members of an interface declaration or class should…

    This pull request is focused on resolving occurrences of Sonar rule squid:S1213 - The members of an interface declaration or class should appear in a pre-defined order

    You can find more information about the issue here: https://dev.eclipse.org/sonar/coding_rules#q=squid:S1213

    Please let me know if you have any questions.

    M-Ezzat

    opened by m-ezzat 1
  • Fix broken headings in Markdown files

    Fix broken headings in Markdown files

    GitHub changed the way Markdown headings are parsed, so this change fixes it.

    See bryant1410/readmesfix for more information.

    Tackles bryant1410/readmesfix#1

    opened by bryant1410 0
  • Migrate LGTM.com installation from OAuth to GitHub App

    Migrate LGTM.com installation from OAuth to GitHub App

    Hi There,

    This project is still using an old implementation of LGTM's automated code review, which has now been disabled. To continue using automated code review, and receive checks on your Pull Requests, please install the GitHub App on this repository.

    Thanks, The LGTM Team

    opened by LGTM-badger 0
  • Try to listen to events on ListView

    Try to listen to events on ListView

    Hi,

    I am trying to show a custom view when the user is at the last item in my list (last message in chat app) and swiping up. I think i can do that with your lib but it doesn't work.

    SimpleFingerGestures sfg = new SimpleFingerGestures();
        sfg.setDebug(true);
        sfg.setConsumeTouchEvents(true);
    
        sfg.setOnFingerGestureListener(new SimpleFingerGestures.OnFingerGestureListener() {
            @Override
            public boolean onSwipeUp(int fingers, long gestureDuration, double gestureDistance) {
                Log.d(TAG, "Swipe Up ----- Fingers: " + fingers + "\ngestureDuration: " + gestureDuration + "\ngestureDistance: " + gestureDistance);
    
    
                return false;
            }
    
            @Override
            public boolean onSwipeDown(int fingers, long gestureDuration, double gestureDistance) {
    
                Log.d("Swipe", "Swipe Up Down ------ Fingers: " + fingers + "\ngestureDuration: " + gestureDuration + "\ngestureDistance: " + gestureDistance);
                return false;
            }
    
            @Override
            public boolean onSwipeLeft(int fingers, long gestureDuration, double gestureDistance) {
                Log.d("Swipe", "Fingers: " + fingers + "\ngestureDuration: " + gestureDuration + "\ngestureDistance: " + gestureDistance);
                return false;
            }
    
            @Override
            public boolean onSwipeRight(int fingers, long gestureDuration, double gestureDistance) {
    
                Log.d("Swipe", "Fingers: " + fingers + "\ngestureDuration: " + gestureDuration + "\ngestureDistance: " + gestureDistance);
                return false;
            }
    
            @Override
            public boolean onPinch(int fingers, long gestureDuration, double gestureDistance) {
                return false;
            }
    
            @Override
            public boolean onUnpinch(int fingers, long gestureDuration, double gestureDistance) {
                return false;
            }
    
            @Override
            public boolean onDoubleTap(int fingers) {
                return false;
            }
        });
    
        listMessages.setOnTouchListener(sfg);
    

    view_chat

    opened by droididan 0
  • GestureAnalyser class returned don't correct  the swipe direction

    GestureAnalyser class returned don't correct the swipe direction

    How to reproduce bug: Step 1: Put finger in View and swipe to up. Step 2: Without lifting finger now keep down. Method calcGesture in object GestureAnalyser - returned SWIPE_1_UP, but now your swipe down.

    Method calcGesture in object GestureAnalyser -returned correct value when your finger down below start point(where your finger put first time)

    opened by Nikonov 2
Releases(1.2)
Owner
Arnav Gupta
Co-Founder @coding-blocks 💼 ➕ Android & NodeJS mentor 👨🏻‍🏫 ➕ Ex- @AOKP @fossasia ⚙️ ◀️ in another universe ▶️ Android dev @Zomato as @arnavzoman 🍔
Arnav Gupta
A Tinder-like Android library to create the swipe cards effect. You can swipe left or right to like or dislike the content.

Swipecards Travis master: A Tinder-like cards effect as of August 2014. You can swipe left or right to like or dislike the content. The library create

Dionysis Lorentzos 2.3k Dec 9, 2022
Material Design tap target for Android. https://sjwall.github.io/MaterialTapTargetPrompt/

Material Tap Target Prompt A Tap Target implementation in Android based on Material Design Onboarding guidelines. For more information on tap targets

Sam Wall 1.5k Jan 4, 2023
An implementation of tap targets from the Material Design guidelines for feature discovery.

TapTargetView An implementation of tap targets from Google's Material Design guidelines on feature discovery. Min SDK: 14 JavaDoc Installation TapTar

Keepsafe 5.2k Dec 30, 2022
Simple and powerful library to emulate iOS's "3D Touch" preview functionality on Android.

Android 3D Touch - PeekView iOS uses 3D Touch as a way to "peek" into full content, such as emails, pictures, web searches, etc. While they have dedic

Luke Klinker 502 Dec 29, 2022
Stepper Touch for Android based on MaterialUp submission

Stepper-Touch For more updates on this and other open-source projects, follow me on twitter ?? here Stepper Touch for Android based on a Material Up s

Dion Segijn 667 Jan 1, 2023
A view to show bling bling stars when you touch it.

AndroidGlitterView A view to show bling bling stars when you touch it. Demo Dependency compile('com.liangfeizc:glitterview:1.0.0@aar') Attributes name

Fei Liang 177 Nov 10, 2022
A simple implementation of swipe card like StreetView

A simple implementation of swipe card like StreetView!! DONATIONS This project needs you! If you would like to support this project's further developm

Michele Lacorte 831 Jan 4, 2023
Android library which allows you to swipe down from an activity to close it.

Android Sliding Activity Library Easily create activities that can slide vertically on the screen and fit well into the Material Design age. Features

Jake Klinker 1.3k Nov 25, 2022
Android swipe-to-dismiss mini-library and sample code

Android Swipe-to-Dismiss Sample Code Sample code that shows how to make ListView or other views support the swipe-to-dismiss Android UI pattern. See t

Roman Nurik 1.3k Dec 29, 2022
Android jetpack compose swipe library

Swiper for Android Jetpack Compose Android Jetpack Compose swipe library. Downlo

null 32 Dec 10, 2022
Implement a simple and funny Android animation —— the emoji rain in WeChat app.

中文版文档 Emoji Rain Hey, it's raining emoji! This is a really simple and funny animation for Android. You could find similar animations when sending "Hap

LoLo 615 Nov 21, 2022
SwipeBack for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swipe gesture

SwipeBack SwipeBack is for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swi

Hannes Dorfmann 697 Dec 14, 2022
A swipe button for Android with a circular progress bar for async operations

ProSwipeButton A swipe button for Android with a circular progress bar for async operations Gradle dependencies { ... compile 'in.shadowfax:pr

Shadowfax Technologies 340 Nov 13, 2022
Regret is an Android library for apps that wants to implement an undo/redo feature

Regret I've been developing on an editor for my Android App recently, using Jetpack Compose, but Google doesn't implement a built-in undo / redo for d

Moriafly 5 Jun 29, 2022
A player/ recorder visualizer with the swipe to seek functionality.

iiVisu A player/ recorder visualizer with the swipe to seek functionality. Demo Setup Step 1. Add the JitPack repository to your build file Add it in

Iman Irandoost 126 Nov 25, 2022
Card with swipe options in Jetpack Compose

SwipeableActionCard Card with swipe options in Jetpack Compose Tutorial: Click Here Import SwipeableActionCard library Add this in project level build

Harsh Mahajan 1 Nov 23, 2021
Simple and lightweight UI library for user new experience, combining floating bottom navigation and bottom sheet behaviour. Simple and beautiful.

Simple and lightweight UI library for user new experience, combining floating bottom navigation and bottom sheet behaviour. Simple and beautiful.

Rizki Maulana 118 Dec 14, 2022
This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.

Note: we are not actively responding to issues right now. If you find a bug, please submit a PR. Android Sliding Up Panel This library provides a simp

Umano: News Read To You 9.4k Dec 31, 2022
A simple library to add Emoji support to your Android Application

Emoji A library to add Emoji support to your Android app. Emojis can be picked in a PopupWindow. In order to edit and display text with Emojis this li

Niklas Baudy 1.4k Jan 4, 2023