Zurück zum Ranking

nisrulz/sensey

Kotlin

:zap: [Android Library] Play with sensor events & detect gestures in a breeze.

android-librarydetect-gesturesgesture-detectionsensorshake-detectionhandwave-detectionlight-detectionandroidmovement-detectionchop-detectionwrist-twist-detectionproximity-sensor
Sterne-Wachstum
Sterne
2.7k
Forks
267
Wochenwachstum
Issues
24
1k2k
Mai 2016Sept. 2019Feb. 2023Juli 2026
README

Banner

Maven Central GitHub stars GitHub forks

API 23+

Android library that makes sensor event and gesture detection a breeze. Eliminates boilerplate for setting up sensor-based gesture detection.

Quick Start

import com.github.nisrulz.sensey.senseyRegister
import com.github.nisrulz.sensey.gesture.shake.ShakeEvent
import com.github.nisrulz.sensey.gesture.flip.FlipEvent

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        senseyRegister(lifecycle) {
            shakePlugin { event ->
                when (event) {
                    ShakeEvent.Detected -> println("Shake detected!")
                    ShakeEvent.Stopped  -> println("Shake stopped")
                }
            }
            flipPlugin { event ->
                when (event) {
                    FlipEvent.FaceUp   -> println("Face up")
                    FlipEvent.FaceDown -> println("Face down")
                }
            }
        }
    }
}

Coroutines / Flow

Events as Flow<T> with lifecycle-aware collection:

import com.github.nisrulz.sensey.flow.senseyFlow

context.senseyFlow(lifecycle) {
    shakePlugin { event ->
        when (event) {
            ShakeEvent.Detected -> println("Shake detected!")
            ShakeEvent.Stopped  -> println("Shake stopped")
        }
    }
}

Auto-collects on STARTED, pauses on STOP, cleans up on DESTROY. All gestures support it.

// Compose
SenseyFlowEffect(lifecycle) {
    shakePlugin { /* events */ }
}

See the coroutines/flow guide for details.

Gestures

Shake, Flip, Light, Proximity, Movement, Orientation, Chop, TapOnBack, WristTwist, Wave, Scoop, PickupDevice, TiltDirection, RotationAngle, PinchScale, TouchType, EdgeSwipe, DiagonalSwipe, SoundLevel, Step, TurnOver, DeviceSpin, RaiseToEar, Clap, NodGesture, HeadShake.

See the usage guide for events, parameters, and examples.

Checkout

Including in your project

implementation 'com.github.nisrulz:sensey:{latest version}'

Latest version on Maven Central.

Sensey declares its dependencies as compileOnly. Depending on which features you use, add the required deps:

Feature Required dependency
Lifecycle-aware registration androidx.lifecycle:lifecycle-common
Flow-based API (SenseyFlow) kotlinx-coroutines-core
Touch gesture plugins androidx.compose.ui, androidx.compose.foundation

Sensor-only plugins (shake, flip, light, proximity, etc.) work with just sensey alone.

License

Licensed under the Apache License, Version 2.0.

Copyright 2016 Nishant Srivastava

Ähnliche Repositories
CymChad/BaseRecyclerViewAdapterHelper

BRVAH:Powerful and flexible RecyclerAdapter

KotlinMIT Licenserecyclerviewrecyclerview-adapter
recyclerview.org
24.6k5.2k
google/flexbox-layout

Flexbox for Android

KotlinApache License 2.0flexboxandroid
18.3k1.8k
zhihu/Matisse

:fireworks: A well-designed local image and video selector for Android

JavaMavenApache License 2.0androidandroid-library
12.5k2k
JStumpp/awesome-android

A curated list of awesome Android packages and resources.

Creative Commons Zero v1.0 Universalandroid-libraryandroid-development
12.2k1.8k
mikepenz/MaterialDrawer

The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.

KotlinApache License 2.0materialdrawerdrawer
mikepenz.dev
11.6k2k
wasabeef/recyclerview-animators

An Android Animation library which easily add itemanimator to RecyclerView items.

KotlinApache License 2.0androidandroid-library
11.5k2k
JessYanCoding/MVPArms

⚔️ A common architecture for Android applications developing based on MVP, integrates many open source projects, to make your developing quicker and easier (一个整合了大量主流开源项目高度可配置化的 Android MVP 快速集成框架).

JavaMavenApache License 2.0mvprxjava
10.2k2.4k
wasabeef/glide-transformations

An Android transformation library providing a variety of image transformations for Glide.

JavaMavenApache License 2.0androidandroid-library
9.9k1.4k
googlesamples/easypermissions

Simplify Android M system permissions

JavaMavenApache License 2.0androidandroid-library
firebaseopensource.com/projects/googlesamples/easypermissions/
9.9k1.5k
ksoichiro/Android-ObservableScrollView

Android library to observe scroll events on scrollable views.

JavaMavenApache License 2.0androidandroid-library
ksoichiro.github.io/Android-ObservableScrollView/
9.6k2k
Freelander/Android_Data

Some Android learning materials, hoping to help you learn Android development.

JavaMavenandroidawesome
8.9k2k
aritraroy/UltimateAndroidReference

:rocket: Ultimate Android Reference - Your Road to Become a Better Android Developer

JavaMavenApache License 2.0androidandroid-library
8.1k1.3k