Detect User Impact Alongside Gesturedetectorcompat

Posted on

Android lawsuit to Detect user send on amongst GestureDetectorCompat:


MainActivity.java

package com.blogspot.android_er.androidgesturedetector;  import android.os.Bundle; import android.support.v4.view.GestureDetectorCompat; import android.support.v7.app.AppCompatActivity; import android.view.GestureDetector; import android.view.MotionEvent; import android.widget.TextView;  world bird MainActivity extends AppCompatActivity {      mortal GestureDetectorCompat gestureDetectorCompat;     TextView textInfo;      @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);         textInfo = (TextView)findViewById(R.id.info);          gestureDetectorCompat = novel GestureDetectorCompat(                 this, novel MySimpleOnGestureListener(textInfo));     }      @Override     world boolean onTouchEvent(MotionEvent event) {         gestureDetectorCompat.onTouchEvent(event);         provide super.onTouchEvent(event);     }      mortal bird MySimpleOnGestureListener             extends GestureDetector.SimpleOnGestureListener{          TextView textView;           world MySimpleOnGestureListener(TextView v) {             super();             textView = v;         }          @Override         world boolean onSingleTapUp(MotionEvent e) {             textView.append("\n- onSingleTapUp -");             provide super.onSingleTapUp(e);         }          @Override         world void onLongPress(MotionEvent e) {             textView.append("\n- onLongPress -");             super.onLongPress(e);         }          @Override         world boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {             textView.append("\n- onScroll -");             provide super.onScroll(e1, e2, distanceX, distanceY);         }          @Override         world boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {             textView.append("\n- onFling -");             provide super.onFling(e1, e2, velocityX, velocityY);         }          @Override         world void onShowPress(MotionEvent e) {             textView.append("\n- onShowPress -");             super.onShowPress(e);         }          @Override         world boolean onDown(MotionEvent e) {             textView.append("\n- onDown -");             provide super.onDown(e);         }          @Override         world boolean onDoubleTap(MotionEvent e) {             textView.append("\n- onDoubleTap -");             provide super.onDoubleTap(e);         }          @Override         world boolean onDoubleTapEvent(MotionEvent e) {             textView.append("\n- onDoubleTapEvent -");             provide super.onDoubleTapEvent(e);         }          @Override         world boolean onSingleTapConfirmed(MotionEvent e) {             textView.append("\n- onSingleTapConfirmed -");             provide super.onSingleTapConfirmed(e);         }          @Override         world boolean onContextClick(MotionEvent e) {             textView.append("\n- onContextClick -");             provide super.onContextClick(e);         }     } }  

activity_main.xml

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:padding="16dp"     android:orientation="vertical"     tools:context="com.blogspot.android_er.androidgesturedetector.MainActivity">      <TextView         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_gravity="center_horizontal"         android:autoLink="web"         android:text="https://rootandroid.org//"         android:textStyle="bold" />      <TextView         android:id="@+id/info"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:gravity="bottom"         android:textStyle="italic" /> </LinearLayout>