From 73aa80d900cbdfa2ed05e9ba8f0f96ebaff7664a Mon Sep 17 00:00:00 2001 From: X-Ryl669 Date: Wed, 28 Nov 2018 19:15:11 +0100 Subject: [PATCH] feat: better layout for the message list This is to close #8 issue. The new interface is much more "material" and ergonomic. The sender is displayed (either compact or with full address) below. Then, a quick & small email summary is shown. The thread message count is only displayed if there is more than a single message. I'm using light font here, and the same color for both unread & read messages. Unread messages are using bold font. --- .../org/dystopia/email/AdapterMessage.java | 53 +++++++++---- .../main/res/layout/item_message_compact.xml | 60 ++++++++------ .../main/res/layout/item_message_normal.xml | 79 +++++++++++-------- 3 files changed, 122 insertions(+), 70 deletions(-) diff --git a/app/src/main/java/org/dystopia/email/AdapterMessage.java b/app/src/main/java/org/dystopia/email/AdapterMessage.java index 96fd5995..a1492f39 100644 --- a/app/src/main/java/org/dystopia/email/AdapterMessage.java +++ b/app/src/main/java/org/dystopia/email/AdapterMessage.java @@ -97,6 +97,9 @@ import java.util.List; import java.util.Locale; import javax.mail.Address; import javax.mail.internet.InternetAddress; + +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; import org.xml.sax.XMLReader; public class AdapterMessage extends PagedListAdapter { @@ -134,6 +137,7 @@ public class AdapterMessage extends PagedListAdapter 0 ? View.VISIBLE : View.GONE); tvSubject.setText(message.subject); @@ -336,25 +342,41 @@ public class AdapterMessage extends PagedListAdapter 0 ? R.attr.colorUnread : android.R.attr.textColorSecondary); + int colorUnseen = Helper.resolveColor(context, R.attr.colorUnread); + tvSubject.setTextColor(colorUnseen); tvFrom.setTextColor(colorUnseen); tvTime.setTextColor(colorUnseen); + tvSummary.setTextColor(Helper.resolveColor(context, android.R.attr.textColorSecondary)); grpExpanded.setVisibility( viewType == ViewType.THREAD && show_expanded ? View.VISIBLE : View.GONE); @@ -711,6 +733,7 @@ public class AdapterMessage extends PagedListAdapter @@ -65,10 +66,11 @@ android:layout_marginStart="6dp" android:layout_marginEnd="20dp" android:ellipsize="end" + android:fontFamily="sans-serif-light" android:maxLines="1" android:text="From" android:textAppearance="@style/TextAppearance.AppCompat.Medium" - app:layout_constraintEnd_toStartOf="@+id/tvSize" + app:layout_constraintEnd_toStartOf="@id/tvTime" app:layout_constraintStart_toEndOf="@id/ivAvatar" app:layout_constraintTop_toBottomOf="@id/paddingTop" /> @@ -80,7 +82,6 @@ android:maxLines="1" android:text="Time" android:textAppearance="@style/TextAppearance.AppCompat.Small" - app:layout_constraintBottom_toBottomOf="@id/tvFrom" app:layout_constraintEnd_toStartOf="@+id/ivFlagged" app:layout_constraintTop_toTopOf="@id/tvFrom" /> @@ -110,13 +111,14 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="6dp" - android:layout_marginEnd="6dp" android:ellipsize="end" + android:fontFamily="sans-serif-light" android:maxLines="1" + android:minLines="1" android:text="Subject" android:textAppearance="@style/TextAppearance.AppCompat.Small" - app:layout_constraintStart_toEndOf="@id/ivAttachments" app:layout_constraintEnd_toStartOf="@id/paddingEnd" + app:layout_constraintStart_toEndOf="@id/ivAttachments" app:layout_constraintTop_toBottomOf="@id/tvFrom" /> + app:layout_constraintTop_toBottomOf="@id/tvSummary" /> + app:layout_constraintTop_toBottomOf="@id/tvSummary" /> + app:layout_constraintEnd_toStartOf="@id/ivThread" + app:layout_constraintTop_toTopOf="@+id/tvTime" /> + app:layout_constraintEnd_toStartOf="@id/tvTime" + app:layout_constraintTop_toTopOf="@id/tvTime" /> + app:layout_constraintEnd_toEndOf="@id/paddingEnd" + app:layout_constraintEnd_toStartOf="@+id/paddingEnd" + app:layout_constraintTop_toBottomOf="@id/tvSummary" /> + + @@ -56,6 +57,21 @@ app:layout_constraintStart_toEndOf="@id/paddingStart" app:layout_constraintTop_toTopOf="@+id/tvFrom" /> + + - - + app:layout_constraintTop_toBottomOf="@id/tvSummary" /> + app:layout_constraintTop_toBottomOf="@id/tvSummary" /> + app:layout_constraintStart_toEndOf="@id/tvFolder" + app:layout_constraintTop_toTopOf="@id/tvFolder" /> + app:layout_constraintTop_toTopOf="@id/tvFolder" /> + +