diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index c4f75cc055..1b89adc1dc 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,9 +9,12 @@ 1. 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 --> - Avoid.. + Show lanes + Avoid unpaved roads + Avoid ferries + Avoid… Avoid toll roads, unpaved, ferries - Show alarms + Show alarms… Show speed limits, speed cameras and traffic bumps Fluorescent colors Ruler @@ -49,9 +52,6 @@ Unlock screen The screen is locked Set wake-up interval: - Show speed cameras (may be forbidden in some countries) - Show speed limits and traffic bumps - Avoid toll roads for route calculation Show speed cameras Show speed limits Avoid toll roads diff --git a/OsmAnd/res/xml/settings_pref.xml b/OsmAnd/res/xml/settings_pref.xml index f5bbf952dd..1063c54407 100644 --- a/OsmAnd/res/xml/settings_pref.xml +++ b/OsmAnd/res/xml/settings_pref.xml @@ -22,15 +22,6 @@ - - - diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 6ac3d84162..1942c9cf6b 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -578,14 +578,13 @@ public class OsmandSettings { // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference FAST_ROUTE_MODE = new BooleanPreference("fast_route_mode", true).makeProfile(); - // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference SHOW_CAMERAS = new BooleanPreference("show_cameras", true).makeGlobal().cache(); - - // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference SHOW_SPEED_LIMITS = new BooleanPreference("show_speed_limits", true).makeGlobal().cache(); + public final OsmandPreference SHOW_LANES = new BooleanPreference("show_lanes", true).makeGlobal().cache(); - // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference AVOID_TOLL_ROADS = new BooleanPreference("avoid_toll_roads", false).makeGlobal().cache(); + public final OsmandPreference AVOID_UNPAVED_ROADS = new BooleanPreference("avoid_unpaved_roads", false).makeGlobal().cache(); + public final OsmandPreference AVOID_FERRIES = new BooleanPreference("avoid_ferries", false).makeGlobal().cache(); // this value string is synchronized with settings_pref.xml preference name public final CommonPreference SAVE_TRACK_INTERVAL = new IntPreference("save_track_interval", 5).makeProfile(); diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java index 6da26bfac2..7be9fa44de 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java @@ -38,6 +38,7 @@ import android.app.AlertDialog.Builder; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; +import android.content.DialogInterface.OnMultiChoiceClickListener; import android.content.Intent; import android.content.pm.ActivityInfo; import android.os.AsyncTask; @@ -69,6 +70,8 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference private Preference bidforfix; private Preference plugins; + private Preference avoidRouting; + private Preference showAlarms; private EditTextPreference applicationDir; private ListPreference applicationModePreference; @@ -375,8 +378,10 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference bidforfix.setOnPreferenceClickListener(this); plugins = (Preference) screen.findPreference("plugins"); plugins.setOnPreferenceClickListener(this); - - + avoidRouting = (Preference) screen.findPreference("avoid_in_routing"); + avoidRouting.setOnPreferenceClickListener(this); + showAlarms = (Preference) screen.findPreference("show_routing_alarms"); + showAlarms.setOnPreferenceClickListener(this); Intent intent = getIntent(); @@ -744,6 +749,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference return super.onPreferenceTreeClick(preferenceScreen, preference); } + @SuppressWarnings("unchecked") @Override public boolean onPreferenceClick(Preference preference) { if(preference.getKey().equals(OsmandSettings.LOCAL_INDEXES)){ @@ -759,9 +765,39 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference } else if(preference == plugins){ startActivity(new Intent(this, PluginsActivity.class)); return true; + } else if (preference == avoidRouting) { + showBooleanSettings(new String[] { getString(R.string.avoid_toll_roads), getString(R.string.avoid_ferries), + getString(R.string.avoid_unpaved) }, new OsmandPreference[] { osmandSettings.AVOID_TOLL_ROADS, + osmandSettings.AVOID_FERRIES, osmandSettings.AVOID_UNPAVED_ROADS }); + return true; + } else if(preference == showAlarms){ + showBooleanSettings(new String[] { getString(R.string.show_cameras), getString(R.string.show_speed_limits), + getString(R.string.show_lanes) }, + new OsmandPreference[] { osmandSettings.SHOW_CAMERAS, osmandSettings.SHOW_SPEED_LIMITS, + osmandSettings.SHOW_LANES}); + return true; + } else if(preference.getKey().equals("show_routing_alarms")){ + startActivity(new Intent(this, PluginsActivity.class)); + return true; } return false; } + + public void showBooleanSettings(String[] vals, final OsmandPreference[] prefs) { + Builder bld = new AlertDialog.Builder(this); + boolean[] checkedItems = new boolean[prefs.length]; + for(int i=0; i result){