Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-11-02 18:07:13 +01:00
commit 8b5a37d838
3 changed files with 43 additions and 37 deletions

View file

@ -23,6 +23,7 @@ public class AudioVideoNoteMenuController extends MenuController {
private Recording recording; private Recording recording;
private DateFormat dateFormat; private DateFormat dateFormat;
private DateFormat timeFormat;
private AudioVideoNotesPlugin plugin; private AudioVideoNotesPlugin plugin;
public AudioVideoNoteMenuController(OsmandApplication app, MapActivity mapActivity, final Recording recording) { public AudioVideoNoteMenuController(OsmandApplication app, MapActivity mapActivity, final Recording recording) {
@ -30,6 +31,7 @@ public class AudioVideoNoteMenuController extends MenuController {
this.recording = recording; this.recording = recording;
plugin = OsmandPlugin.getPlugin(AudioVideoNotesPlugin.class); plugin = OsmandPlugin.getPlugin(AudioVideoNotesPlugin.class);
dateFormat = android.text.format.DateFormat.getMediumDateFormat(mapActivity); dateFormat = android.text.format.DateFormat.getMediumDateFormat(mapActivity);
timeFormat = android.text.format.DateFormat.getTimeFormat(mapActivity);
if (!recording.isPhoto()) { if (!recording.isPhoto()) {
titleButtonController = new TitleButtonController() { titleButtonController = new TitleButtonController() {
@ -71,7 +73,7 @@ public class AudioVideoNoteMenuController extends MenuController {
String recName = recording.getName(getMapActivity()); String recName = recording.getName(getMapActivity());
if (file != null && recType.equals(recName)) { if (file != null && recType.equals(recName)) {
Date date = new Date(recording.getFile().lastModified()); Date date = new Date(recording.getFile().lastModified());
return dateFormat.format(date); return dateFormat.format(date) + " " + timeFormat.format(date);
} else { } else {
return recording.getName(getMapActivity()); return recording.getName(getMapActivity());
} }

View file

@ -123,19 +123,19 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
} }
private static int ZOOM_TO_SHOW_BORDERS_ST = 5; private static int ZOOM_TO_SHOW_BORDERS_ST = 5;
private static int ZOOM_TO_SHOW_BORDERS = 7; 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 @Override
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) { public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
final int zoom = tileBox.getZoom(); final int zoom = tileBox.getZoom();
if(zoom < ZOOM_TO_SHOW_BORDERS_ST) { if(zoom < ZOOM_TO_SHOW_SELECTION_ST) {
return; return;
} }
// draw objects // draw objects
final List<BinaryMapDataObject> currentObjects = data.results; final List<BinaryMapDataObject> currentObjects = data.results;
final List<BinaryMapDataObject> selectedObjects = this.selectedObjects;
if (zoom >= ZOOM_TO_SHOW_BORDERS_ST && zoom < ZOOM_TO_SHOW_BORDERS && osmandRegions.isInitialized() && if (zoom >= ZOOM_TO_SHOW_BORDERS_ST && zoom < ZOOM_TO_SHOW_BORDERS && osmandRegions.isInitialized() &&
(currentObjects != null || selectedObjects != null)) { currentObjects != null) {
if (currentObjects != null) {
path.reset(); path.reset();
for (BinaryMapDataObject o : currentObjects) { for (BinaryMapDataObject o : currentObjects) {
String downloadName = osmandRegions.getDownloadName(o); String downloadName = osmandRegions.getDownloadName(o);
@ -154,7 +154,10 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
} }
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
} }
if (selectedObjects != null) {
final List<BinaryMapDataObject> selectedObjects = this.selectedObjects;
if (zoom >= ZOOM_TO_SHOW_SELECTION_ST && zoom < ZOOM_TO_SHOW_SELECTION && osmandRegions.isInitialized() &&
selectedObjects != null) {
pathSelected.reset(); pathSelected.reset();
for (BinaryMapDataObject o : selectedObjects) { for (BinaryMapDataObject o : selectedObjects) {
double lat = MapUtils.get31LatitudeY(o.getPoint31YTile(0)); double lat = MapUtils.get31LatitudeY(o.getPoint31YTile(0));
@ -169,7 +172,6 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
canvas.drawPath(pathSelected, paintSelected); canvas.drawPath(pathSelected, paintSelected);
} }
} }
}
@ -370,7 +372,7 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
private void getWorldRegionFromPoint(RotatedTileBox tb, PointF point, List<? super BinaryMapDataObject> dataObjects) { private void getWorldRegionFromPoint(RotatedTileBox tb, PointF point, List<? super BinaryMapDataObject> dataObjects) {
int zoom = tb.getZoom(); 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); LatLon pointLatLon = tb.getLatLonFromPixel(point.x, point.y);
int point31x = MapUtils.get31TileNumberX(pointLatLon.getLongitude()); int point31x = MapUtils.get31TileNumberX(pointLatLon.getLongitude());
int point31y = MapUtils.get31TileNumberY(pointLatLon.getLatitude()); int point31y = MapUtils.get31TileNumberY(pointLatLon.getLatitude());

View file

@ -188,8 +188,10 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.
@Override @Override
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> res) { public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> res) {
if (this.settings.SHOW_FAVORITES.get()) {
getFavoriteFromPoint(tileBox, point, res); getFavoriteFromPoint(tileBox, point, res);
} }
}
@Override @Override
public LatLon getObjectLocation(Object o) { public LatLon getObjectLocation(Object o) {