Back to project page SmartNavi.
The source code is released under:
Apache License
If you think the Android project SmartNavi listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.ilm.sandwich; /*from w ww . j a v a 2 s. c o m*/ import android.content.Context; import android.os.SystemClock; import android.view.MotionEvent; import android.widget.FrameLayout; public class TouchableWrapper extends FrameLayout { private long lastTouched = 0; private static final long SCROLL_TIME = 100L; // 200 Milliseconds, but you can adjust that to your liking private UpdateMapAfterUserInterection updateMapAfterUserInterection; public TouchableWrapper(Context context) { super(context); // Force the host activity to implement the UpdateMapAfterUserInterection Interface try { updateMapAfterUserInterection = (GoogleMapActivity) context; } catch (ClassCastException e) { throw new ClassCastException(context.toString() + " must implement UpdateMapAfterUserInterection"); } } @Override public boolean dispatchTouchEvent(MotionEvent ev) { switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: lastTouched = SystemClock.uptimeMillis(); break; case MotionEvent.ACTION_UP: final long now = SystemClock.uptimeMillis(); if (now - lastTouched > SCROLL_TIME) { // Update the map updateMapAfterUserInterection.onUpdateMapAfterUserInterection(); } break; } return super.dispatchTouchEvent(ev); } // Map Activity must implement this interface public interface UpdateMapAfterUserInterection { public void onUpdateMapAfterUserInterection(); } }