gesturedetector

Multiply gesture detector in flutter

亡梦爱人 提交于 2020-07-10 10:25:25
问题 I have two views one over another and want get touches in both views. But now get touches only second view. How can I configure GestureDetector that all touches will be send both widgets import 'package:flutter/material.dart'; class TestPage extends StatefulWidget { TestPage(); @override _TestPageState createState() => _TestPageState(); } class _TestPageState extends State<TestPage> { @override Widget build(BuildContext context) { // TODO: implement build return Scaffold( backgroundColor:

Implement Swipe function in WebView and call a Javascript Function via a Javascript Interface

六眼飞鱼酱① 提交于 2020-01-15 10:22:25
问题 I want to implement Swipe Features in my WebView App and call functions in the Javascript of the HTML/Javascript App when a swipe is made. According to the answer of this problem: How to detect a swipe gesture on webview I made something like this: package (...); import (...) public class MainActivity extends Activity { WebView mywebview; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mywebview = (WebView)

Android Click button behind another button

你。 提交于 2020-01-07 04:33:06
问题 I have 6 Buttons (green) that open apps. On top of this buttons there is another button which I use for swipe listener. If no swipe is detected (click) I want to click green buttons else perform swipe action triggered by red button. here is my TouchListener taken from here public class OnSwipeTouchListener implements OnTouchListener { private final GestureDetector gestureDetector; public OnSwipeTouchListener (Context ctx){ gestureDetector = new GestureDetector(ctx, new GestureListener()); }

switch between doubleTap and Swipe

孤街醉人 提交于 2020-01-05 05:49:05
问题 I have a RelativeLayout I am putting a TouchListener into using GestureDetector. I have already done and can detect double tapping but how can I add a swipe event in the view also? private void myTapEvent(){ RlContent.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return gestureDetector.onTouchEvent(event); } }); gestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() { @Override public boolean

GestureDetector.onTouchEvent(MotionEvent e) calling onLongPress on all gestures

旧城冷巷雨未停 提交于 2020-01-02 09:55:45
问题 I have a custom view on which I want to set long click listener. I am using following code to set the same. final GestureDetector gestureDetector = (new GestureDetector(new GestureDetector.SimpleOnGestureListener() { public void onLongPress(MotionEvent e) { Log.e("test", "Long press detected"); } })); public boolean onTouchEvent(MotionEvent event) { return gestureDetector.onTouchEvent(event); } The problem is on all gestures whether it is a single tap, double tap onLongPress is getting called

Android onTouchListener for entire dialog

孤街浪徒 提交于 2019-12-29 08:07:12
问题 I have a dialog to choose files from. This dialog contains a listview to show directories and files and has an onItemClickListener for navigation purposes. How can I react to fling events to go up in the directory structure? I tried setting an OnTouchListener on the root RelativeLayout to dispatches touch events to my GestureListener: final GestureDetector detector = new GestureDetector(new MyGestureDetector(tvCurrentPath)); dialog.findViewById(R.id.rlFilelist).setOnTouchListener(new

Flutter: GestureDetector apparently doesn't receive Drag events when it has a ListView in it

本秂侑毒 提交于 2019-12-24 10:37:45
问题 Am I missing something? The documentation says that events bubble up from the innermost child to the ancestors, but below code will not print "dragged" to the console. It does print "tapped" though. Applying NeverScrollablePhyiscs to the ListView does work, but i want to listen on the event on both levels. Applying HitTestBehavior.translucent to the GestureDetector doesn't change anything. import "package:flutter/material.dart"; void main() => runApp(MyApp()); class MyApp extends

onFling for a TextView not working

这一生的挚爱 提交于 2019-12-21 05:07:29
问题 I'm trying to detect an onFling event for a TextView object. The code below works perfectly for the onDown event, however it fails to get the onScroll or onFling events. Any pointers? Thanks package rob.testapp; import android.app.Activity; import android.os.Bundle; import android.view.GestureDetector; import android.view.GestureDetector.SimpleOnGestureListener; import android.view.MotionEvent; import android.view.View; import android.widget.TextView; public class MainActivity extends

How to get GestureDetector working correctly

只谈情不闲聊 提交于 2019-12-14 03:42:27
问题 I have this code so far in my Activity: private class SwipeGestureDetector extends SimpleOnGestureListener { // Swipe properties, you can change it to make the swipe // longer or shorter and speed private static final int SWIPE_MIN_DISTANCE = 120; private static final int SWIPE_MAX_OFF_PATH = 200; private static final int SWIPE_THRESHOLD_VELOCITY = 200; @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { try { float diffAbs = Math.abs(e1.getY()