Small usability fix

This commit is contained in:
Victor Shcherb 2014-07-11 15:25:55 +02:00
parent d18806139e
commit 8d8cc9d887
2 changed files with 19 additions and 14 deletions

View file

@ -583,15 +583,16 @@ public class MapActivityActions implements DialogProvider {
public void enterRoutePlanningMode(final LatLon from, final String fromName) {
List<SelectedGpxFile> 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);

View file

@ -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<String> 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) {