From c82df2b4544d76bb42e008ae7295601f4772e6fd Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 9 Mar 2019 10:02:17 +0000 Subject: [PATCH] Revised addresses section --- .../eu/faircode/email/AdapterMessage.java | 141 ++++++---- app/src/main/res/layout/include_addresses.xml | 248 ++++++++++++++++ .../main/res/layout/item_message_compact.xml | 263 +---------------- .../main/res/layout/item_message_normal.xml | 266 +----------------- 4 files changed, 355 insertions(+), 563 deletions(-) create mode 100644 app/src/main/res/layout/include_addresses.xml diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 267f7a0d2a..462548a8e2 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -200,10 +200,21 @@ public class AdapterMessage extends RecyclerView.Adapter 0); - boolean channel = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O); - grpAddress.setVisibility(show_addresses ? View.VISIBLE : View.GONE); + boolean hasFrom = (message.from != null && message.from.length > 0); + boolean hasChannel = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O); + ivSearchContact.setVisibility(show_addresses && search && BuildConfig.DEBUG ? View.VISIBLE : View.GONE); - ivNotifyContact.setVisibility(show_addresses && channel && from ? View.VISIBLE : View.GONE); - ivAddContact.setVisibility(show_addresses && contacts && from ? View.VISIBLE : View.GONE); + ivNotifyContact.setVisibility(show_addresses && hasChannel && hasFrom ? View.VISIBLE : View.GONE); + ivAddContact.setVisibility(show_addresses && contacts && hasFrom ? View.VISIBLE : View.GONE); grpHeaders.setVisibility(show_headers ? View.VISIBLE : View.GONE); if (show_headers && message.headers == null) { @@ -783,35 +798,65 @@ public class AdapterMessage extends RecyclerView.Adapter 0 ? View.VISIBLE : View.GONE); tvKeywords.setText(TextUtils.join(" ", message.keywords)); - tvKeywords.setVisibility(message.keywords.length > 0 ? View.VISIBLE : View.GONE); // Headers if (show_headers && message.headers != null) { diff --git a/app/src/main/res/layout/include_addresses.xml b/app/src/main/res/layout/include_addresses.xml new file mode 100644 index 0000000000..364637051e --- /dev/null +++ b/app/src/main/res/layout/include_addresses.xml @@ -0,0 +1,248 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_message_compact.xml b/app/src/main/res/layout/item_message_compact.xml index c648a10a7e..a23f45d00b 100644 --- a/app/src/main/res/layout/item_message_compact.xml +++ b/app/src/main/res/layout/item_message_compact.xml @@ -338,258 +338,15 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/vSeparatorAddress" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + app:layout_constraintTop_toBottomOf="@id/ivExpanderAddress" /> + app:layout_constraintTop_toBottomOf="@id/inAddresses" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + app:layout_constraintTop_toBottomOf="@id/ivExpanderAddress" /> + app:layout_constraintTop_toBottomOf="@id/inAddresses" /> - -