Example usage for android.view MotionEvent toString

List of usage examples for android.view MotionEvent toString

Introduction

In this page you can find the example usage for android.view MotionEvent toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:com.esri.arcgisruntime.sample.mobilemapsearchandroute.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    //initialize reverse geocode params
    mReverseGeocodeParameters = new ReverseGeocodeParameters();
    mReverseGeocodeParameters.setMaxResults(1);
    mReverseGeocodeParameters.getResultAttributeNames().add("*");
    //retrieve the MapView from layout
    mMapView = (MapView) findViewById(R.id.mapView);
    //add route and marker overlays to map view
    mMarkerGraphicsOverlay = new GraphicsOverlay();
    mRouteGraphicsOverlay = new GraphicsOverlay();
    mMapView.getGraphicsOverlays().add(mRouteGraphicsOverlay);
    mMapView.getGraphicsOverlays().add(mMarkerGraphicsOverlay);
    // build the file path to access the mobile map package
    String filePathMMPk = buildMMPkPath();
    // add the map from the mobile map package to the MapView
    loadMobileMapPackage(filePathMMPk);/*from ww  w.j a  v a2 s . co  m*/
    mMapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, mMapView) {

        @Override
        public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
            Log.d(TAG, "onSingleTapConfirmed: " + motionEvent.toString());
            // get the point that was clicked and convert it to a point in map coordinates
            android.graphics.Point screenPoint = new android.graphics.Point(Math.round(motionEvent.getX()),
                    Math.round(motionEvent.getY()));
            // create a map point from screen point
            Point mapPoint = mMapView.screenToLocation(screenPoint);
            geoView(screenPoint, mapPoint);
            return true;
        }
    });
}

From source file:com.google.android.gms.location.sample.locationupdates.MainActivity.java

@Override
public boolean onDown(MotionEvent event) {
    Log.d(DEBUG_TAG, "onDown: " + event.toString());
    return true;/*from   w ww.ja v a 2s .com*/
}

From source file:com.google.android.gms.location.sample.locationupdates.MainActivity.java

@Override
public void onShowPress(MotionEvent event) {
    Log.d(DEBUG_TAG, "onShowPress: " + event.toString());
}

From source file:com.google.android.gms.location.sample.locationupdates.MainActivity.java

@Override
public boolean onSingleTapUp(MotionEvent event) {
    Log.d(DEBUG_TAG, "onSingleTapUp: " + event.toString());
    return true;//from   w  w  w.  j  a v  a  2  s . c o m
}

From source file:com.google.android.gms.location.sample.locationupdates.MainActivity.java

@Override
public boolean onDoubleTap(MotionEvent event) {

    Log.d(DEBUG_TAG, "onDoubleTap: " + event.toString());
    return true;/*from ww  w  .  j a v  a 2 s  .c  o m*/
}

From source file:com.google.android.gms.location.sample.locationupdates.MainActivity.java

@Override
public boolean onSingleTapConfirmed(MotionEvent event) {
    Log.d(DEBUG_TAG, "onSingleTapConfirmed: " + event.toString());
    return true;//from   ww w .  ja v  a2 s .  c o  m
}

From source file:com.jackie.refresh.RefreshLayoutBase.java

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    Log.d(TAG, "onInterceptTouchEvent() called with: " + "ev = [" + ev.toString() + "]");
    // ?/*from   w w  w  .  j  av  a2  s . co  m*/
    final int action = MotionEventCompat.getActionMasked(ev);
    if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP) {
        return false;
    }
    switch (action) {
    case MotionEvent.ACTION_DOWN:
        mLastY = (int) ev.getRawY();
        break;

    case MotionEvent.ACTION_MOVE:
        mYOffset = (int) ev.getRawX() - mLastY;
        // ,,,onTouchEvent()??
        if (isTop() && mYOffset > 0) {
            return true;
        }
        break;
    }
    return false;
}

From source file:com.jackie.refresh.RefreshLayoutBase.java

@Override
public boolean onTouchEvent(MotionEvent event) {
    Log.d(TAG, "onTouchEvent() called with: " + "event = [" + event.toString() + "]");
    switch (event.getAction()) {
    case MotionEvent.ACTION_MOVE: // 
        // ??y??/*from w  ww.jav  a 2 s.c  om*/
        int currentY = (int) event.getRawY();
        // ???
        mYOffset = currentY - mLastY;
        if (mCurrentStatus != STATUS_LOADING) {
            // Y?
            changeScrollY(mYOffset);
        }

        // Header View
        rotateHeaderArrow();
        // Header View?
        changeTips();
        // mLastYY??
        mLastY = currentY;
        break;

    case MotionEvent.ACTION_UP:
        if (isTop()) {
            // ?
            doRefresh();
        }

        break;
    default:
        break;
    }
    //        return super.onTouchEvent(event);
    return true;
}

From source file:com.google.android.gms.location.sample.locationupdates.MainActivity.java

@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
    Log.d(DEBUG_TAG, "onScroll: " + e1.toString() + e2.toString());
    return true;//from  www.  j a  va 2  s. c  o  m
}

From source file:com.google.android.gms.location.sample.locationupdates.MainActivity.java

@Override
public boolean onFling(MotionEvent event1, MotionEvent event2, float velocityX, float velocityY) {
    Log.d(DEBUG_TAG, "onFling: " + event1.toString() + event2.toString());

    myVibrator.vibrate(300);/*from  ww  w.j ava  2 s .  c  om*/
    myMainLayout.setBackgroundColor(getResources().getColor(R.color.green));
    setTag = true;
    updateUI();

    Toast.makeText(MainActivity.this, "It's beautifull ! Lets set a tag !", Toast.LENGTH_SHORT).show();
    return true;
}