From c42ffd139bfe1542ecae340cff7527a49453d9c9 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 18 Aug 2021 21:58:11 +0200 Subject: [PATCH] Improved language change dialog --- .../faircode/email/FragmentOptionsMisc.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index 9321ccd5fd..5f6890889e 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -402,6 +402,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc new AlertDialog.Builder(view.getContext()) .setTitle(languages.get(position - 1).second) + .setMessage(R.string.title_advanced_english_hint) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { @@ -433,7 +434,28 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc ibResetLanguage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - prefs.edit().remove("language").commit(); // apply won't work here + new AlertDialog.Builder(view.getContext()) + .setTitle(R.string.title_advanced_language_system) + .setMessage(R.string.title_advanced_english_hint) + .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + prefs.edit().remove("language").commit(); // apply won't work here + } + }) + .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + // Do nothing + } + }) + .setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + setOptions(); + } + }) + .show(); } });