From 8d8cc9d88794eca1e56c260f1f9b3f975e8e853a Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 11 Jul 2014 15:25:55 +0200 Subject: [PATCH] Small usability fix --- .../plus/activities/MapActivityActions.java | 13 ++++++------ .../mapwidgets/AppearanceWidgetsFactory.java | 20 +++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index 613a52081b..136a1bf45b 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -583,15 +583,16 @@ public class MapActivityActions implements DialogProvider { public void enterRoutePlanningMode(final LatLon from, final String fromName) { List selectedGPXFiles = mapActivity.getMyApplication().getSelectedGpxHelper().getSelectedGPXFiles(); GPXFile gpxFile = null; - boolean notShowDialog = false; for (SelectedGpxFile gs : selectedGPXFiles) { - if (!gs.isShowCurrentTrack()) { - notShowDialog = gs.notShowNavigationDialog; - gpxFile = gs.getGpxFile(); - break; + if (!gs.isShowCurrentTrack() && + !gs.notShowNavigationDialog) { + if(gs.getGpxFile().hasRtePt() || gs.getGpxFile().hasTrkpt()) { + gpxFile = gs.getGpxFile(); + break; + } } } - if(gpxFile != null && !notShowDialog) { + if(gpxFile != null) { final GPXFile f = gpxFile; Builder bld = new AlertDialog.Builder(mapActivity); bld.setMessage(R.string.use_displayed_track_for_navigation); diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java index 89bd76e591..8bc196a029 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java @@ -15,6 +15,7 @@ import net.osmand.plus.views.MapInfoLayer; import net.osmand.plus.views.OsmandMapTileView; import net.osmand.render.RenderingRuleProperty; import net.osmand.render.RenderingRulesStorage; +import net.osmand.util.Algorithms; import android.app.AlertDialog; import android.content.DialogInterface; import android.widget.Toast; @@ -96,14 +97,17 @@ public class AppearanceWidgetsFactory { bld.setTitle(R.string.renderers); Collection rendererNames = app.getRendererRegistry().getRendererNames(); final String[] items = rendererNames.toArray(new String[rendererNames.size()]); - int i = -1; - for(int j = 0; j< items.length; j++) { - if(items[j].equals(app.getRendererRegistry().getCurrentSelectedRenderer().getName())) { - i = j; - break; - } - } - bld.setSingleChoiceItems(items, i, new DialogInterface.OnClickListener() { + final String[] visibleNames = new String[items.length]; + int selected = -1; + final String selectedName = app.getRendererRegistry().getCurrentSelectedRenderer().getName(); + for (int j = 0; j < items.length; j++) { + if (items[j].equals(selectedName)) { + selected = j; + } + visibleNames[j] = Algorithms.capitalizeFirstLetterAndLowercase(items[j].replace('_', ' ').replace( + '-', ' ')); + } + bld.setSingleChoiceItems(items, selected, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) {