Add dialog to restart

This commit is contained in:
Victor Shcherb 2015-07-04 17:16:32 +03:00
parent e71514aafc
commit cc850e8e4a
2 changed files with 19 additions and 6 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="restart_is_required">In order to apply the changes, restart of the application is required.</string>
<string name="light_theme">Light</string>
<string name="dark_theme">Dark</string>
<string name="lang_pms">Piedmontese</string>

View file

@ -438,13 +438,9 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
} else if (id.equals(settings.PREFERRED_LOCALE.getId())) {
// restart application to update locale
getMyApplication().checkPreferredLocale();
Intent intent = getIntent();
finish();
startActivity(intent);
restartApp();
} else if (id.equals(settings.OSMAND_THEME.getId())) {
Intent intent = getIntent();
finish();
startActivity(intent);
restartApp();
} else {
updateAllSettings();
}
@ -453,6 +449,22 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
private void restartApp() {
Builder bld = new AlertDialog.Builder(this);
bld.setMessage(R.string.restart_is_required);
bld.setPositiveButton(R.string.shared_string_ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = getIntent();
finish();
startActivity(intent);
}
});
}
private void warnAboutChangingStorage(final String newValue) {
String newDir = newValue != null ? newValue.trim() : newValue;
if(!newDir.replace('/', ' ').trim().