项目作者: iammert

项目描述 :
Custom touch gestures for Android
高级语言: Kotlin
项目地址: git://github.com/iammert/GestureDetector.git
创建时间: 2018-12-30T15:52:55Z
项目社区:https://github.com/iammert/GestureDetector

开源协议:

下载


GestureDetector

Custom touch gestures for Android.

PS. Please don’t hesitate the open pull request for desired gestures. So we can expand the gesture list.

LongTouchGestureDetector

This is the combination of onTouch and onLongPress.
In android there is not way to get all continuing touch event after a long press. Framework’s LongPressListener only emits the long press event.
LongTouchGestureDetector combines onTouch and onLongPress event. And also buffers the ACTION_DOWN event and emits it first.

  1. val longTouchGestureDetector = LongTouchGestureDetector(object : LongTouchGestureDetector.LongTouchListener {
  2. override fun onLongTouchEvent(event: MotionEvent) {
  3. // gets every touch events after a long press
  4. }
  5. })
  6. view.setOnTouchListener { _, event -> longTouchGestureDetector.onTouchEvent(event) }

Setup

  1. allprojects {
  2. repositories {
  3. ...
  4. maven { url 'https://jitpack.io' }
  5. }
  6. }
  1. dependencies {
  2. implementation 'com.github.iammert:GestureDetector:-SNAPSHOT'
  3. }

License

  1. Copyright 2018 Mert Şimşek.
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.