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
// 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

View file

@ -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() {

View file

@ -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();