Merge branch 'master' of https://github.com/osmandapp/Osmand into 9055_allow_to_edit_address

This commit is contained in:
simon 2020-08-11 12:18:06 +03:00
commit f353e22edf
10 changed files with 65 additions and 28 deletions

View file

@ -341,13 +341,20 @@ public abstract class MapRenderingTypes {
} }
String nmts = parser.getAttributeValue("", "nameTags"); String nmts = parser.getAttributeValue("", "nameTags");
if(nmts != null) { if (nmts != null) {
if (rtype.relation || rtype.relationGroup) {
String namePrefix = parser.getAttributeValue("", "namePrefix"); //$NON-NLS-1$ String namePrefix = parser.getAttributeValue("", "namePrefix"); //$NON-NLS-1$
if (namePrefix == null) { if (namePrefix == null) {
namePrefix = ""; namePrefix = "";
} }
rtype.relationNames = new LinkedHashMap<String, String>(); rtype.relationNames = new LinkedHashMap<String, String>();
putNameTags(nmts, rtype.relationNames, namePrefix); putNameTags(nmts, rtype.relationNames, namePrefix);
} else {
String[] nameSplit = nmts.split(",");
for (String nameTag : nameSplit) {
checkOrCreateTextRule(nameTag, null);
}
}
} }
String rnmts = parser.getAttributeValue("", "relationGroupNameTags"); String rnmts = parser.getAttributeValue("", "relationGroupNameTags");
if (rnmts != null) { if (rnmts != null) {

View file

@ -189,7 +189,7 @@
<color name="gpx_time_span_color">#0080FF</color> <color name="gpx_time_span_color">#0080FF</color>
<color name="color_favorite">#eecc22</color> <color name="color_favorite">#eecc22</color>
<color name="color_favorite_gray">#b3b3b3</color> <color name="color_favorite_gray">#727272</color>
<color name="parking_icon_background">#244DBD</color> <color name="parking_icon_background">#244DBD</color>
<color name="transport_stop_icon_background">#5870FE</color> <color name="transport_stop_icon_background">#5870FE</color>

View file

@ -11,6 +11,7 @@
Thx - Hardy Thx - Hardy
--> -->
<string name="street_level_imagery">Street-level imagery</string>
<string name="rourte_between_points_add_track_desc">Select a track file for which a new segment will be added.</string> <string name="rourte_between_points_add_track_desc">Select a track file for which a new segment will be added.</string>
<string name="navigation_profile">Navigation profile</string> <string name="navigation_profile">Navigation profile</string>
<string name="threshold_distance">Threshold distance</string> <string name="threshold_distance">Threshold distance</string>

View file

@ -117,7 +117,7 @@ public abstract class ContextMenuScrollFragment extends ContextMenuFragment impl
MapControlsLayer mapControlsLayer = mapLayers.getMapControlsLayer(); MapControlsLayer mapControlsLayer = mapLayers.getMapControlsLayer();
mapControlsLayer.setupZoomInButton(zoomInButtonView, longClickListener, ZOOM_IN_BUTTON_ID); mapControlsLayer.setupZoomInButton(zoomInButtonView, longClickListener, ZOOM_IN_BUTTON_ID);
mapControlsLayer.setupZoomOutButton(zoomOutButtonView, longClickListener, ZOOM_OUT_BUTTON_ID); mapControlsLayer.setupZoomOutButton(zoomOutButtonView, longClickListener, ZOOM_OUT_BUTTON_ID);
mapControlsLayer.setupBackToLocationButton(myLocButtonView, BACK_TO_LOC_BUTTON_ID); mapControlsLayer.setupBackToLocationButton(myLocButtonView, false, BACK_TO_LOC_BUTTON_ID);
MapInfoLayer mapInfoLayer = mapLayers.getMapInfoLayer(); MapInfoLayer mapInfoLayer = mapLayers.getMapInfoLayer();
rulerWidget = mapInfoLayer.setupRulerWidget(mapRulerView); rulerWidget = mapInfoLayer.setupRulerWidget(mapRulerView);

View file

@ -78,7 +78,7 @@ public class PointImageDrawable extends Drawable {
mapIconBackgroundCenterSmall = backgroundType.getMapBackgroundIconId(ctx, "center", true); mapIconBackgroundCenterSmall = backgroundType.getMapBackgroundIconId(ctx, "center", true);
mapIconBackgroundBottomSmall = backgroundType.getMapBackgroundIconId(ctx, "bottom", true); mapIconBackgroundBottomSmall = backgroundType.getMapBackgroundIconId(ctx, "bottom", true);
colorFilter = new PorterDuffColorFilter(col, PorterDuff.Mode.SRC_IN); colorFilter = new PorterDuffColorFilter(col, PorterDuff.Mode.SRC_IN);
grayFilter = new PorterDuffColorFilter(res.getColor(R.color.color_favorite_gray), PorterDuff.Mode.MULTIPLY); grayFilter = new PorterDuffColorFilter(res.getColor(R.color.color_favorite_gray), PorterDuff.Mode.SRC_IN);
dp_12_px = AndroidUtils.dpToPx(pointInfo.ctx, 12); dp_12_px = AndroidUtils.dpToPx(pointInfo.ctx, 12);
} }

View file

@ -181,7 +181,8 @@ public class MapillaryPlugin extends OsmandPlugin {
} }
adapter.addItem(new ContextMenuItem.ItemBuilder() adapter.addItem(new ContextMenuItem.ItemBuilder()
.setId(MAPILLARY) .setId(MAPILLARY)
.setTitleId(R.string.mapillary, mapActivity) .setTitleId(R.string.street_level_imagery, mapActivity)
.setDescription("Mapillary")
.setSelected(settings.SHOW_MAPILLARY.get()) .setSelected(settings.SHOW_MAPILLARY.get())
.setColor(settings.SHOW_MAPILLARY.get() ? R.color.osmand_orange : ContextMenuItem.INVALID_ID) .setColor(settings.SHOW_MAPILLARY.get() ? R.color.osmand_orange : ContextMenuItem.INVALID_ID)
.setIcon(R.drawable.ic_action_mapillary) .setIcon(R.drawable.ic_action_mapillary)

View file

@ -162,7 +162,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
} }
} }
public static final int[] SECONDS = new int[] {0, 1, 2, 3, 5, 10, 15, 30, 60, 90}; public static final int[] SECONDS = new int[] {0, 1, 2, 3, 5, 10, 15, 20, 30, 60, 90};
public static final int[] MINUTES = new int[] {2, 3, 5}; public static final int[] MINUTES = new int[] {2, 3, 5};
public static final int[] MAX_INTERVAL_TO_SEND_MINUTES = new int[] {1, 2, 5, 10, 15, 20, 30, 60}; public static final int[] MAX_INTERVAL_TO_SEND_MINUTES = new int[] {1, 2, 5, 10, 15, 20, 30, 60};

View file

@ -526,13 +526,9 @@ public class ParkingPositionPlugin extends OsmandPlugin {
} }
String getFormattedTime(long timeInMillis) { String getFormattedTime(long timeInMillis) {
Time time = new Time(); java.text.DateFormat dateFormat = DateFormat.getMediumDateFormat(app);
time.set(timeInMillis); java.text.DateFormat timeFormat = DateFormat.getTimeFormat(app);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm dd.MM.yyyy", Locale.getDefault()); return timeFormat.format(timeInMillis) + " " + dateFormat.format(timeInMillis);
if (!DateFormat.is24HourFormat(app)) {
sdf = new SimpleDateFormat("hh:mm a dd.MM.yyyy", Locale.getDefault());
}
return sdf.format(new Date(time.toMillis(false)));
} }
String getFormattedTimeInterval(long timeInMillis, Activity ctx) { String getFormattedTimeInterval(long timeInMillis, Activity ctx) {

View file

@ -376,7 +376,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
mapControlsLayer.setupZoomInButton(zoomInButton, longClickListener, ZOOM_IN_BUTTON_ID); mapControlsLayer.setupZoomInButton(zoomInButton, longClickListener, ZOOM_IN_BUTTON_ID);
mapControlsLayer.setupZoomOutButton(zoomOutButton, longClickListener, ZOOM_OUT_BUTTON_ID); mapControlsLayer.setupZoomOutButton(zoomOutButton, longClickListener, ZOOM_OUT_BUTTON_ID);
mapControlsLayer.setupBackToLocationButton(backToLocation, BACK_TO_LOC_BUTTON_ID); mapControlsLayer.setupBackToLocationButton(backToLocation, false, BACK_TO_LOC_BUTTON_ID);
AndroidUiHelper.updateVisibility(zoomButtonsView, true); AndroidUiHelper.updateVisibility(zoomButtonsView, true);
} }

View file

@ -359,7 +359,7 @@ public class MapControlsLayer extends OsmandMapLayer {
private void initControls() { private void initControls() {
View backToLocation = mapActivity.findViewById(R.id.map_my_location_button); View backToLocation = mapActivity.findViewById(R.id.map_my_location_button);
backToLocationControl = setupBackToLocationButton(backToLocation, BACK_TO_LOC_HUD_ID); backToLocationControl = setupBackToLocationButton(backToLocation, true, BACK_TO_LOC_HUD_ID);
View backToMenuButton = mapActivity.findViewById(R.id.map_menu_button); View backToMenuButton = mapActivity.findViewById(R.id.map_menu_button);
@ -397,7 +397,7 @@ public class MapControlsLayer extends OsmandMapLayer {
}); });
} }
public MapHudButton setupBackToLocationButton(View backToLocation, String buttonId) { public MapHudButton setupBackToLocationButton(View backToLocation, boolean showContextMenu, String buttonId) {
MapHudButton backToLocationButton = createHudButton(backToLocation, R.drawable.ic_my_location, buttonId) MapHudButton backToLocationButton = createHudButton(backToLocation, R.drawable.ic_my_location, buttonId)
.setIconColorId(R.color.map_button_icon_color_light, R.color.map_button_icon_color_dark) .setIconColorId(R.color.map_button_icon_color_light, R.color.map_button_icon_color_dark)
.setBg(R.drawable.btn_circle_blue); .setBg(R.drawable.btn_circle_blue);
@ -405,18 +405,50 @@ public class MapControlsLayer extends OsmandMapLayer {
backToLocation.setOnClickListener(new View.OnClickListener() { backToLocation.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
onBackToLocation(false);
}
});
if (showContextMenu) {
backToLocation.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
onBackToLocation(true);
return false;
}
});
}
controls.add(backToLocationButton);
return backToLocationButton;
}
private void onBackToLocation(boolean showLocationMenu) {
if (OsmAndLocationProvider.isLocationPermissionAvailable(mapActivity)) { if (OsmAndLocationProvider.isLocationPermissionAvailable(mapActivity)) {
if (showLocationMenu) {
showContextMenuForMyLocation();
} else if (!mapActivity.getContextMenu().isVisible()) {
mapActivity.getMapViewTrackingUtilities().backToLocationImpl(); mapActivity.getMapViewTrackingUtilities().backToLocationImpl();
}
} else { } else {
ActivityCompat.requestPermissions(mapActivity, ActivityCompat.requestPermissions(mapActivity,
new String[] {Manifest.permission.ACCESS_FINE_LOCATION}, new String[] {Manifest.permission.ACCESS_FINE_LOCATION},
OsmAndLocationProvider.REQUEST_LOCATION_PERMISSION); OsmAndLocationProvider.REQUEST_LOCATION_PERMISSION);
} }
} }
});
controls.add(backToLocationButton);
return backToLocationButton; private void showContextMenuForMyLocation() {
OsmAndLocationProvider lp = app.getLocationProvider();
Location lastKnownLocation = lp.getLastKnownLocation();
Location lastStaleKnownLocation = lp.getLastStaleKnownLocation();
Location location = lastKnownLocation != null ? lastKnownLocation : lastStaleKnownLocation;
if (location != null) {
ContextMenuLayer cml = mapActivity.getMapView().getLayerByClass(ContextMenuLayer.class);
if (cml != null) {
cml.showContextMenu(location.getLatitude(), location.getLongitude(), true);
}
}
} }
public void doRoute(boolean hasTargets) { public void doRoute(boolean hasTargets) {