Fixes
This commit is contained in:
parent
d6019c7e43
commit
920645ce83
3 changed files with 43 additions and 37 deletions
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
|
@ -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_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);
|
boolean downloaded = checkIfObjectDownloaded(downloadName);
|
||||||
boolean downloaded = checkIfObjectDownloaded(downloadName);
|
if (!downloaded) {
|
||||||
if (!downloaded) {
|
continue;
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
canvas.drawPath(path, paint);
|
double lat = MapUtils.get31LatitudeY(o.getPoint31YTile(0));
|
||||||
}
|
double lon = MapUtils.get31LongitudeX(o.getPoint31XTile(0));
|
||||||
if (selectedObjects != null) {
|
path.moveTo(tileBox.getPixXFromLonNoRot(lon), tileBox.getPixYFromLatNoRot(lat));
|
||||||
pathSelected.reset();
|
for (int j = 1; j < o.getPointsLength(); j++) {
|
||||||
for (BinaryMapDataObject o : selectedObjects) {
|
lat = MapUtils.get31LatitudeY(o.getPoint31YTile(j));
|
||||||
double lat = MapUtils.get31LatitudeY(o.getPoint31YTile(0));
|
lon = MapUtils.get31LongitudeX(o.getPoint31XTile(j));
|
||||||
double lon = MapUtils.get31LongitudeX(o.getPoint31XTile(0));
|
path.lineTo(tileBox.getPixXFromLonNoRot(lon), tileBox.getPixYFromLatNoRot(lat));
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
canvas.drawPath(path, paint);
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<BinaryMapDataObject> 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<? 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());
|
||||||
|
|
|
@ -188,7 +188,9 @@ 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) {
|
||||||
getFavoriteFromPoint(tileBox, point, res);
|
if (this.settings.SHOW_FAVORITES.get()) {
|
||||||
|
getFavoriteFromPoint(tileBox, point, res);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue