From 920645ce830185bff680b34e6505325506ad5930 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Mon, 2 Nov 2015 20:06:50 +0300 Subject: [PATCH] Fixes --- .../AudioVideoNoteMenuController.java | 4 +- .../plus/views/DownloadedRegionsLayer.java | 72 ++++++++++--------- .../net/osmand/plus/views/FavoritesLayer.java | 4 +- 3 files changed, 43 insertions(+), 37 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AudioVideoNoteMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AudioVideoNoteMenuController.java index 3c3eb5c469..4f210337dd 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AudioVideoNoteMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AudioVideoNoteMenuController.java @@ -23,6 +23,7 @@ public class AudioVideoNoteMenuController extends MenuController { private Recording recording; private DateFormat dateFormat; + private DateFormat timeFormat; private AudioVideoNotesPlugin plugin; public AudioVideoNoteMenuController(OsmandApplication app, MapActivity mapActivity, final Recording recording) { @@ -30,6 +31,7 @@ public class AudioVideoNoteMenuController extends MenuController { this.recording = recording; plugin = OsmandPlugin.getPlugin(AudioVideoNotesPlugin.class); dateFormat = android.text.format.DateFormat.getMediumDateFormat(mapActivity); + timeFormat = android.text.format.DateFormat.getTimeFormat(mapActivity); if (!recording.isPhoto()) { titleButtonController = new TitleButtonController() { @@ -71,7 +73,7 @@ public class AudioVideoNoteMenuController extends MenuController { String recName = recording.getName(getMapActivity()); if (file != null && recType.equals(recName)) { Date date = new Date(recording.getFile().lastModified()); - return dateFormat.format(date); + return dateFormat.format(date) + " " + timeFormat.format(date); } else { return recording.getName(getMapActivity()); } diff --git a/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java b/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java index 1a63fd3269..019ab25465 100644 --- a/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java @@ -123,51 +123,53 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe } private static int ZOOM_TO_SHOW_BORDERS_ST = 5; private static int ZOOM_TO_SHOW_BORDERS = 7; - + private static int ZOOM_TO_SHOW_SELECTION_ST = 3; + private static int ZOOM_TO_SHOW_SELECTION = 10; + @Override public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) { final int zoom = tileBox.getZoom(); - if(zoom < ZOOM_TO_SHOW_BORDERS_ST) { + if(zoom < ZOOM_TO_SHOW_SELECTION_ST) { return; } // draw objects final List currentObjects = data.results; - final List selectedObjects = this.selectedObjects; if (zoom >= ZOOM_TO_SHOW_BORDERS_ST && zoom < ZOOM_TO_SHOW_BORDERS && osmandRegions.isInitialized() && - (currentObjects != null || selectedObjects != null)) { - if (currentObjects != null) { - path.reset(); - for (BinaryMapDataObject o : currentObjects) { - String downloadName = osmandRegions.getDownloadName(o); - boolean downloaded = checkIfObjectDownloaded(downloadName); - if (!downloaded) { - continue; - } - double lat = MapUtils.get31LatitudeY(o.getPoint31YTile(0)); - double lon = MapUtils.get31LongitudeX(o.getPoint31XTile(0)); - path.moveTo(tileBox.getPixXFromLonNoRot(lon), tileBox.getPixYFromLatNoRot(lat)); - for (int j = 1; j < o.getPointsLength(); j++) { - lat = MapUtils.get31LatitudeY(o.getPoint31YTile(j)); - lon = MapUtils.get31LongitudeX(o.getPoint31XTile(j)); - path.lineTo(tileBox.getPixXFromLonNoRot(lon), tileBox.getPixYFromLatNoRot(lat)); - } + currentObjects != null) { + path.reset(); + for (BinaryMapDataObject o : currentObjects) { + String downloadName = osmandRegions.getDownloadName(o); + boolean downloaded = checkIfObjectDownloaded(downloadName); + if (!downloaded) { + continue; } - canvas.drawPath(path, paint); - } - if (selectedObjects != null) { - pathSelected.reset(); - for (BinaryMapDataObject o : selectedObjects) { - double lat = MapUtils.get31LatitudeY(o.getPoint31YTile(0)); - double lon = MapUtils.get31LongitudeX(o.getPoint31XTile(0)); - pathSelected.moveTo(tileBox.getPixXFromLonNoRot(lon), tileBox.getPixYFromLatNoRot(lat)); - for (int j = 1; j < o.getPointsLength(); j++) { - lat = MapUtils.get31LatitudeY(o.getPoint31YTile(j)); - lon = MapUtils.get31LongitudeX(o.getPoint31XTile(j)); - pathSelected.lineTo(tileBox.getPixXFromLonNoRot(lon), tileBox.getPixYFromLatNoRot(lat)); - } + double lat = MapUtils.get31LatitudeY(o.getPoint31YTile(0)); + double lon = MapUtils.get31LongitudeX(o.getPoint31XTile(0)); + path.moveTo(tileBox.getPixXFromLonNoRot(lon), tileBox.getPixYFromLatNoRot(lat)); + for (int j = 1; j < o.getPointsLength(); j++) { + lat = MapUtils.get31LatitudeY(o.getPoint31YTile(j)); + lon = MapUtils.get31LongitudeX(o.getPoint31XTile(j)); + path.lineTo(tileBox.getPixXFromLonNoRot(lon), tileBox.getPixYFromLatNoRot(lat)); } - canvas.drawPath(pathSelected, paintSelected); } + canvas.drawPath(path, paint); + } + + final List selectedObjects = this.selectedObjects; + if (zoom >= ZOOM_TO_SHOW_SELECTION_ST && zoom < ZOOM_TO_SHOW_SELECTION && osmandRegions.isInitialized() && + selectedObjects != null) { + pathSelected.reset(); + for (BinaryMapDataObject o : selectedObjects) { + double lat = MapUtils.get31LatitudeY(o.getPoint31YTile(0)); + double lon = MapUtils.get31LongitudeX(o.getPoint31XTile(0)); + pathSelected.moveTo(tileBox.getPixXFromLonNoRot(lon), tileBox.getPixYFromLatNoRot(lat)); + for (int j = 1; j < o.getPointsLength(); j++) { + lat = MapUtils.get31LatitudeY(o.getPoint31YTile(j)); + lon = MapUtils.get31LongitudeX(o.getPoint31XTile(j)); + pathSelected.lineTo(tileBox.getPixXFromLonNoRot(lon), tileBox.getPixYFromLatNoRot(lat)); + } + } + canvas.drawPath(pathSelected, paintSelected); } } @@ -370,7 +372,7 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe private void getWorldRegionFromPoint(RotatedTileBox tb, PointF point, List dataObjects) { int zoom = tb.getZoom(); - if (zoom >= ZOOM_TO_SHOW_BORDERS_ST && zoom < ZOOM_TO_SHOW_BORDERS && osmandRegions.isInitialized()) { + if (zoom >= ZOOM_TO_SHOW_SELECTION_ST && zoom < ZOOM_TO_SHOW_SELECTION && osmandRegions.isInitialized()) { LatLon pointLatLon = tb.getLatLonFromPixel(point.x, point.y); int point31x = MapUtils.get31TileNumberX(pointLatLon.getLongitude()); int point31y = MapUtils.get31TileNumberY(pointLatLon.getLatitude()); diff --git a/OsmAnd/src/net/osmand/plus/views/FavoritesLayer.java b/OsmAnd/src/net/osmand/plus/views/FavoritesLayer.java index 0d8c8361c2..4166f083ca 100644 --- a/OsmAnd/src/net/osmand/plus/views/FavoritesLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/FavoritesLayer.java @@ -188,7 +188,9 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer. @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res) { - getFavoriteFromPoint(tileBox, point, res); + if (this.settings.SHOW_FAVORITES.get()) { + getFavoriteFromPoint(tileBox, point, res); + } } @Override