This commit is contained in:
crimean 2019-03-12 14:23:39 +03:00
commit 80b7d7af98
10 changed files with 574 additions and 558 deletions

View file

@ -2922,7 +2922,7 @@ Abgedeckte Fläche: %1$s x %2$s</string>
<string name="previous_route">Vorherige Route</string>
<string name="shared_string_swap">Tauschen</string>
<string name="show_more">Mehr anzeigen</string>
<string name="tracks_on_map">Tracks auf der Karte</string>
<string name="tracks_on_map">Angezeigte Tracks</string>
<string name="time_of_day">Tageszeit</string>
<string name="by_transport_type">Von %1$s</string>
<string name="step_by_step">Schritt für Schritt</string>

View file

@ -11,6 +11,49 @@
Thx - Hardy
-->
<string name="rendering_attr_surface_unpaved_name">Unpaved</string>
<string name="rendering_attr_surface_sand_name">Sand</string>
<string name="rendering_attr_surface_grass_name">Grass</string>
<string name="rendering_attr_surface_grass_paver_name">Grass paver</string>
<string name="rendering_attr_surface_ground_name">Ground</string>
<string name="rendering_attr_surface_dirt_name">Dirt</string>
<string name="rendering_attr_surface_mud_name">Mud</string>
<string name="rendering_attr_surface_ice_name">Ice</string>
<string name="rendering_attr_surface_salt_name">Salt</string>
<string name="rendering_attr_surface_snow_name">Snow</string>
<string name="rendering_attr_surface_asphalt_name">Asphalt</string>
<string name="rendering_attr_surface_paved_name">Paved</string>
<string name="rendering_attr_surface_concrete_name">Concrete</string>
<string name="rendering_attr_surface_sett_name">Sett</string>
<string name="rendering_attr_surface_cobblestone_name">Cobblestone</string>
<string name="rendering_attr_surface_paving_stones_name">Paving stones</string>
<string name="rendering_attr_surface_pebblestone_name">Pebblestone</string>
<string name="rendering_attr_surface_stone_name">Stone</string>
<string name="rendering_attr_surface_metal_name">Metal</string>
<string name="rendering_attr_surface_wood_name">Wood</string>
<string name="rendering_attr_surface_gravel_name">Gravel</string>
<string name="rendering_attr_surface_fine_gravel_name">Fine gravel</string>
<string name="rendering_attr_surface_compacted_name">Compacted</string>
<string name="rendering_attr_smoothness_excellent_name">Excellent</string>
<string name="rendering_attr_smoothness_good_name">Good</string>
<string name="rendering_attr_smoothness_intermediate_name">Intermediate</string>
<string name="rendering_attr_smoothness_bad_name">Bad</string>
<string name="rendering_attr_smoothness_very_bad_name">Very bad</string>
<string name="rendering_attr_smoothness_horrible_name">Horrible</string>
<string name="rendering_attr_smoothness_very_horrible_name">Very horrible</string>
<string name="rendering_attr_smoothness_impassable_name">Impassable</string>
<string name="rendering_attr_highway_class_motorway_name">Motorway</string>
<string name="rendering_attr_highway_class_state_road_name">State road</string>
<string name="rendering_attr_highway_class_road_name">Road</string>
<string name="rendering_attr_highway_class_street_name">Street</string>
<string name="rendering_attr_highway_class_service_name">Service</string>
<string name="rendering_attr_highway_class_footway_name">Footway</string>
<string name="rendering_attr_highway_class_track_name">Track</string>
<string name="rendering_attr_highway_class_bridleway_name">Bridleway</string>
<string name="rendering_attr_highway_class_steps_name">Steps</string>
<string name="rendering_attr_highway_class_path_name">Path</string>
<string name="rendering_attr_highway_class_cycleway_name">Cycleway</string>
<string name="rendering_attr_undefined_name">Undefined</string>
<string name="release_3_3">
• New \'Directions\' screen: Displays Home and Work destination buttons, \'previous route\' shortcut, list of active GPX tracks and markers, search history\n\n
• Additional info under \'Route details\': road types, surface, steepness, smoothness\n\n
@ -31,7 +74,7 @@
<string name="sit_on_the_stop">Board at stop</string>
<string name="shared_string_swap">Swap</string>
<string name="show_more">Show more</string>
<string name="tracks_on_map">Tracks on the map</string>
<string name="tracks_on_map">Displayed tracks</string>
<string name="quick_action_show_hide_gpx_tracks">Show/Hide GPX Tracks</string>
<string name="quick_action_show_hide_gpx_tracks_descr">Tapping this action button shows or hides selected GPX tracks on the map</string>
<string name="quick_action_gpx_tracks_hide">Hide GPX Tracks</string>

View file

@ -102,6 +102,7 @@ import net.osmand.plus.views.TurnPathHelper;
import net.osmand.plus.views.controls.HorizontalSwipeConfirm;
import net.osmand.plus.widgets.TextViewEx;
import net.osmand.plus.widgets.style.CustomTypefaceSpan;
import net.osmand.render.RenderingRulesStorage;
import net.osmand.router.RouteSegmentResult;
import net.osmand.router.RouteStatistics;
import net.osmand.router.RouteStatistics.Incline;
@ -508,7 +509,9 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
elevationDataSet = statisticCard.getElevationDataSet();
List<RouteSegmentResult> route = routingHelper.getRoute().getOriginalRoute();
if (route != null) {
RouteStatistics routeStatistics = RouteStatistics.newRouteStatistic(route);
RenderingRulesStorage currentRenderer = app.getRendererRegistry().getCurrentSelectedRenderer();
RenderingRulesStorage defaultRender = app.getRendererRegistry().defaultRender();
RouteStatistics routeStatistics = RouteStatistics.newRouteStatistic(route, currentRenderer,defaultRender, nightMode);
GPXUtilities.GPXTrackAnalysis analysis = gpx.getAnalysis(0);
RouteInfoCard routeClassCard = new RouteInfoCard(mapActivity, routeStatistics.getRouteClassStatistic(), analysis);

View file

@ -9,7 +9,6 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.net.Uri;
@ -92,7 +91,6 @@ import net.osmand.plus.dialogs.ConfigureMapMenu.GpxAppearanceAdapter;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.routing.RouteCalculationResult;
import net.osmand.render.RenderingRuleProperty;
import net.osmand.render.RenderingRuleSearchRequest;
import net.osmand.render.RenderingRulesStorage;
import net.osmand.router.RouteStatistics;
import net.osmand.util.Algorithms;
@ -1268,8 +1266,7 @@ public class GpxUiHelper {
@NonNull HorizontalBarChart mChart,
@NonNull RouteStatistics.Statistics<E> routeStatistics,
@NonNull GPXTrackAnalysis analysis,
boolean useRightAxis,
boolean nightMode) {
boolean useRightAxis) {
XAxis xAxis = mChart.getXAxis();
xAxis.setEnabled(false);
@ -1290,7 +1287,7 @@ public class GpxUiHelper {
for (int i = 0; i < stacks.length; i++) {
RouteStatistics.RouteSegmentAttribute segment = segments.get(i);
stacks[i] = segment.getDistance() / divX;
colors[i] = getColorFromRouteSegmentAttribute(app, segment, nightMode);
colors[i] = segment.getColor();
}
entries.add(new BarEntry(0, stacks));
BarDataSet barDataSet = new BarDataSet(entries, "");
@ -1304,31 +1301,6 @@ public class GpxUiHelper {
return dataSet;
}
public static int getColorFromRouteSegmentAttribute(OsmandApplication app, RouteStatistics.RouteSegmentAttribute segment, boolean nightMode) {
String colorAttrName = segment.getColorAttrName();
String colorName = segment.getColorName();
int color = 0;
if (colorName != null) {
try {
color = Color.parseColor(colorName);
} catch (Exception e) {
}
} else if (colorAttrName != null) {
color = GpxUiHelper.getColorFromStyle(app, colorAttrName, nightMode);
}
return color;
}
public static int getColorFromStyle(OsmandApplication app, String colorAttrName, boolean nightMode) {
RenderingRulesStorage rrs = app.getRendererRegistry().getCurrentSelectedRenderer();
RenderingRuleSearchRequest req = new RenderingRuleSearchRequest(rrs);
req.setBooleanFilter(rrs.PROPS.R_NIGHT_MODE, nightMode);
if (req.searchRenderingAttribute(colorAttrName)) {
return req.getIntPropertyValue(rrs.PROPS.R_ATTR_COLOR_VALUE);
}
return 0;
}
public static OrderedLineDataSet createGPXElevationDataSet(@NonNull OsmandApplication ctx,
@NonNull LineChart mChart,
@NonNull GPXTrackAnalysis analysis,

View file

@ -484,7 +484,7 @@ public class WaypointDialogHelper {
final BaseBottomSheetItem[] addWaypointItem = new BaseBottomSheetItem[1];
addWaypointItem[0] = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_plus))
.setTitle(getString(R.string.add_waypoint))
.setTitle(getString(R.string.add_intermediate_point))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override

View file

@ -800,6 +800,12 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
});
View cancelButton = mainView.findViewById(R.id.cancel_button);
TextView cancelButtonText = (TextView) mainView.findViewById(R.id.cancel_button_descr);
if (routingHelper.isRouteCalculated() || routingHelper.isRouteBeingCalculated() || isTransportRouteCalculated()) {
cancelButtonText.setText(R.string.shared_string_dismiss);
} else {
cancelButtonText.setText(R.string.shared_string_cancel);
}
AndroidUtils.setBackground(app, cancelButton, nightMode, R.color.card_and_list_background_light, R.color.card_and_list_background_dark);
cancelButton.setOnClickListener(new OnClickListener() {
@Override
@ -1236,8 +1242,8 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
viaLayout.setVisibility(View.VISIBLE);
viaLayoutDivider.setVisibility(View.VISIBLE);
((TextView) mainView.findViewById(R.id.ViaView)).setText(via);
((TextView) mainView.findViewById(R.id.ViaSubView)).setText(mapActivity.getString(R.string.intermediate_destinations) + ": " +
mapActivity.getMyApplication().getTargetPointsHelper().getIntermediatePoints().size());
((TextView) mainView.findViewById(R.id.ViaSubView)).setText(mapActivity.getString(R.string.intermediate_destinations) + " (" +
mapActivity.getMyApplication().getTargetPointsHelper().getIntermediatePoints().size() + ")");
}
FrameLayout viaButton = (FrameLayout) mainView.findViewById(R.id.via_button);

View file

@ -600,7 +600,7 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
if (isAdded()) {
final TextViewEx title = (TextViewEx) view.findViewById(R.id.title);
int pointsSize = app.getTargetPointsHelper().getAllPoints().size();
String text = getString(R.string.shared_string_target_points) + ": " + (pointsSize != 0 ? pointsSize : 1);
String text = getString(R.string.shared_string_target_points) + " (" + (pointsSize != 0 ? pointsSize : 1) + ")";
title.setText(text);
}
}

View file

@ -18,15 +18,12 @@ import net.osmand.GPXUtilities;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.SettingsNavigationActivity;
import net.osmand.plus.helpers.GpxUiHelper;
import net.osmand.router.RouteStatistics;
import net.osmand.util.Algorithms;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class RouteInfoCard extends BaseCard {
@ -49,7 +46,7 @@ public class RouteInfoCard extends BaseCard {
updateHeader();
final HorizontalBarChart chart = (HorizontalBarChart) view.findViewById(R.id.chart);
GpxUiHelper.setupHorizontalGPXChart(app, chart, 5, 10, 10, true, nightMode);
BarData barData = GpxUiHelper.buildStatisticChart(app, chart, routeStatistics, analysis, true, nightMode);
BarData barData = GpxUiHelper.buildStatisticChart(app, chart, routeStatistics, analysis, true);
chart.setData(barData);
LinearLayout container = view.findViewById(R.id.route_items);
attachLegend(container, routeStatistics);
@ -82,9 +79,11 @@ public class RouteInfoCard extends BaseCard {
Map<E, RouteStatistics.RouteSegmentAttribute<E>> partition = routeStatistics.getPartition();
for (E key : partition.keySet()) {
RouteStatistics.RouteSegmentAttribute<E> segment = partition.get(key);
int color = GpxUiHelper.getColorFromRouteSegmentAttribute(app, segment, nightMode);
int color = segment.getColor();
Drawable circle = app.getUIUtilities().getPaintedIcon(R.drawable.ic_action_circle, color);
Spannable text = getSpanLegend(key.toString().toLowerCase(), segment);
String propertyName = segment.getPropertyName();
String name = SettingsNavigationActivity.getStringPropertyName(app, propertyName, propertyName.replaceAll("_", " "));
Spannable text = getSpanLegend(name, segment);
TextView legend = new TextView(app);
AndroidUtils.setTextPrimaryColor(app, legend, nightMode);

View file

@ -135,6 +135,6 @@ public class TracksCard extends BaseCard {
}
((TextView) view.findViewById(R.id.gpx_card_title)).setText(
String.format("%s — %d", app.getString(R.string.tracks_on_map), list.size()));
String.format("%s (%d)", app.getString(R.string.tracks_on_map), list.size()));
}
}