diff --git a/OsmAnd/res/drawable-hdpi/map_magnifier.png b/OsmAnd/res/drawable-hdpi/map_magnifier.png
new file mode 100644
index 0000000000..9b509ad036
Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/map_magnifier.png differ
diff --git a/OsmAnd/res/drawable-large/map_magnifier.png b/OsmAnd/res/drawable-large/map_magnifier.png
new file mode 100644
index 0000000000..9b509ad036
Binary files /dev/null and b/OsmAnd/res/drawable-large/map_magnifier.png differ
diff --git a/OsmAnd/res/drawable-mdpi/map_magnifier.png b/OsmAnd/res/drawable-mdpi/map_magnifier.png
new file mode 100644
index 0000000000..940b41159d
Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/map_magnifier.png differ
diff --git a/OsmAnd/res/drawable-xhdpi/map_magnifier.png b/OsmAnd/res/drawable-xhdpi/map_magnifier.png
new file mode 100644
index 0000000000..8ef6a3567a
Binary files /dev/null and b/OsmAnd/res/drawable-xhdpi/map_magnifier.png differ
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 4621a890ff..199da8c1f1 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -9,6 +9,8 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
+ and
+ or
The route is possibly too long to be calculated by the OsmAnd offline router.
On average offline routing is possible between points up to 200km apart. Please add one or more intermediate waypoints to calculate the route.
No auto zoom
diff --git a/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java b/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java
index 8155bdd72b..e5af70da4b 100644
--- a/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java
+++ b/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java
@@ -186,9 +186,9 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
lastTimeAutoZooming = now;
float settingsZoomScale = mapView.getSettingsZoomScale();
float complexZoom = tb.getZoom() + tb.getZoomScale() + zdelta;
- // round to 0.5
- float newZoom = Math.round((complexZoom - settingsZoomScale) * 2) * 0.5f;
- int nz = (int)newZoom;
+ // round to 0.33
+ float newZoom = Math.round((complexZoom - settingsZoomScale) * 3) / 3f;
+ int nz = (int)Math.round(newZoom);
float nzscale = newZoom - nz + settingsZoomScale;
mapView.setComplexZoom(nz, nzscale);
// mapView.getAnimatedDraggingThread().startZooming(mapView.getFloatZoom() + zdelta, false);
diff --git a/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java b/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java
index 844e903133..b86cade006 100644
--- a/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java
@@ -133,9 +133,11 @@ public class DownloadedRegionsLayer extends OsmandMapLayer {
currentObjects != null) {
path.reset();
for (BinaryMapDataObject o : currentObjects) {
- final String key = Algorithms.capitalizeFirstLetterAndLowercase(osmandRegions.getDownloadName(o))
+ final String regionName = Algorithms.capitalizeFirstLetterAndLowercase(osmandRegions.getDownloadName(o))
+ IndexConstants.BINARY_MAP_INDEX_EXT;
- if (!rm.getIndexFileNames().containsKey(key)) {
+ final String roadsRegionName = Algorithms.capitalizeFirstLetterAndLowercase(osmandRegions.getDownloadName(o)) + "-roads"
+ + IndexConstants.BINARY_MAP_INDEX_EXT;
+ if (!rm.getIndexFileNames().containsKey(regionName) && !rm.getIndexFileNames().containsKey(roadsRegionName)) {
continue;
}
@@ -220,7 +222,7 @@ public class DownloadedRegionsLayer extends OsmandMapLayer {
continue;
}
if (set.size() > 1) {
- s.append(" & ");
+ s.append(" ").append(view.getResources().getString(R.string.default_or)).append(" ");
filter.append(", ");
} else {
s.append(" ");
diff --git a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java
index dc16b17034..b33caa8067 100644
--- a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java
@@ -17,8 +17,11 @@ import net.osmand.plus.activities.MapActivity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
+import android.graphics.Paint;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@@ -39,9 +42,7 @@ import android.widget.SeekBar;
public class MapControlsLayer extends OsmandMapLayer {
private static final int SHOW_ZOOM_LEVEL_MSG_ID = 3;
- private static final int SHOW_ZOOM_LEVEL_DELAY = 2000;
- private static final float ZOOM_DELTA = 1;
-// private static final float ZOOM_DELTA = OsmandMapTileView.ZOOM_DELTA_1;
+ private static final int SHOW_ZOOM_LEVEL_DELAY = 4000;
private OsmandMapTileView view;
@@ -57,6 +58,8 @@ public class MapControlsLayer extends OsmandMapLayer {
private TextPaint zoomTextPaint;
private Drawable zoomShadow;
+ private Bitmap mapMagnifier;
+ private Paint bitmapPaint;
private Button backToMenuButton;
private Drawable modeShadow;
@@ -134,8 +137,9 @@ public class MapControlsLayer extends OsmandMapLayer {
zoomTextPaint.setColor(sh == Color.WHITE ? Color.BLACK : 0xffC8C8C8);
rulerTextPaint.setColor(sh == Color.WHITE ? Color.BLACK : 0xffC8C8C8);
}
- if (showZoomLevel || !view.getSettings().SHOW_RULER.get()) {
- drawZoomLevel(canvas ,tileBox);
+ boolean drawZoomLevel = showZoomLevel || !view.getSettings().SHOW_RULER.get();
+ if (drawZoomLevel) {
+ drawZoomLevel(canvas, tileBox, view.isZooming());
} else {
drawRuler(canvas, tileBox);
}
@@ -200,33 +204,36 @@ public class MapControlsLayer extends OsmandMapLayer {
mQuickAction.show();
}
-
- private void drawZoomLevel(Canvas canvas, RotatedTileBox tb) {
- String zoomText = tb.getZoom() + "";
- float frac = tb.getZoomScale();
- if (frac != 0) {
- if (frac > 0) {
- zoomText += "+";
- } else {
- zoomText += "-";
- }
- int ifrac = ((int) Math.abs(frac));
- if (frac >= 1) {
- zoomText += ifrac;
- }
- if (frac != ifrac) {
- zoomText += "." + ((int) ((Math.abs(frac) - ifrac) * 10f));
- }
- }
- float length = zoomTextPaint.measureText(zoomText);
+
+ private void drawZoomLevel(Canvas canvas, RotatedTileBox tb, boolean drawZoomLevel) {
if (zoomShadow.getBounds().width() == 0) {
- zoomShadow.setBounds(zoomInButton.getLeft() - 2, zoomInButton.getTop() - (int) (18 * scaleCoefficient), zoomInButton.getRight(),
- zoomInButton.getBottom());
+ zoomShadow.setBounds(zoomInButton.getLeft() - 2, zoomInButton.getTop() - (int) (18 * scaleCoefficient),
+ zoomInButton.getRight(), zoomInButton.getBottom());
}
zoomShadow.draw(canvas);
-
- ShadowText.draw(zoomText, canvas, zoomInButton.getLeft() + (zoomInButton.getWidth() - length - 2) / 2,
- zoomInButton.getTop() + 4 * scaleCoefficient, zoomTextPaint, shadowColor);
+ if (drawZoomLevel) {
+ String zoomText = tb.getZoom() + "";
+ float frac = tb.getZoomScale();
+ if (frac != 0) {
+ int ifrac = (int) (frac * 10);
+ boolean pos = ifrac > 0;
+ zoomText += (pos ? "+" : "-");
+ zoomText += Math.abs(ifrac) / 10;
+ if (ifrac % 10 != 0) {
+ zoomText += "." + Math.abs(ifrac) % 10;
+ }
+ }
+ float length = zoomTextPaint.measureText(zoomText);
+
+ ShadowText.draw(zoomText, canvas, zoomInButton.getLeft() + (zoomInButton.getWidth() - length - 2) / 2,
+ zoomInButton.getTop() + 4 * scaleCoefficient, zoomTextPaint, shadowColor);
+ } else {
+ int size = (int) (16 * scaleCoefficient);
+ int top = (int) (zoomInButton.getTop() - size - 4 * scaleCoefficient);
+ int left = (int) (zoomInButton.getLeft() + (zoomInButton.getWidth() - mapMagnifier.getWidth() - 2 * scaleCoefficient) / 2);
+ // canvas density /2 ? size * 2
+ canvas.drawBitmap(mapMagnifier, null, new Rect(left, top, left + size * 2, top + size * 2), bitmapPaint);
+ }
}
private void hideZoomLevelInTime(){
@@ -251,6 +258,10 @@ public class MapControlsLayer extends OsmandMapLayer {
onApplicationModePress();
return true;
}
+ if (showZoomLevel && zoomShadow.getBounds().contains((int) point.x, (int) point.y)) {
+ getOnClickMagnifierListener(view).onLongClick(null);
+ return true;
+ }
return false;
}
@@ -307,7 +318,10 @@ public class MapControlsLayer extends OsmandMapLayer {
zoomTextPaint.setAntiAlias(true);
zoomTextPaint.setFakeBoldText(true);
- zoomShadow = view.getResources().getDrawable(R.drawable.zoom_background);
+ zoomShadow = view.getResources().getDrawable(R.drawable.zoom_background).mutate();
+ mapMagnifier = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_magnifier);
+ bitmapPaint = new Paint();
+
zoomInButton = new Button(ctx);
zoomInButton.setBackgroundResource(R.drawable.map_zoom_in);
@@ -341,11 +355,24 @@ public class MapControlsLayer extends OsmandMapLayer {
}
});
- final OsmandSettings.OsmandPreference zoomScale = view.getSettings().MAP_ZOOM_SCALE_BY_DENSITY;
+ final View.OnLongClickListener listener = getOnClickMagnifierListener(view);
+ zoomInButton.setOnLongClickListener(listener);
+ zoomOutButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ activity.changeZoom(- 1);
+ }
+ });
+ zoomOutButton.setOnLongClickListener(listener);
+ }
+
+
+ private static View.OnLongClickListener getOnClickMagnifierListener(final OsmandMapTileView view) {
final View.OnLongClickListener listener = new View.OnLongClickListener() {
@Override
- public boolean onLongClick(View v) {
+ public boolean onLongClick(View notUseCouldBeNull) {
+ final OsmandSettings.OsmandPreference zoomScale = view.getSettings().MAP_ZOOM_SCALE_BY_DENSITY;
final AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext());
float scale = view.getZoomScale();
int p = (int) ((scale > 0 ? 1 : -1) * Math.round(scale * scale * 100)) + 100;
@@ -393,14 +420,7 @@ public class MapControlsLayer extends OsmandMapLayer {
return true;
}
};
- zoomInButton.setOnLongClickListener(listener);
- zoomOutButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- activity.changeZoom(- 1);
- }
- });
- zoomOutButton.setOnLongClickListener(listener);
+ return listener;
}
@@ -498,8 +518,9 @@ public class MapControlsLayer extends OsmandMapLayer {
cacheRulerTextLen = zoomTextPaint.measureText(cacheRulerText.getText());
Rect bounds = rulerDrawable.getBounds();
+ Drawable buttonDrawable = view.getResources().getDrawable(R.drawable.map_zoom_in);
bounds.right = (int) (view.getWidth() - 7 * scaleCoefficient);
- bounds.bottom = (int) (view.getHeight() - view.getResources().getDrawable(R.drawable.map_zoom_in).getMinimumHeight());
+ bounds.bottom = (int) (view.getHeight() - buttonDrawable.getMinimumHeight());
bounds.top = bounds.bottom - rulerDrawable.getMinimumHeight();
bounds.left = bounds.right - cacheRulerDistPix;
rulerDrawable.setBounds(bounds);