fix small issues

git-svn-id: https://osmand.googlecode.com/svn/trunk@292 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-07-06 20:27:56 +00:00
parent c3d46c18a6
commit b235d9a4ee
3 changed files with 52 additions and 16 deletions

View file

@ -39,15 +39,8 @@ public class ToDoConstants {
// FIXME BUGS Android // FIXME BUGS Android
// double tap to zoom [done] // 1. Fix bugs with test data (bug with follow turn / left time / add turn)
// forbid rotate map to landscape [ done] // 2. Improvement : Show stops in the transport route
// 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
// TODO swing // TODO swing
// 9. Fix issues with big files (such as netherlands) - save memory (!) - very slow due to transport index ! // 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) // 33. Build transport locations. Create transport index (transport-stops) (investigate)
// Not implemented : show key/transit stops on map, follow mode (show next stop) // 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 // 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 // DONE SWING

View file

@ -31,6 +31,8 @@ import android.location.LocationManager;
import android.location.LocationProvider; import android.location.LocationProvider;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.PowerManager; import android.os.PowerManager;
import android.os.PowerManager.WakeLock; import android.os.PowerManager.WakeLock;
import android.util.FloatMath; import android.util.FloatMath;
@ -112,6 +114,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
private MenuItem navigateToPointMenu; private MenuItem navigateToPointMenu;
private NotificationManager mNotificationManager; private NotificationManager mNotificationManager;
private Handler mapPositionHandler = null;
private int APP_NOTIFICATION_ID; private int APP_NOTIFICATION_ID;
@ -146,6 +149,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
mapView.setTrackBallDelegate(new OsmandMapTileView.OnTrackBallListener(){ mapView.setTrackBallDelegate(new OsmandMapTileView.OnTrackBallListener(){
@Override @Override
public boolean onTrackBallEvent(MotionEvent e) { public boolean onTrackBallEvent(MotionEvent e) {
showAndHideMapPosition();
return MapActivity.this.onTrackballEvent(e); return MapActivity.this.onTrackballEvent(e);
} }
@ -221,6 +225,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
@Override @Override
public void onClick(View v) { public void onClick(View v) {
mapView.setZoom(mapView.getZoom() + 1); mapView.setZoom(mapView.getZoom() + 1);
showAndHideMapPosition();
// user can preview map manually switch off auto zoom while user don't press back to location // user can preview map manually switch off auto zoom while user don't press back to location
if(OsmandSettings.isAutoZoomEnabled(MapActivity.this)){ if(OsmandSettings.isAutoZoomEnabled(MapActivity.this)){
locationChanged(mapView.getLatitude(), mapView.getLongitude(), null); locationChanged(mapView.getLatitude(), mapView.getLongitude(), null);
@ -231,6 +236,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
@Override @Override
public void onClick(View v) { public void onClick(View v) {
mapView.setZoom(mapView.getZoom() - 1); mapView.setZoom(mapView.getZoom() - 1);
showAndHideMapPosition();
// user can preview map manually switch off auto zoom while user don't press back to location // user can preview map manually switch off auto zoom while user don't press back to location
if(OsmandSettings.isAutoZoomEnabled(MapActivity.this)){ if(OsmandSettings.isAutoZoomEnabled(MapActivity.this)){
locationChanged(mapView.getLatitude(), mapView.getLongitude(), null); 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 = powerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "com.osmand.map"); //$NON-NLS-1$
wakeLock.acquire(); 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 @Override
public void onLowMemory() { public void onLowMemory() {

View file

@ -13,7 +13,6 @@ import android.graphics.Bitmap;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.PointF; import android.graphics.PointF;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.RectF; import android.graphics.RectF;
@ -76,6 +75,8 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
private int mapPosition; private int mapPosition;
private boolean showMapPosition = true;
// name of source map // name of source map
private ITileSource map = null; private ITileSource map = null;
@ -99,7 +100,7 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
Paint paintGrayFill; Paint paintGrayFill;
Paint paintWhiteFill; Paint paintWhiteFill;
Paint paintBlack; Paint paintCenter;
Paint paintBitmap; Paint paintBitmap;
@ -127,9 +128,11 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
// when map rotate // when map rotate
paintWhiteFill.setAntiAlias(true); paintWhiteFill.setAntiAlias(true);
paintBlack = new Paint(); paintCenter = new Paint();
paintBlack.setStyle(Style.STROKE); paintCenter.setStyle(Style.STROKE);
paintBlack.setColor(Color.BLACK); paintCenter.setColor(Color.rgb(60, 60, 60));
paintCenter.setStrokeWidth(2);
paintCenter.setAntiAlias(true);
paintBitmap = new Paint(); paintBitmap = new Paint();
paintBitmap.setFilterBitmap(true); 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() { public float getRotate() {
return rotate; return rotate;
} }
@ -305,8 +317,10 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
private void drawOverMap(Canvas canvas){ private void drawOverMap(Canvas canvas){
int w = getCenterPointX(); int w = getCenterPointX();
int h = getCenterPointY(); int h = getCenterPointY();
canvas.drawCircle(w, h, 3, paintBlack); if (showMapPosition) {
canvas.drawCircle(w, h, 6, paintBlack); canvas.drawCircle(w, h, 3, paintCenter);
canvas.drawCircle(w, h, 7, paintCenter);
}
for (OsmandMapLayer layer : layers) { for (OsmandMapLayer layer : layers) {
canvas.restore(); canvas.restore();