From 43935183db1c2df571844014d835b9f4bfdcf17c Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 25 Nov 2019 07:58:28 +0100 Subject: [PATCH] Added long press CC/BCC to remember visibility state --- FAQ.md | 1 + .../java/eu/faircode/email/FragmentCompose.java | 16 ++++++++++++++-- .../eu/faircode/email/FragmentOptionsMisc.java | 3 +-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/FAQ.md b/FAQ.md index f9e65221e6..a08cba6fdc 100644 --- a/FAQ.md +++ b/FAQ.md @@ -1389,6 +1389,7 @@ but even Google's Chrome cannot handle this. * Did you know that you can long press the star icon in a conversation thread to set a colored star? * Did you know that you can open the navigation drawer by swiping from the left, even when viewing a conversation? * Did you know that you can long press the floating reply button to reply to all? +* Did you know that you can long press the people's icon to show/hide the CC/BCC fields and remember the visibility state for the next time?
diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 893d5900c9..084e2a44ec 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -354,6 +354,16 @@ public class FragmentCompose extends FragmentBase { } }); + ibCcBcc.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + onMenuAddresses(); + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); + prefs.edit().putBoolean("cc_bcc", grpAddresses.getVisibility() == View.VISIBLE).apply(); + return true; + } + }); + View.OnClickListener onPick = new View.OnClickListener() { @Override public void onClick(View view) { @@ -519,7 +529,6 @@ public class FragmentCompose extends FragmentBase { grpHeader.setVisibility(View.GONE); grpExtra.setVisibility(View.GONE); - grpAddresses.setVisibility(View.GONE); ibCcBcc.setVisibility(View.GONE); grpAttachments.setVisibility(View.GONE); tvNoInternet.setVisibility(View.GONE); @@ -567,6 +576,7 @@ public class FragmentCompose extends FragmentBase { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); boolean suggest_sent = prefs.getBoolean("suggest_sent", true); boolean suggest_received = prefs.getBoolean("suggest_received", false); + boolean cc_bcc = prefs.getBoolean("cc_bcc", false); cadapter.setFilterQueryProvider(new FilterQueryProvider() { public Cursor runQuery(CharSequence typed) { @@ -621,6 +631,7 @@ public class FragmentCompose extends FragmentBase { etTo.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer()); etCc.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer()); etBcc.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer()); + grpAddresses.setVisibility(cc_bcc ? View.VISIBLE : View.GONE); rvAttachment.setHasFixedSize(false); LinearLayoutManager llm = new LinearLayoutManager(getContext()); @@ -2646,7 +2657,8 @@ public class FragmentCompose extends FragmentBase { cbSignature.setTag(data.draft.signature); grpHeader.setVisibility(View.VISIBLE); - grpAddresses.setVisibility("reply_all".equals(action) ? View.VISIBLE : View.GONE); + if ("reply_all".equals(action)) + grpAddresses.setVisibility(View.VISIBLE); ibCcBcc.setVisibility(View.VISIBLE); bottom_navigation.getMenu().findItem(R.id.action_undo).setVisible(data.draft.revision > 1); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index af6b818aa4..80bcc5eaaa 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -69,8 +69,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private final static String[] RESET_QUESTIONS = new String[]{ "welcome", "crash_reports_asked", "html_always_images", "print_html_confirmed", - "identities_asked", - "inline_image_hint", "compose_reference", "send_dialog" + "identities_asked", "cc_bcc", "inline_image_hint", "compose_reference", "send_dialog" }; @Override