Skip to content

Commit dc6b74f

Browse files
committed
Add specific UI for thread when in SPAM folder
1 parent b246694 commit dc6b74f

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

app/src/main/java/com/infomaniak/mail/data/models/correspondent/Recipient.kt

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ open class Recipient : EmbeddedRealmObject, Correspondent {
7373
}
7474

7575
fun quotedDisplayName(): String = "${("$name ").ifBlank { "" }}<$email>"
76+
fun quotedEmail(): String = "<$email>"
7677

7778
override fun toString(): String = "($email -> $name)"
7879

app/src/main/java/com/infomaniak/mail/ui/main/folder/ThreadListAdapter.kt

+9
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ class ThreadListAdapter @Inject constructor(
213213
setupThreadDensityDependentUi()
214214
displayAvatar(thread)
215215

216+
displaySpamSpecificUI(thread)
217+
216218
displayFolderName(thread)
217219

218220
// This method is only useful for old Threads already stored in Realm, where they
@@ -267,6 +269,13 @@ class ThreadListAdapter @Inject constructor(
267269
updateSelectedUi(thread)
268270
}
269271

272+
private fun CardviewThreadItemBinding.displaySpamSpecificUI(thread: Thread) {
273+
if (folderRole == FolderRole.SPAM) {
274+
mail.text = thread.from.first().quotedEmail()
275+
mail.isVisible = true
276+
}
277+
}
278+
270279
private fun CardviewThreadItemBinding.displayFolderName(thread: Thread) {
271280
val isCompactMode = localSettings.threadDensity == ThreadDensity.COMPACT
272281

app/src/main/res/layout/cardview_thread_item.xml

+14-1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,19 @@
176176
app:layout_constraintTop_toTopOf="parent"
177177
tools:text="@tools:sample/full_names" />
178178

179+
<TextView
180+
android:id="@+id/mail"
181+
style="@style/BodyMedium"
182+
android:layout_width="match_parent"
183+
android:layout_height="wrap_content"
184+
android:layout_marginEnd="@dimen/marginStandardSmall"
185+
android:lines="1"
186+
android:visibility="gone"
187+
app:layout_constrainedWidth="true"
188+
app:layout_constraintTop_toBottomOf="@id/expeditor"
189+
tools:text="[email protected]"
190+
tools:visibility="visible" />
191+
179192
<com.google.android.material.card.MaterialCardView
180193
android:id="@+id/threadCountCard"
181194
style="@style/CardViewMail"
@@ -256,7 +269,7 @@
256269
android:lines="1"
257270
app:layout_constraintEnd_toStartOf="@+id/folderNameCompactMode"
258271
app:layout_constraintStart_toEndOf="@+id/iconReplyOrForwardLayout"
259-
app:layout_constraintTop_toBottomOf="@+id/expeditor"
272+
app:layout_constraintTop_toBottomOf="@+id/mail"
260273
tools:text="@tools:sample/lorem[10]" />
261274

262275
<TextView

0 commit comments

Comments
 (0)