WARN about speed cam usage

This commit is contained in:
Victor Shcherb 2015-03-27 00:04:28 +01:00
parent 0d3238d175
commit dd2e162a85
2 changed files with 29 additions and 3 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="confirm_usage_speed_cameras">In many countries (Germany, France, Italy and others) it is not allowed to use speed camera announcement! OsmAnd doesn\'t take a responsibility of violating local rules, please click yes if you are eligible to use this feature. </string>
<string name="welmode_download_maps">Download maps</string>
<string name="welcome_select_region">Select your region</string>
<string name="welcome_text">OsmAnd allows you to use maps and offline navigation!</string>

View file

@ -345,7 +345,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
settings.SHOW_PEDESTRIAN, settings.SHOW_CAMERAS, settings.SHOW_LANES }, preference.getTitle());
return true;
} else if (preference == speakAlarms) {
showBooleanSettings(new String[] { getString(R.string.speak_street_names), getString(R.string.speak_traffic_warnings),
AlertDialog dlg = showBooleanSettings(new String[] { getString(R.string.speak_street_names), getString(R.string.speak_traffic_warnings),
getString(R.string.speak_pedestrian), getString(R.string.speak_speed_limit),
getString(R.string.speak_cameras),
getString(R.string.announce_gpx_waypoints),
@ -355,12 +355,37 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
settings.SPEAK_PEDESTRIAN, settings.SPEAK_SPEED_LIMIT,
settings.SPEAK_SPEED_CAMERA,
settings.ANNOUNCE_WPT, settings.ANNOUNCE_NEARBY_FAVORITES, settings.ANNOUNCE_NEARBY_POI}, preference.getTitle());
dlg.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
if(settings.SPEAK_SPEED_CAMERA.get()) {
settings.SPEAK_SPEED_CAMERA.set(false);
confirmSpeedCamerasDlg();
}
}
});
return true;
}
return false;
}
private void confirmSpeedCamerasDlg() {
Builder bld = new AlertDialog.Builder(this);
bld.setMessage(R.string.confirm_usage_speed_cameras);
bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
settings.SPEAK_SPEED_CAMERA.set(true);
}
});
bld.setNegativeButton(R.string.shared_string_cancel, null);
bld.show();
}
public void showBooleanSettings(String[] vals, final OsmandPreference<Boolean>[] prefs, final CharSequence title) {
public AlertDialog showBooleanSettings(String[] vals, final OsmandPreference<Boolean>[] prefs, final CharSequence title) {
Builder bld = new AlertDialog.Builder(this);
boolean[] checkedItems = new boolean[prefs.length];
for (int i = 0; i < prefs.length; i++) {
@ -392,7 +417,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
}
});
bld.show();
return bld.show();
}