gesture
How long is the event onLongPress in the Android?
The standard long press time is what is returned by getLongPressTimeout(), which is currently 500ms but may change (in 1.0 it was 1000ms but changed in a later release; maybe in the future it will be user-customizable). The browser uses its own long press time because it has some more complicated interactions. I believe this … Read more
Detect shake gesture IOS Swift
Swift3 ios10: override func viewDidLoad() { super.viewDidLoad() self.becomeFirstResponder() // To get shake gesture } // We are willing to become first responder to get shake motion override var canBecomeFirstResponder: Bool { get { return true } } // Enable detection of shake motion override func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) { if motion == … Read more
How can a service listen for touch gestures/events?
I had this same problem and I’ve finally figured it out! Thanks to this post: Creating a system overlay window (always on top). You need to use an alert window instead of an overlay (and this also means you can use it in Andoid ICS): WindowManager.LayoutParams params = new WindowManager.LayoutParams( WindowManager.LayoutParams.TYPE_SYSTEM_ALERT, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL|WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, PixelFormat.TRANSLUCENT); Then just … Read more
How to mimic two-finger scroll/drag gesture on ios simulator?
Holding the “Alt/Option” key and dragging simulates multi-touch pinch-to-zoom. Holding “Alt/Option + Shift” and dragging simulates multi-touch scrolling.
Gesture detection in Flutter TextSpan
You can improve by yourself import ‘package:flutter/gestures.dart’; … new RichText( text: new TextSpan(text: ‘Non touchable. ‘, children: [ new TextSpan( text: ‘Tap here.’, recognizer: new TapGestureRecognizer()..onTap = () => print(‘Tap Here onTap’), ) ]), );
SwipeRefreshLayout + ViewPager, limit horizontal scroll only?
I am not sure if you still have this issue but Google I/O app iosched solves this problem thusly: viewPager.addOnPageChangeListener( new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled( int position, float v, int i1 ) { } @Override public void onPageSelected( int position ) { } @Override public void onPageScrollStateChanged( int state ) { enableDisableSwipeRefresh( state … Read more
Draw on HTML5 Canvas using a mouse
Here is a working sample. <html> <script type=”text/javascript”> var canvas, ctx, flag = false, prevX = 0, currX = 0, prevY = 0, currY = 0, dot_flag = false; var x = “black”, y = 2; function init() { canvas = document.getElementById(‘can’); ctx = canvas.getContext(“2d”); w = canvas.width; h = canvas.height; canvas.addEventListener(“mousemove”, function (e) { … Read more
disable the swipe gesture that opens the navigation drawer in android
You should use: mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); It worked for me, the swipe to open the drawer was disabled. If it still won’t work, check out the answer provided here.