logo
down
shadow

How to detect doubletap on a View?


How to detect doubletap on a View?

Content Index :

How to detect doubletap on a View?
Tag : android , By : Boris
Date : January 10 2021, 01:57 PM


Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

how to detect doubletap without triggering silgeltap in sencha touch


Tag : development , By : Ryan Adriano
Date : March 29 2020, 07:55 AM
To fix the issue you can do I don't think there is a 'clean' way to do it. It will delay the single tap option by 300ms which may be unacceptable. You may want to simplify your UI interactions if you can. Maybe a tap and hold?
I found this code in the Sencha Touch forums.
setupEventHandlers: function(){
this.mon(this.el, {
    tap: function(e){            
        if(this.delayedTask == null){            
            //setup a delayed task that is called IF double click is not later detected
            this.delayedTask = new Ext.util.DelayedTask(
              function(){
                this.doSomethingInteresting(); 
                this.delayedTask = null;
              }, this);  

            //invoke (with reasonable time to cancel)
            this.delayedTask.delay(300);
        }                
    }, 
    doubletap: function(e){                
        //cancel and clear the queued single click tasks if it's there
        if(this.delayedTask != null){
          this.delayedTask.cancel();
          this.delayedTask = null;
        }                        

        //handle the double click
        this.doSomethingReallyInteresting();
    },        
    scope: this
});

DoubleTap detection on Android "View" component


Tag : android , By : mckasty
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further It is RESOLVED now...!! Seems the best way to tackle the issue was to create gestureDetector class and implement "SimpleOnGestureListener"..
I had to tweak the implementation a little bit... but the skeleton code is much more similar to what is explained here in this post... Fling gesture detection on grid layout

Android - Detect doubletap AND tripletap on view


Tag : android , By : jaime
Date : March 29 2020, 07:55 AM
this will help You can try something like this.
Though I would generally recommend against using triple taps as a pattern as it is not something users are generally used to, so unless it's properly communicated to them, most might never know they can triple tap a view. Same goes for double taping actually on mobile devices, it's not always an intuitive way to interact in that environment.
view.setOnTouchListener(new View.OnTouchListener() {
    Handler handler = new Handler();

    int numberOfTaps = 0;
    long lastTapTimeMs = 0;
    long touchDownMs = 0;

    @Override
    public boolean onTouch(View v, MotionEvent event) {

        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                touchDownMs = System.currentTimeMillis();
                break;
            case MotionEvent.ACTION_UP:
                handler.removeCallbacksAndMessages(null);

                if ((System.currentTimeMillis() - touchDownMs) > ViewConfiguration.getTapTimeout()) {
                    //it was not a tap

                    numberOfTaps = 0;
                    lastTapTimeMs = 0;
                    break;
                }

                if (numberOfTaps > 0 
                        && (System.currentTimeMillis() - lastTapTimeMs) < ViewConfiguration.getDoubleTapTimeout()) {
                    numberOfTaps += 1;
                } else {
                    numberOfTaps = 1;
                }

                lastTapTimeMs = System.currentTimeMillis();

                if (numberOfTaps == 3) {
                    Toast.makeText(getApplicationContext(), "triple", Toast.LENGTH_SHORT).show();
                    //handle triple tap
                } else if (numberOfTaps == 2) {
                    handler.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            //handle double tap
                            Toast.makeText(getApplicationContext(), "double", Toast.LENGTH_SHORT).show();
                        }
                    }, ViewConfiguration.getDoubleTapTimeout());
                }
        }

        return true;
    }
});

How to listen to doubletap on a view in android?


Tag : android , By : user92243
Date : March 29 2020, 07:55 AM

Swift SKSpriteNode: Detect Tap / DoubleTap / LongPress


Tag : ios , By : T11M
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • Is there any way to launch my application right away without 'Ok Google"?
  • Places api set location biased based on current location
  • Layout Preview is not displaying layout when Material Design is added
  • How do I resolve this diamond problem in Kotlin?
  • How to update the custom value in a view model object
  • How to stop refreshing/re-creating activity when updating Firebase data using setValue?
  • Manifest Permissions vs App Setttings Permissions
  • NumberFormatException in Try-Catch while converting String to Int
  • How to pass observable fields through include tag?
  • Next button on Android keyboard not submitting form
  • Does Firestore support automatic functions for updates?
  • Why app crashing because of a missing dimension (for google maps) only when I apply changes?
  • How to make a grouping, ordering and sorting: Kotlin collection
  • how to use augmented reality to change the color of a qr code once it is detected using with arcore and ml kit firebase
  • how to resolve Firebase projects adding quota problem?
  • Why it Kotlin giving me the wrong Int value when converting from a String
  • How to add bottom navigation listeners to fragments
  • Why is scrollview hiding buttons behind other views?
  • Open Settings using Linking.sendIntent()
  • How do I access an unknown node in firebase while retrieving data?
  • Can't retrieve list of all users from firebase authetication
  • many activities with same content (adview, reward adview, functions...) how to avoid repeating code?
  • Popup doesn't hide when touch outside
  • proper way to handling images in Android? by using Firebase
  • Android: Button is faded gray when it should be transparent
  • Gradle DSL method not found: 'deleteAllActions()'
  • In Clean Architecture, must Repository is Android or Kotlin module?
  • Kotlin parse double from string
  • Inconsistency detected. Invalid view holder adapter positionViewHolder
  • In App Update API always returns 1 (UPDATE_NOT_AVAILABLE)
  • Event of ImageView when click
  • Basic precautions to prevent piracy?
  • What is the difference between 'center' and 'centerCrop' in the "ImageView"?
  • Unable to receive SIP calls when app is killed
  • Android emulator not processing http get request, but iOS simulator works fine
  • Android Problem with sharing temporary file
  • How to add Broadcast in Android?
  • How to hide 'Running in Chrome' toast on TWA application on Android devices?
  • How to Fix Error: Could not find method deleteAllActions() for arguments [] on task
  • Android Deep Linking not working with https
  • WARNING: API 'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()'
  • setSupportActionBar (androidx.appcompat.widget.Toolbar) in AppCompatActivity¬†cannot be applied
  • Manifest merger failed after adding Firebase core version 17.0.0
  • Marker from Firestore map data type
  • Cordova signed apk produces a blank screen after splash screen
  • How to clear EditText input from all item views of RecyclerView?
  • Android Studio Mac Fresh install - error after error after error
  • Android Q, programmatically connect to different WiFi AP for internet
  • Application is becoming very slow while retrieving data from server
  • How to get Accelerometer value in Android XAML App(Xamarin.Forms)
  • androidx.constraintlayout.widget.ConstraintLayout cannot be cast to android.widget.TextView
  • Synchronized singleton in Kotlin
  • Product details from barcode
  • What is the difference between armeabi-v7a, arm64-v8a, x86?
  • Where did the "Profile or Debug APK..." option disappear to in Android Studio 3.4.1?
  • App crashes when trying to enter onDataChange Firebase Android
  • Combining WorkContinuation doesn't work as expected
  • Could not get unknown property 'config' for type com.google.gms.googleservices.GoogleServicesPlugin$GoogleServicesPlugin
  • Firebase Storage image upload successful through Android App but how to get url?
  • Xamarin cross platform - Couldn't connect debugger
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com