[Core sample] added long tap

This commit is contained in:
Alexey Kulish 2016-06-30 18:30:21 +03:00
parent 830e2e7669
commit 45d394aa77

View file

@ -24,6 +24,7 @@ import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import net.osmand.CollatorStringMatcher; import net.osmand.CollatorStringMatcher;
import net.osmand.core.android.AtlasMapRendererView; import net.osmand.core.android.AtlasMapRendererView;
@ -644,6 +645,16 @@ public class MainActivity extends Activity {
return true; return true;
} }
@Override
public void onLongPress(MotionEvent e) {
PointI point = new PointI();
mapView.getLocationFromScreenPoint(new PointI((int) e.getX(), (int) e.getY()), point);
LatLon latLon = Utilities.convert31ToLatLon(point);
Toast.makeText(MainActivity.this,
"Hello, this is long tap from\n" +
"lat=" + latLon.getLatitude() + " lon=" + latLon.getLongitude(), Toast.LENGTH_SHORT).show();
}
@Override @Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
float fromX = e2.getX() + distanceX; float fromX = e2.getX() + distanceX;