From 686a4d1f9cce25f5224fdfdf78185d7a5788960b Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 30 Oct 2021 15:22:01 +0200 Subject: [PATCH] Small behavior improvements --- .../main/java/eu/faircode/email/FragmentCompose.java | 3 ++- .../eu/faircode/email/FragmentDialogIdentity.java | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 86245969c0..181f710a5d 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -5329,7 +5329,8 @@ public class FragmentCompose extends FragmentBase { @Override public void onClick(View v) { v.getContext().startActivity(new Intent(v.getContext(), ActivitySetup.class) - .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK)); + .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK) + .putExtra("manual", true)); getActivity().finish(); } }); diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogIdentity.java b/app/src/main/java/eu/faircode/email/FragmentDialogIdentity.java index 5210141aca..1d54488ad3 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogIdentity.java @@ -85,7 +85,6 @@ public class FragmentDialogIdentity extends FragmentDialogBase { } }); - tvPrimaryHint.setVisibility(identities_primary_hint ? View.GONE : View.VISIBLE); tvPrimaryHint.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -108,12 +107,14 @@ public class FragmentDialogIdentity extends FragmentDialogBase { @Override public void onClick(View v) { v.getContext().startActivity(new Intent(v.getContext(), ActivitySetup.class) - .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK)); + .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK) + .putExtra("manual", true)); getActivity().finish(); dismiss(); } }); + tvPrimaryHint.setVisibility(View.GONE); grpIdentities.setVisibility(View.GONE); grpNoIdentities.setVisibility(View.GONE); @@ -164,6 +165,12 @@ public class FragmentDialogIdentity extends FragmentDialogBase { spIdentity.setSelection(selected); } + if (identities.size() == 0) { + AlertDialog dialog = ((AlertDialog) getDialog()); + if (dialog != null) + dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false); + } + tvPrimaryHint.setVisibility(identities_primary_hint || identities.size() == 0 ? View.GONE : View.VISIBLE); grpIdentities.setVisibility(identities.size() > 0 ? View.VISIBLE : View.GONE); grpNoIdentities.setVisibility(identities.size() > 0 ? View.GONE : View.VISIBLE); }