From d9384a8dfe50af91878432cd24cb6435a982616a Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 15 Sep 2018 05:33:00 +0000 Subject: [PATCH] Use alter dialog for setup errors Fixes #4 --- .../java/eu/faircode/email/FragmentAccount.java | 15 ++++++++++++--- .../java/eu/faircode/email/FragmentIdentity.java | 6 +++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentAccount.java b/app/src/main/java/eu/faircode/email/FragmentAccount.java index 85298b91..8311ab4f 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccount.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccount.java @@ -489,7 +489,12 @@ public class FragmentAccount extends FragmentEx { pbCheck.setVisibility(View.GONE); grpFolders.setVisibility(View.GONE); btnSave.setVisibility(View.GONE); - Toast.makeText(getContext(), Helper.formatThrowable(ex), Toast.LENGTH_LONG).show(); + + new AlertDialog.Builder(getContext()) + .setMessage(Helper.formatThrowable(ex)) + .setPositiveButton(android.R.string.ok, null) + .create() + .show(); } }.load(FragmentAccount.this, args); } @@ -690,7 +695,11 @@ public class FragmentAccount extends FragmentEx { btnSave.setEnabled(true); pbSave.setVisibility(View.GONE); - Toast.makeText(getContext(), Helper.formatThrowable(ex), Toast.LENGTH_LONG).show(); + new AlertDialog.Builder(getContext()) + .setMessage(Helper.formatThrowable(ex)) + .setPositiveButton(android.R.string.ok, null) + .create() + .show(); } }.load(FragmentAccount.this, args); } @@ -927,7 +936,7 @@ public class FragmentAccount extends FragmentEx { tilPassword.getEditText().setText(token); } catch (Throwable ex) { Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex)); - Toast.makeText(getContext(), Helper.formatThrowable(ex), Toast.LENGTH_LONG).show(); + Toast.makeText(getContext(), ex.toString(), Toast.LENGTH_LONG).show(); } finally { snackbar.dismiss(); } diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentity.java b/app/src/main/java/eu/faircode/email/FragmentIdentity.java index bd389451..1b881961 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentity.java @@ -338,7 +338,11 @@ public class FragmentIdentity extends FragmentEx { btnSave.setEnabled(true); pbSave.setVisibility(View.GONE); - Toast.makeText(getContext(), Helper.formatThrowable(ex), Toast.LENGTH_LONG).show(); + new AlertDialog.Builder(getContext()) + .setMessage(Helper.formatThrowable(ex)) + .setPositiveButton(android.R.string.ok, null) + .create() + .show(); } }.load(FragmentIdentity.this, args); }