Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
0deb494c1d
3 changed files with 18 additions and 24 deletions
|
@ -39,8 +39,9 @@ public class GeocodingUtilities {
|
||||||
public static final float THRESHOLD_MULTIPLIER_SKIP_STREETS_AFTER = 4;
|
public static final float THRESHOLD_MULTIPLIER_SKIP_STREETS_AFTER = 4;
|
||||||
public static final float STOP_SEARCHING_STREET_WITH_MULTIPLIER_RADIUS = 100;
|
public static final float STOP_SEARCHING_STREET_WITH_MULTIPLIER_RADIUS = 100;
|
||||||
public static final float STOP_SEARCHING_STREET_WITHOUT_MULTIPLIER_RADIUS = 400;
|
public static final float STOP_SEARCHING_STREET_WITHOUT_MULTIPLIER_RADIUS = 400;
|
||||||
public static final float DISTANCE_STREET_FROM_CLOSEST = 1000;
|
|
||||||
public static final float DISTANCE_STREET_NAME_PROXIMITY_BY_NAME = 15000;
|
public static final float DISTANCE_STREET_NAME_PROXIMITY_BY_NAME = 15000;
|
||||||
|
public static final float DISTANCE_STREET_FROM_CLOSEST_WITH_SAME_NAME = 1000;
|
||||||
|
|
||||||
public static final float THRESHOLD_MULTIPLIER_SKIP_BUILDINGS_AFTER = 1.5f;
|
public static final float THRESHOLD_MULTIPLIER_SKIP_BUILDINGS_AFTER = 1.5f;
|
||||||
public static final float DISTANCE_BULDING_PROXIMITY = 100;
|
public static final float DISTANCE_BULDING_PROXIMITY = 100;
|
||||||
|
@ -277,7 +278,7 @@ public class GeocodingUtilities {
|
||||||
for (GeocodingResult street : streetsList) {
|
for (GeocodingResult street : streetsList) {
|
||||||
if(streetDistance == 0) {
|
if(streetDistance == 0) {
|
||||||
streetDistance = street.getDistance();
|
streetDistance = street.getDistance();
|
||||||
} else if(street.getDistance() > streetDistance + DISTANCE_STREET_FROM_CLOSEST) {
|
} else if(street.getDistance() > streetDistance + DISTANCE_STREET_FROM_CLOSEST_WITH_SAME_NAME) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
street.connectionPoint = road.connectionPoint;
|
street.connectionPoint = road.connectionPoint;
|
||||||
|
|
|
@ -89,15 +89,7 @@ public class CurrentPositionHelper {
|
||||||
protected void justifyResult(List<GeocodingResult> res, final ResultMatcher<GeocodingResult> result) {
|
protected void justifyResult(List<GeocodingResult> res, final ResultMatcher<GeocodingResult> result) {
|
||||||
List<GeocodingResult> complete = new ArrayList<GeocodingUtilities.GeocodingResult>();
|
List<GeocodingResult> complete = new ArrayList<GeocodingUtilities.GeocodingResult>();
|
||||||
double minBuildingDistance = 0;
|
double minBuildingDistance = 0;
|
||||||
double minStreetDistance = 0;
|
|
||||||
for (GeocodingResult r : res) {
|
for (GeocodingResult r : res) {
|
||||||
double streetDistance = r.getDistance();
|
|
||||||
if(minStreetDistance == 0) {
|
|
||||||
minStreetDistance = streetDistance;
|
|
||||||
} else if(streetDistance > GeocodingUtilities.THRESHOLD_MULTIPLIER_SKIP_STREETS_AFTER * minStreetDistance ||
|
|
||||||
streetDistance > minStreetDistance + GeocodingUtilities.DISTANCE_STREET_FROM_CLOSEST) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Collection<RegionAddressRepository> rar = app.getResourceManager().getAddressRepositories();
|
Collection<RegionAddressRepository> rar = app.getResourceManager().getAddressRepositories();
|
||||||
RegionAddressRepository foundRepo = null;
|
RegionAddressRepository foundRepo = null;
|
||||||
for(RegionAddressRepository repo : rar) {
|
for(RegionAddressRepository repo : rar) {
|
||||||
|
|
|
@ -134,7 +134,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
private DataTileManager<Recording> recordings = new DataTileManager<AudioVideoNotesPlugin.Recording>(14);
|
private DataTileManager<Recording> recordings = new DataTileManager<AudioVideoNotesPlugin.Recording>(14);
|
||||||
private Map<String, Recording> recordingByFileName = new LinkedHashMap<>();
|
private Map<String, Recording> recordingByFileName = new LinkedHashMap<>();
|
||||||
private AudioNotesLayer audioNotesLayer;
|
private AudioNotesLayer audioNotesLayer;
|
||||||
private MapActivity activity;
|
private MapActivity mapActivity;
|
||||||
private static File mediaRecFile;
|
private static File mediaRecFile;
|
||||||
private static MediaRecorder mediaRec;
|
private static MediaRecorder mediaRec;
|
||||||
private File lastTakingPhoto;
|
private File lastTakingPhoto;
|
||||||
|
@ -475,7 +475,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerLayers(MapActivity activity) {
|
public void registerLayers(MapActivity activity) {
|
||||||
this.activity = activity;
|
this.mapActivity = activity;
|
||||||
if (audioNotesLayer != null) {
|
if (audioNotesLayer != null) {
|
||||||
activity.getMapView().removeLayer(audioNotesLayer);
|
activity.getMapView().removeLayer(audioNotesLayer);
|
||||||
}
|
}
|
||||||
|
@ -718,16 +718,17 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mapActivityResume(MapActivity activity) {
|
public void mapActivityResume(MapActivity activity) {
|
||||||
this.activity = activity;
|
this.mapActivity = activity;
|
||||||
;
|
|
||||||
((AudioManager) activity.getSystemService(Context.AUDIO_SERVICE)).registerMediaButtonEventReceiver(
|
((AudioManager) activity.getSystemService(Context.AUDIO_SERVICE)).registerMediaButtonEventReceiver(
|
||||||
new ComponentName(activity, MediaRemoteControlReceiver.class));
|
new ComponentName(activity, MediaRemoteControlReceiver.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapActivity getActivity() {
|
@Override
|
||||||
return activity;
|
public void mapActivityPause(MapActivity activity) {
|
||||||
|
this.mapActivity = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void recordVideo(final double lat, final double lon, final MapActivity mapActivity) {
|
public void recordVideo(final double lat, final double lon, final MapActivity mapActivity) {
|
||||||
if (AV_EXTERNAL_RECORDER.get()) {
|
if (AV_EXTERNAL_RECORDER.get()) {
|
||||||
captureVideoExternal(lat, lon, mapActivity);
|
captureVideoExternal(lat, lon, mapActivity);
|
||||||
|
@ -1035,7 +1036,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
private void updateRecordControl(final MapActivity mapActivity, final File f) {
|
private void updateRecordControl(final MapActivity mapActivity, final File f) {
|
||||||
recordControl.setText(app.getString(R.string.shared_string_control_stop), "");
|
recordControl.setText(app.getString(R.string.shared_string_control_stop), "");
|
||||||
recordControl.setImageDrawable(activity.getResources().getDrawable(R.drawable.widget_icon_av_active));
|
recordControl.setImageDrawable(mapActivity.getResources().getDrawable(R.drawable.widget_icon_av_active));
|
||||||
final MapInfoLayer mil = mapActivity.getMapLayers().getMapInfoLayer();
|
final MapInfoLayer mil = mapActivity.getMapLayers().getMapInfoLayer();
|
||||||
final boolean contains = recordControl.isVisible();
|
final boolean contains = recordControl.isVisible();
|
||||||
if (!contains) {
|
if (!contains) {
|
||||||
|
@ -1060,8 +1061,8 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateContextMenu(Recording rec) {
|
private void updateContextMenu(Recording rec) {
|
||||||
if (activity != null) {
|
if (mapActivity != null) {
|
||||||
MapContextMenu menu = activity.getContextMenu();
|
MapContextMenu menu = mapActivity.getContextMenu();
|
||||||
if (menu.isVisible()) {
|
if (menu.isVisible()) {
|
||||||
if (rec != null) {
|
if (rec != null) {
|
||||||
menu.show(new LatLon(rec.lat, rec.lon), audioNotesLayer.getObjectName(rec), rec);
|
menu.show(new LatLon(rec.lat, rec.lon), audioNotesLayer.getObjectName(rec), rec);
|
||||||
|
@ -1196,9 +1197,9 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
newMap.remove(r.file.getName());
|
newMap.remove(r.file.getName());
|
||||||
recordingByFileName = newMap;
|
recordingByFileName = newMap;
|
||||||
Algorithms.removeAllFiles(r.file);
|
Algorithms.removeAllFiles(r.file);
|
||||||
if (activity != null) {
|
if (mapActivity != null) {
|
||||||
activity.getContextMenu().close();
|
mapActivity.getContextMenu().close();
|
||||||
activity.getMapView().refreshMap();
|
mapActivity.getMapView().refreshMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1217,7 +1218,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
public boolean onMapActivityKeyEvent(KeyEvent key) {
|
public boolean onMapActivityKeyEvent(KeyEvent key) {
|
||||||
if (KeyEvent.KEYCODE_CAMERA == key.getKeyCode()) {
|
if (KeyEvent.KEYCODE_CAMERA == key.getKeyCode()) {
|
||||||
defaultAction(activity);
|
defaultAction(mapActivity);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue