Add impassable road implementation

This commit is contained in:
Victor Shcherb 2014-11-03 01:53:57 +01:00
parent ee2eff593f
commit b028cd622e
3 changed files with 13 additions and 4 deletions

View file

@ -42,7 +42,7 @@
<ListView <ListView
android:id="@+id/left_drawer" android:id="@+id/left_drawer"
android:layout_width="320dp" android:layout_width="280dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="start" android:layout_gravity="start"
android:choiceMode="singleChoice" android:choiceMode="singleChoice"

View file

@ -9,7 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 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 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="select_impassable_raod">Select on map</string> <string name="select_impassable_road">Select on map</string>
<string name="impassable_road">Avoid roads&#8230;</string> <string name="impassable_road">Avoid roads&#8230;</string>
<string name="rendering_attr_tramTrainRoutes_name">Tram and train</string> <string name="rendering_attr_tramTrainRoutes_name">Tram and train</string>
<string name="tip_recent_changes_1_9_t">Changes in 1.9: <string name="tip_recent_changes_1_9_t">Changes in 1.9:

View file

@ -58,8 +58,9 @@ public class AvoidSpecificRoads {
// User super class to create the View // User super class to create the View
View v = convertView; View v = convertView;
if (position == 0) { if (position == 0) {
TextView tv = new TextView(ctx); TextView tv = (TextView) ctx.getLayoutInflater().inflate(R.layout.list_textview, null);
tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
tv.setText(app.getString(R.string.select_impassable_road));
v = tv; v = tv;
} else { } else {
if (v == null || v.findViewById(R.id.info_close) == null) { if (v == null || v.findViewById(R.id.info_close) == null) {
@ -83,6 +84,10 @@ public class AvoidSpecificRoads {
remove(obj); remove(obj);
getBuilder().removeImpassableRoad(obj); getBuilder().removeImpassableRoad(obj);
notifyDataSetChanged(); notifyDataSetChanged();
RoutingHelper rh = app.getRoutingHelper();
if(rh.isRouteCalculated() || rh.isRouteBeingCalculated()) {
rh.recalculateRouteDueToSettingsChange();
}
} }
}); });
@ -145,6 +150,10 @@ public class AvoidSpecificRoads {
protected void onPostExecute(RouteDataObject result) { protected void onPostExecute(RouteDataObject result) {
if(result != null) { if(result != null) {
getBuilder().addImpassableRoad(result); getBuilder().addImpassableRoad(result);
RoutingHelper rh = app.getRoutingHelper();
if(rh.isRouteCalculated() || rh.isRouteBeingCalculated()) {
rh.recalculateRouteDueToSettingsChange();
}
showDialog(activity); showDialog(activity);
} }
}; };