All Projects → saket → Flick

saket / Flick

Licence: apache-2.0
Flick dismiss all the things!

Programming Languages

kotlin
9241 projects

Labels

Projects that are alternatives of or similar to Flick

Interact
Brand New SwiftUI Library For Adding Dynamic Interaction To Views With Just A Single Modifier!
Stars: ✭ 107 (-75.51%)
Mutual labels:  gestures
multi-touch
Multi-Touch XAML Behaviors implementing Multi-Touch Manipulation (Gestures) and Inertia.
Stars: ✭ 23 (-94.74%)
Mutual labels:  gestures
Touche-Experiments
Interaction studies with a homemade Touché (swept-frequency capacitive) sensor
Stars: ✭ 20 (-95.42%)
Mutual labels:  gestures
React Native Easy Gestures
React Native Gestures. Support: Drag, Scale and Rotate a Component.
Stars: ✭ 153 (-64.99%)
Mutual labels:  gestures
Gebaar Libinput
Gebaar, A Super Simple WM Independent Touchpad Gesture Daemon for libinput
Stars: ✭ 249 (-43.02%)
Mutual labels:  gestures
gestures
A library for normalized events and gesture for desktop and mobile.
Stars: ✭ 31 (-92.91%)
Mutual labels:  gestures
React Spring Lightbox
📷 A flexible image gallery lightbox with native-feeling touch gestures and buttery smooth animations, built with react-spring.
Stars: ✭ 76 (-82.61%)
Mutual labels:  gestures
Swiftuikit
SwiftUIKit contains additional functionality for SwiftUI.
Stars: ✭ 289 (-33.87%)
Mutual labels:  gestures
use-pan-and-zoom
👆+🔎 React hook for panning and zooming a container
Stars: ✭ 57 (-86.96%)
Mutual labels:  gestures
speech-driven-hand-gesture-generation-demo
This repository contains the gesture generation model from the paper "Moving Fast and Slow" (https://www.tandfonline.com/doi/full/10.1080/10447318.2021.1883883) trained on the English dataset
Stars: ✭ 19 (-95.65%)
Mutual labels:  gestures
Sign Language Interpreter Using Deep Learning
A sign language interpreter using live video feed from the camera.
Stars: ✭ 157 (-64.07%)
Mutual labels:  gestures
Decomposed
CATransform3D manipulation made easy.
Stars: ✭ 184 (-57.89%)
Mutual labels:  gestures
use-gesture
👇Bread n butter utility for component-tied mouse/touch gestures in React and Vanilla Javascript.
Stars: ✭ 6,624 (+1415.79%)
Mutual labels:  gestures
Reanimated 2 Animations Challenges
React Native animations challenges using the new Reanimated2 API.
Stars: ✭ 136 (-68.88%)
Mutual labels:  gestures
gnome-gesture-improvements
Touchpad gesture improvements for GNOME on Wayland/X11
Stars: ✭ 53 (-87.87%)
Mutual labels:  gestures
Touche
The desktop application to configure Touchégg
Stars: ✭ 101 (-76.89%)
Mutual labels:  gestures
embla-carousel-wheel-gestures
wheel interactions for Embla Carousel
Stars: ✭ 30 (-93.14%)
Mutual labels:  gestures
Xf86 Input Mtrack
Xorg Multitouch Trackpad Driver
Stars: ✭ 391 (-10.53%)
Mutual labels:  gestures
Libinput Gestures
Actions gestures on your touchpad using libinput
Stars: ✭ 3,212 (+635.01%)
Mutual labels:  gestures
BottomSheet
Example project showing how to implement a bottom sheet in Swift 5 using container/child view controllers, UIPanGestureRecognizer, and constraint animations.
Stars: ✭ 31 (-92.91%)
Mutual labels:  gestures

Flick

Flick in action

Flick is a tiny library for flick dismissing images (or anything actually). You can read the announcement blog post to learn how Flick was created.

implementation 'me.saket:flick:1.7.0'

Usage

The sample project contains best practices for using Flick. You can download its APK from here for trying it out on your phone.

<me.saket.flick.FlickDismissLayout
  android:layout_width="match_parent"
  android:layout_height="wrap_content">

  <ImageView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>
</me.saket.flick.FlickDismissLayout>

Flick requires you to manually provide the content dimensions instead of it relying on the content View's dimensions. This is useful for scalable ImageViews, where the height will always be set to match-parent, but the actual image may or may not be consuming the entire space.

val callbacks = object : FlickCallbacks {
  override fun onMove(@FloatRange(from = -1.0, to = 1.0) moveRatio: Float) {
    // The content is being moved around. Updating the
    // background dimming is a good usecase for this callback.
  }

  override fun onFlickDismiss(animationDuration: Long) {
    // The content was been flicked and the Activity should
    // be dismissed once the flick animation is complete.
    flickDismissLayout.postDelayed({ finish() }, animationDuration)
  }
}
val contentSizeProvider = ContentSizeProvider2 { imageView.zoomedImageHeight() },
flickDismissLayout.gestureListener = FlickGestureListener(context, contentSizeProvider, callbacks)

Intercepting flicks

For usecases where the content can be scrolled further in the direction of the gesture, Flick exposes a way for intercepting flick detection,

// Block flick gestures if the image can pan further.
gestureListener.gestureInterceptor = { scrollY ->
  val isScrollingUpwards = scrollY < 0
  val directionInt = if (isScrollingUpwards) -1 else +1
  val canPanFurther = imageView.canScrollVertically(directionInt)

  when {
    canPanFurther -> InterceptResult.INTERCEPTED
    else -> InterceptResult.IGNORED
  }
}

License

Copyright 2019 Saket Narayan.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
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].