Updated avoid roads dialog

This commit is contained in:
Denis 2015-01-15 15:05:28 +02:00
parent 10535946c1
commit b39fce5cc1
2 changed files with 44 additions and 45 deletions

View file

@ -9,6 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="avoid_roads_msg">You can change route by selecting roads to avoid</string>
<string name="rendering_value__name">Default</string>
<string name="speak_pedestrian">Announce pedestrian crosswalks</string>
<string name="rendering_attr_roadStyle_name">Road style</string>

View file

@ -48,7 +48,6 @@ public class AvoidSpecificRoads {
public ArrayAdapter<RouteDataObject> createAdapter(final MapActivity ctx) {
final ArrayList<RouteDataObject> points = new ArrayList<RouteDataObject>();
points.add(new RouteDataObject((RouteRegion) null));
points.addAll(missingRoads);
final LatLon mapLocation = ctx.getMapLocation();
return new ArrayAdapter<RouteDataObject>(ctx,
@ -58,11 +57,6 @@ public class AvoidSpecificRoads {
public View getView(final int position, View convertView, ViewGroup parent) {
// User super class to create the View
View v = convertView;
if (position == 0) {
v= ctx.getLayoutInflater().inflate(R.layout.list_bigtextview, null);
TextView tv = (TextView) v.findViewById(R.id.Text);
tv.setText(app.getString(R.string.select_impassable_road));
} else {
if (v == null || v.findViewById(R.id.info_close) == null) {
v = ctx.getLayoutInflater().inflate(R.layout.waypoint_reached, null);
}
@ -92,8 +86,6 @@ public class AvoidSpecificRoads {
}
}
});
}
return v;
}
@ -110,22 +102,28 @@ public class AvoidSpecificRoads {
Builder bld = new AlertDialog.Builder(mapActivity);
bld.setTitle(R.string.impassable_road);
final ArrayAdapter<?> listAdapter = createAdapter(mapActivity);
if (missingRoads.size() == 0){
bld.setMessage(R.string.avoid_roads_msg);
} else {
bld.setAdapter(listAdapter, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if(which == 0) {
selectFromMap(mapActivity);
} else {
RouteDataObject obj = missingRoads.get(which - 1);
double lat = MapUtils.get31LatitudeY(obj.getPoint31YTile(0));
double lon = MapUtils.get31LongitudeX(obj.getPoint31XTile(0));
showOnMap(app, mapActivity, lat, lon, getText(obj), dialog);
}
}
});
bld.setPositiveButton(R.string.close, null);
}
bld.setPositiveButton(R.string.select_impassable_road, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
selectFromMap(mapActivity);
}
});
bld.setNegativeButton(R.string.default_buttons_cancel, null);
bld.show();
}