diff --git a/DataExtractionOSM/src/com/osmand/ToDoConstants.java b/DataExtractionOSM/src/com/osmand/ToDoConstants.java index 10492dea81..703f334542 100644 --- a/DataExtractionOSM/src/com/osmand/ToDoConstants.java +++ b/DataExtractionOSM/src/com/osmand/ToDoConstants.java @@ -39,15 +39,8 @@ public class ToDoConstants { // FIXME BUGS Android - // double tap to zoom [done] - // forbid rotate map to landscape [ done] - // REFACTOR Settings activity ( for check box properties!) [partially done] - // show POI choose near by or last map selection [done] - // Show poi direction (using sensor) [done] - - // hide center point (enable only when trackball using) [hide with delay 500 ms]? - // Fix bugs with test data (bug with follow turn / left time / add turn) - // Improvement : Show stops in the transport route + // 1. Fix bugs with test data (bug with follow turn / left time / add turn) + // 2. Improvement : Show stops in the transport route // TODO swing // 9. Fix issues with big files (such as netherlands) - save memory (!) - very slow due to transport index ! @@ -62,6 +55,7 @@ public class ToDoConstants { // 33. Build transport locations. Create transport index (transport-stops) (investigate) // Not implemented : show key/transit stops on map, follow mode (show next stop) // 50. Invent opening hours editor in order to edit POI hours better on device + // 67. Improve POI search show direction where to go in search & introduce option show near you // DONE SWING diff --git a/OsmAnd/src/com/osmand/activities/MapActivity.java b/OsmAnd/src/com/osmand/activities/MapActivity.java index 43dbb8b2c8..621090c026 100644 --- a/OsmAnd/src/com/osmand/activities/MapActivity.java +++ b/OsmAnd/src/com/osmand/activities/MapActivity.java @@ -31,6 +31,8 @@ import android.location.LocationManager; import android.location.LocationProvider; import android.os.Build; import android.os.Bundle; +import android.os.Handler; +import android.os.Message; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.util.FloatMath; @@ -112,6 +114,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat private MenuItem navigateToPointMenu; private NotificationManager mNotificationManager; + private Handler mapPositionHandler = null; private int APP_NOTIFICATION_ID; @@ -146,6 +149,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat mapView.setTrackBallDelegate(new OsmandMapTileView.OnTrackBallListener(){ @Override public boolean onTrackBallEvent(MotionEvent e) { + showAndHideMapPosition(); return MapActivity.this.onTrackballEvent(e); } @@ -221,6 +225,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat @Override public void onClick(View v) { mapView.setZoom(mapView.getZoom() + 1); + showAndHideMapPosition(); // user can preview map manually switch off auto zoom while user don't press back to location if(OsmandSettings.isAutoZoomEnabled(MapActivity.this)){ locationChanged(mapView.getLatitude(), mapView.getLongitude(), null); @@ -231,6 +236,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat @Override public void onClick(View v) { mapView.setZoom(mapView.getZoom() - 1); + showAndHideMapPosition(); // user can preview map manually switch off auto zoom while user don't press back to location if(OsmandSettings.isAutoZoomEnabled(MapActivity.this)){ locationChanged(mapView.getLatitude(), mapView.getLongitude(), null); @@ -611,9 +617,31 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat wakeLock = powerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "com.osmand.map"); //$NON-NLS-1$ wakeLock.acquire(); } + showAndHideMapPosition(); } + public void showAndHideMapPosition(){ + mapView.setShowMapPosition(true); + if(mapPositionHandler == null){ + mapPositionHandler = new Handler(); + } + Message msg = Message.obtain(mapPositionHandler, new Runnable(){ + @Override + public void run() { + if(mapView.isShowMapPosition()){ + mapView.setShowMapPosition(false); + mapView.refreshMap(); + } + } + + }); + msg.what = 7; + mapPositionHandler.removeMessages(7); + mapPositionHandler.sendMessageDelayed(msg, 3500); + + } + @Override public void onLowMemory() { diff --git a/OsmAnd/src/com/osmand/views/OsmandMapTileView.java b/OsmAnd/src/com/osmand/views/OsmandMapTileView.java index 5e3cbfc511..86f2f5448e 100644 --- a/OsmAnd/src/com/osmand/views/OsmandMapTileView.java +++ b/OsmAnd/src/com/osmand/views/OsmandMapTileView.java @@ -13,7 +13,6 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; -import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; import android.graphics.RectF; @@ -76,6 +75,8 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall private int mapPosition; + private boolean showMapPosition = true; + // name of source map private ITileSource map = null; @@ -99,7 +100,7 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall Paint paintGrayFill; Paint paintWhiteFill; - Paint paintBlack; + Paint paintCenter; Paint paintBitmap; @@ -127,9 +128,11 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall // when map rotate paintWhiteFill.setAntiAlias(true); - paintBlack = new Paint(); - paintBlack.setStyle(Style.STROKE); - paintBlack.setColor(Color.BLACK); + paintCenter = new Paint(); + paintCenter.setStyle(Style.STROKE); + paintCenter.setColor(Color.rgb(60, 60, 60)); + paintCenter.setStrokeWidth(2); + paintCenter.setAntiAlias(true); paintBitmap = new Paint(); paintBitmap.setFilterBitmap(true); @@ -219,6 +222,15 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall } } + + public boolean isShowMapPosition() { + return showMapPosition; + } + + public void setShowMapPosition(boolean showMapPosition) { + this.showMapPosition = showMapPosition; + } + public float getRotate() { return rotate; } @@ -305,8 +317,10 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall private void drawOverMap(Canvas canvas){ int w = getCenterPointX(); int h = getCenterPointY(); - canvas.drawCircle(w, h, 3, paintBlack); - canvas.drawCircle(w, h, 6, paintBlack); + if (showMapPosition) { + canvas.drawCircle(w, h, 3, paintCenter); + canvas.drawCircle(w, h, 7, paintCenter); + } for (OsmandMapLayer layer : layers) { canvas.restore();