private boolean commonOnTap(GeoPoint tappedGeoPoint) { List<Uri> tappedUri = new Vector<Uri>(); Point tappedPoint = new Point(); mProjection.toPixels(tappedGeoPoint, tappedPoint); for (MediaVO media : mMediaPath) { if (media.x < tappedPoint.x && tappedPoint.x < media.x + media.w && media.y < tappedPoint.y && tappedPoint.y < media.y + media.h) { // Log.d( TAG, String.format( "Tapped at a (x,y) (%d,%d)", tappedPoint.x, tappedPoint.y ) ); tappedUri.add(media.uri); } } if (tappedUri.size() > 0) { return handleMediaTapList(tappedUri); } else { if (mTrackColoringMethod == DRAW_DOTS) { DotVO tapped = null; synchronized (mDotPath) // Switch the fresh path with the old Path object { int w = 25; for (DotVO dot : mDotPath) { // Log.d( TAG, "Compare ("+dot.x+","+dot.y+") with tap // ("+tappedPoint.x+","+tappedPoint.y+")" ); if (dot.x - w < tappedPoint.x && tappedPoint.x < dot.x + w && dot.y - w < tappedPoint.y && tappedPoint.y < dot.y + w) { if (tapped == null) { tapped = dot; } else { tapped = dot.distanceTo(tappedPoint) < tapped.distanceTo(tappedPoint) ? dot : tapped; } } } } if (tapped != null) { DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(mLoggerMap.getApplicationContext()); String timetxt = timeFormat.format(new Date(tapped.time)); UnitsI18n units = new UnitsI18n(mLoggerMap, null); double speed = units.conversionFromMetersPerSecond(tapped.speed); String speedtxt = String.format("%.1f %s", speed, units.getSpeedUnit()); String text = mLoggerMap.getString(R.string.time_and_speed, timetxt, speedtxt); Toast toast = Toast.makeText(mLoggerMap, text, Toast.LENGTH_SHORT); toast.show(); } } return false; } }