Merge pull request #6637 from thundernest/message-list-appearance
Tweak message list design (1)
This commit is contained in:
commit
aebfd33add
11 changed files with 168 additions and 296 deletions
|
@ -185,7 +185,7 @@ class MessageListAdapter internal constructor(
|
|||
listItemListener.onFooterClicked()
|
||||
}
|
||||
|
||||
private val flagClickListener = OnClickListener { view: View ->
|
||||
private val starClickListener = OnClickListener { view: View ->
|
||||
val messageListItem = getItemFromView(view) ?: return@OnClickListener
|
||||
listItemListener.onToggleMessageFlag(messageListItem)
|
||||
}
|
||||
|
@ -200,12 +200,6 @@ class MessageListAdapter internal constructor(
|
|||
setHasStableIds(true)
|
||||
}
|
||||
|
||||
private fun recipientSigil(toMe: Boolean, ccMe: Boolean) = when {
|
||||
toMe -> res.getString(R.string.messagelist_sent_to_me_sigil) + " "
|
||||
ccMe -> res.getString(R.string.messagelist_sent_cc_me_sigil) + " "
|
||||
else -> ""
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = messages.size + if (hasFooter) 1 else 0
|
||||
|
||||
override fun getItemId(position: Int): Long {
|
||||
|
@ -271,13 +265,13 @@ class MessageListAdapter internal constructor(
|
|||
appearance.fontSizes.setViewTextSize(holder.date, appearance.fontSizes.messageListDate)
|
||||
|
||||
// 1 preview line is needed even if it is set to 0, because subject is part of the same text view
|
||||
holder.preview.setLines(max(appearance.previewLines, 1))
|
||||
holder.preview.maxLines = max(appearance.previewLines, 1)
|
||||
appearance.fontSizes.setViewTextSize(holder.preview, appearance.fontSizes.messageListPreview)
|
||||
appearance.fontSizes.setViewTextSize(holder.threadCount, appearance.fontSizes.messageListSubject) // thread count is next to subject
|
||||
|
||||
holder.flagged.isVisible = appearance.stars
|
||||
holder.flagged.tag = holder
|
||||
holder.flagged.setOnClickListener(flagClickListener)
|
||||
holder.star.isVisible = appearance.stars
|
||||
holder.star.tag = holder
|
||||
holder.star.setOnClickListener(starClickListener)
|
||||
|
||||
view.tag = holder
|
||||
|
||||
|
@ -332,7 +326,7 @@ class MessageListAdapter internal constructor(
|
|||
}
|
||||
|
||||
if (appearance.stars) {
|
||||
holder.flagged.isChecked = isStarred
|
||||
holder.star.isSelected = isStarred
|
||||
}
|
||||
holder.uniqueId = uniqueId
|
||||
if (appearance.showContactPicture && holder.contactPicture.isVisible) {
|
||||
|
@ -341,16 +335,14 @@ class MessageListAdapter internal constructor(
|
|||
setBackgroundColor(holder.itemView, isSelected, isRead, isActive)
|
||||
updateWithThreadCount(holder, displayThreadCount)
|
||||
val beforePreviewText = if (appearance.senderAboveSubject) subject else displayName
|
||||
val sigil = recipientSigil(toMe, ccMe)
|
||||
val messageStringBuilder = SpannableStringBuilder(sigil)
|
||||
.append(beforePreviewText)
|
||||
val messageStringBuilder = SpannableStringBuilder(beforePreviewText)
|
||||
if (appearance.previewLines > 0) {
|
||||
val preview = getPreview(isMessageEncrypted, previewText)
|
||||
messageStringBuilder.append(" ").append(preview)
|
||||
}
|
||||
holder.preview.setText(messageStringBuilder, TextView.BufferType.SPANNABLE)
|
||||
|
||||
formatPreviewText(holder.preview, beforePreviewText, sigil, isRead)
|
||||
formatPreviewText(holder.preview, beforePreviewText, isRead)
|
||||
|
||||
holder.subject.typeface = Typeface.create(holder.subject.typeface, maybeBoldTypeface)
|
||||
if (appearance.senderAboveSubject) {
|
||||
|
@ -376,15 +368,10 @@ class MessageListAdapter internal constructor(
|
|||
holder.text.text = footerText
|
||||
}
|
||||
|
||||
private fun formatPreviewText(
|
||||
preview: TextView,
|
||||
beforePreviewText: CharSequence,
|
||||
sigil: String,
|
||||
messageRead: Boolean
|
||||
) {
|
||||
private fun formatPreviewText(preview: TextView, beforePreviewText: CharSequence, messageRead: Boolean) {
|
||||
val previewText = preview.text as Spannable
|
||||
|
||||
val beforePreviewLength = beforePreviewText.length + sigil.length
|
||||
val beforePreviewLength = beforePreviewText.length
|
||||
addBeforePreviewSpan(previewText, beforePreviewLength, messageRead)
|
||||
|
||||
// Set span (color) for preview message
|
||||
|
|
|
@ -332,9 +332,6 @@ class MessageListFragment :
|
|||
recyclerView.setPadding(0)
|
||||
}
|
||||
|
||||
val itemDecoration = MessageListItemDecoration(requireContext())
|
||||
recyclerView.addItemDecoration(itemDecoration)
|
||||
|
||||
recyclerView.layoutManager = LinearLayoutManager(requireContext())
|
||||
recyclerView.itemAnimator = MessageListItemAnimator()
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@ data class MessageListItem(
|
|||
val internalDate: Long,
|
||||
val displayName: CharSequence,
|
||||
val displayAddress: Address?,
|
||||
val toMe: Boolean,
|
||||
val ccMe: Boolean,
|
||||
val previewText: String,
|
||||
val isMessageEncrypted: Boolean,
|
||||
val isRead: Boolean,
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
package com.fsck.k9.ui.messagelist
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Rect
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.view.View
|
||||
import androidx.core.graphics.withSave
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.RecyclerView.ItemDecoration
|
||||
import com.fsck.k9.ui.resolveDrawableAttribute
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/**
|
||||
* An [ItemDecoration] that uses the alpha and visibility values of a view when drawing the divider.
|
||||
*
|
||||
* Based on [androidx.recyclerview.widget.DividerItemDecoration].
|
||||
*/
|
||||
class MessageListItemDecoration(context: Context) : ItemDecoration() {
|
||||
private val divider: Drawable = context.theme.resolveDrawableAttribute(android.R.attr.listDivider)
|
||||
private val bounds = Rect()
|
||||
|
||||
override fun onDraw(canvas: Canvas, parent: RecyclerView, state: RecyclerView.State) {
|
||||
if (parent.layoutManager == null) return
|
||||
|
||||
canvas.withSave {
|
||||
val childCount = parent.childCount
|
||||
for (i in 0 until childCount) {
|
||||
val child = parent.getChildAt(i)
|
||||
if (!child.isVisible) {
|
||||
continue
|
||||
}
|
||||
|
||||
parent.getDecoratedBoundsWithMargins(child, bounds)
|
||||
|
||||
val left = 0
|
||||
val right = parent.width
|
||||
val bottom = bounds.bottom + child.translationY.roundToInt()
|
||||
val top = bottom - divider.intrinsicHeight
|
||||
|
||||
divider.setBounds(left, top, right, bottom)
|
||||
divider.alpha = (child.alpha * 255).toInt()
|
||||
divider.draw(canvas)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
|
||||
outRect.set(0, 0, 0, divider.intrinsicHeight)
|
||||
}
|
||||
}
|
|
@ -15,8 +15,6 @@ class MessageListItemMapper(
|
|||
override fun map(message: MessageDetailsAccessor): MessageListItem {
|
||||
val fromAddresses = message.fromAddresses
|
||||
val toAddresses = message.toAddresses
|
||||
val toMe = messageHelper.toMe(account, toAddresses)
|
||||
val ccMe = messageHelper.toMe(account, message.ccAddresses)
|
||||
val previewResult = message.preview
|
||||
val isMessageEncrypted = previewResult.previewType == PreviewType.ENCRYPTED
|
||||
val previewText = if (previewResult.isPreviewTextAvailable) previewResult.previewText else ""
|
||||
|
@ -37,8 +35,6 @@ class MessageListItemMapper(
|
|||
message.internalDate,
|
||||
displayName,
|
||||
displayAddress,
|
||||
toMe,
|
||||
ccMe,
|
||||
previewText,
|
||||
isMessageEncrypted,
|
||||
message.isRead,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.fsck.k9.ui.messagelist
|
||||
|
||||
import android.view.View
|
||||
import android.widget.CheckBox
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder
|
||||
|
@ -19,7 +18,7 @@ class MessageViewHolder(view: View) : MessageListViewHolder(view) {
|
|||
val date: TextView = view.findViewById(R.id.date)
|
||||
val chip: ImageView = view.findViewById(R.id.account_color_chip)
|
||||
val threadCount: TextView = view.findViewById(R.id.thread_count)
|
||||
val flagged: CheckBox = view.findViewById(R.id.star)
|
||||
val star: ImageView = view.findViewById(R.id.star)
|
||||
val attachment: ImageView = view.findViewById(R.id.attachment)
|
||||
val status: ImageView = view.findViewById(R.id.status)
|
||||
}
|
||||
|
|
|
@ -1,24 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="center_vertical"
|
||||
tools:layout_height="?android:attr/listPreferredItemHeight"
|
||||
>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:foreground="?attr/selectableItemBackground">
|
||||
|
||||
<Space
|
||||
android:id="@+id/margin_start"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/contact_picture_container"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="3dp">
|
||||
android:padding="16dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/selected"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/ic_check_circle_large" />
|
||||
|
||||
<de.hdodenhof.circleimageview.CircleImageView
|
||||
android:id="@+id/contact_picture"
|
||||
|
@ -27,145 +36,139 @@
|
|||
android:background="@android:color/transparent"
|
||||
tools:src="@drawable/ic_contact_picture" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/selected"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:srcCompat="@drawable/ic_check_circle_large"
|
||||
android:visibility="gone"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/list_item_inner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:paddingTop="5dip"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingBottom="6dp">
|
||||
<TextView
|
||||
android:id="@+id/preview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:bufferType="spannable"
|
||||
android:singleLine="false"
|
||||
android:textAppearance="@style/TextAppearance.K9.Small"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/divider"
|
||||
app:layout_constraintEnd_toStartOf="@+id/star"
|
||||
app:layout_constraintStart_toEndOf="@+id/barrier_start"
|
||||
app:layout_constraintTop_toTopOf="@+id/barrier_first_line_bottom"
|
||||
app:layout_constraintVertical_bias="0.0"
|
||||
app:layout_goneMarginEnd="16dp"
|
||||
tools:text="Message preview" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toStartOf="@+id/star"
|
||||
android:layout_marginStart="1dp"
|
||||
android:layout_marginEnd="3dp"
|
||||
android:bufferType="spannable"
|
||||
android:layout_below="@+id/subject_wrapper"
|
||||
android:singleLine="false"
|
||||
android:textAppearance="@style/TextAppearance.K9.Small"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:longClickable="false"
|
||||
android:layout_alignWithParentIfMissing="false"
|
||||
android:gravity="top"
|
||||
android:layout_alignParentBottom="false"
|
||||
tools:text="Message preview"/>
|
||||
<ImageView
|
||||
android:id="@+id/account_color_chip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="4dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/subject"
|
||||
app:layout_constraintStart_toEndOf="@+id/barrier_start"
|
||||
app:layout_constraintTop_toTopOf="@+id/subject"
|
||||
app:srcCompat="@drawable/ic_account_color"
|
||||
tools:tint="#FF1976D2" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/subject_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toStartOf="@+id/attachment">
|
||||
<ImageView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toEndOf="@+id/account_color_chip"
|
||||
app:layout_constraintTop_toTopOf="@+id/top_guideline"
|
||||
app:srcCompat="?attr/messageListAnswered"
|
||||
tools:src="@drawable/ic_messagelist_answered" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/account_color_chip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="4dp"
|
||||
app:srcCompat="@drawable/ic_account_color"
|
||||
tools:tint="#FF1976D2"/>
|
||||
<TextView
|
||||
android:id="@+id/subject"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.K9.MediumSmall"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintEnd_toStartOf="@+id/thread_count"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toEndOf="@+id/status"
|
||||
app:layout_constraintTop_toTopOf="@+id/top_guideline"
|
||||
tools:text="Subject" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:srcCompat="?attr/messageListAnswered"
|
||||
tools:src="@drawable/ic_messagelist_answered"/>
|
||||
<TextView
|
||||
android:id="@+id/thread_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:focusable="false"
|
||||
android:textAppearance="@style/TextAppearance.K9.Small"
|
||||
android:textColor="?attr/messageListThreadCountTextColor"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/subject"
|
||||
app:layout_constraintEnd_toStartOf="@+id/attachment"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toEndOf="@+id/subject"
|
||||
app:layout_goneMarginEnd="8dp"
|
||||
tools:text="3" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subject"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.7"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:layout_marginStart="1dp"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.K9.MediumSmall"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
tools:text="Subject"
|
||||
/>
|
||||
<ImageView
|
||||
android:id="@+id/attachment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
app:layout_constraintEnd_toStartOf="@+id/date"
|
||||
app:layout_constraintTop_toTopOf="@+id/top_guideline"
|
||||
app:srcCompat="?attr/messageListAttachment" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/thread_count"
|
||||
android:textAppearance="@style/TextAppearance.K9.MediumSmall"
|
||||
android:textColor="?attr/messageListThreadCountForegroundColor"
|
||||
android:background="?attr/messageListThreadCountBackground"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="3dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:paddingRight="4dip"
|
||||
android:paddingBottom="1dip"
|
||||
android:paddingLeft="4dip"
|
||||
android:focusable="false"
|
||||
tools:text="3"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.K9.Small"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/subject"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
tools:text="Oct 27" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/attachment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/date"
|
||||
android:layout_alignBottom="@+id/date"
|
||||
app:srcCompat="?attr/messageListAttachment"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_toStartOf="@+id/date" />
|
||||
<ImageView
|
||||
android:id="@+id/star"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="-8dp"
|
||||
android:paddingHorizontal="12dp"
|
||||
android:src="@drawable/btn_select_star"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/divider"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/date"
|
||||
app:layout_constraintVertical_bias="1.0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/subject_wrapper"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.K9.Small"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
tools:text="Oct 27"/>
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/top_guideline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_begin="12dp" />
|
||||
|
||||
<!-- TODO: Replace with an ImageView. MaterialCheckBox comes with a lot of styling that we don't want. -->
|
||||
<CheckBox
|
||||
android:id="@+id/star"
|
||||
style="@style/MessageStarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_below="@+id/date"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingTop="5dip"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="4dp"
|
||||
android:focusable="false"
|
||||
android:visibility="visible"
|
||||
android:gravity="center_vertical"
|
||||
tools:text="​"/>
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/barrier_first_line_bottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="subject,date,thread_count,status,attachment,account_color_chip" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/barrier_start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="end"
|
||||
app:constraint_referenced_ids="margin_start,contact_picture_container" />
|
||||
|
||||
</RelativeLayout>
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/contact_picture_container" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
|
@ -75,8 +75,7 @@
|
|||
<attr name="messageListRegularItemBackgroundColor" format="reference|color"/>
|
||||
<attr name="messageListReadItemBackgroundColor" format="reference|color"/>
|
||||
<attr name="messageListUnreadItemBackgroundColor" format="reference|color"/>
|
||||
<attr name="messageListThreadCountForegroundColor" format="reference|color"/>
|
||||
<attr name="messageListThreadCountBackground" format="reference|color"/>
|
||||
<attr name="messageListThreadCountTextColor" format="reference|color"/>
|
||||
<attr name="messageListActiveItemBackgroundColor" format="reference|color"/>
|
||||
<attr name="messageListActiveItemBackgroundAlphaFraction" format="fraction"/>
|
||||
<attr name="messageListActiveItemBackgroundAlphaBackground" format="reference|color"/>
|
||||
|
|
|
@ -933,9 +933,6 @@ Please submit bug reports, contribute new features and ask questions at
|
|||
|
||||
<string name="dialog_attachment_progress_title">Downloading attachment</string>
|
||||
|
||||
<string name="messagelist_sent_to_me_sigil">»</string>
|
||||
<string name="messagelist_sent_cc_me_sigil">›</string>
|
||||
|
||||
<string name="settings_list_backup_category">Backup</string>
|
||||
<string name="settings_list_miscellaneous_category">Miscellaneous</string>
|
||||
|
||||
|
|
|
@ -97,8 +97,7 @@
|
|||
<item name="messageListRegularItemBackgroundColor">?android:attr/windowBackground</item>
|
||||
<item name="messageListReadItemBackgroundColor">#ffd8d8d8</item>
|
||||
<item name="messageListUnreadItemBackgroundColor">?attr/messageListRegularItemBackgroundColor</item>
|
||||
<item name="messageListThreadCountForegroundColor">?android:attr/colorBackground</item>
|
||||
<item name="messageListThreadCountBackground">@drawable/thread_count_box_light</item>
|
||||
<item name="messageListThreadCountTextColor">?android:attr/textColorSecondary</item>
|
||||
<item name="messageListActiveItemBackgroundColor">?attr/colorSecondaryVariant</item>
|
||||
<item name="messageListActiveItemBackgroundAlphaFraction">60%</item>
|
||||
<item name="messageListActiveItemBackgroundAlphaBackground">?attr/colorSurface</item>
|
||||
|
@ -259,8 +258,7 @@
|
|||
<item name="messageListRegularItemBackgroundColor">?android:attr/windowBackground</item>
|
||||
<item name="messageListReadItemBackgroundColor">?attr/messageListRegularItemBackgroundColor</item>
|
||||
<item name="messageListUnreadItemBackgroundColor">#ff505050</item>
|
||||
<item name="messageListThreadCountForegroundColor">?android:attr/colorBackground</item>
|
||||
<item name="messageListThreadCountBackground">@drawable/thread_count_box_dark</item>
|
||||
<item name="messageListThreadCountTextColor">?android:attr/textColorSecondary</item>
|
||||
<item name="messageListActiveItemBackgroundColor">?attr/colorSecondaryVariant</item>
|
||||
<item name="messageListActiveItemBackgroundAlphaFraction">50%</item>
|
||||
<item name="messageListActiveItemBackgroundAlphaBackground">?attr/colorSurface</item>
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.text.style.AbsoluteSizeSpan
|
|||
import android.view.ContextThemeWrapper
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.CheckBox
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
@ -27,7 +26,6 @@ import org.junit.Assert.assertEquals
|
|||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
import org.mockito.kotlin.mock
|
||||
import org.robolectric.Robolectric
|
||||
|
@ -63,7 +61,7 @@ class MessageListAdapterTest : RobolectricTest() {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun withoutStars_shouldHideStarCheckBox() {
|
||||
fun withoutStars_shouldHideStarView() {
|
||||
val adapter = createAdapter(stars = false)
|
||||
|
||||
val view = adapter.createAndBindView()
|
||||
|
@ -72,7 +70,7 @@ class MessageListAdapterTest : RobolectricTest() {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun withStars_shouldShowStarCheckBox() {
|
||||
fun withStars_shouldShowStarView() {
|
||||
val adapter = createAdapter(stars = true)
|
||||
|
||||
val view = adapter.createAndBindView()
|
||||
|
@ -81,23 +79,23 @@ class MessageListAdapterTest : RobolectricTest() {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun withStarsAndStarredMessage_shouldCheckStarCheckBox() {
|
||||
fun withStarsAndStarredMessage_shouldSetStarViewToSelected() {
|
||||
val adapter = createAdapter(stars = true)
|
||||
val messageListItem = createMessageListItem(isStarred = true)
|
||||
|
||||
val view = adapter.createAndBindView(messageListItem)
|
||||
|
||||
assertTrue(view.starView.isChecked)
|
||||
assertTrue(view.starView.isSelected)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun withStarsAndUnstarredMessage_shouldNotCheckStarCheckBox() {
|
||||
fun withStarsAndUnstarredMessage_shouldNotSetStarViewToSelected() {
|
||||
val adapter = createAdapter(stars = true)
|
||||
val messageListItem = createMessageListItem(isStarred = false)
|
||||
|
||||
val view = adapter.createAndBindView(messageListItem)
|
||||
|
||||
assertFalse(view.starView.isChecked)
|
||||
assertFalse(view.starView.isSelected)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -219,48 +217,6 @@ class MessageListAdapterTest : RobolectricTest() {
|
|||
assertTrue(view.firstLineView.containsNoSubjectIndicator())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Currently failing. See issue #4152.")
|
||||
fun withSenderAboveSubjectAndMessageToMe_shouldDisplayIndicatorInFirstLine() {
|
||||
val adapter = createAdapter(senderAboveSubject = true)
|
||||
val messageListItem = createMessageListItem(toMe = true)
|
||||
|
||||
val view = adapter.createAndBindView(messageListItem)
|
||||
|
||||
assertTrue(view.firstLineView.containsToMeIndicator())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Currently failing. See issue #4152.")
|
||||
fun withSenderAboveSubjectAndMessageCcMe_shouldDisplayIndicatorInFirstLine() {
|
||||
val adapter = createAdapter(senderAboveSubject = true)
|
||||
val messageListItem = createMessageListItem(ccMe = true)
|
||||
|
||||
val view = adapter.createAndBindView(messageListItem)
|
||||
|
||||
assertTrue(view.firstLineView.containsCcMeIndicator())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun withoutSenderAboveSubjectAndMessageToMe_shouldDisplayIndicatorInSecondLine() {
|
||||
val adapter = createAdapter(senderAboveSubject = false)
|
||||
val messageListItem = createMessageListItem(toMe = true)
|
||||
|
||||
val view = adapter.createAndBindView(messageListItem)
|
||||
|
||||
assertTrue(view.secondLineView.containsToMeIndicator())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun withoutSenderAboveSubjectAndMessageCcMe_shouldDisplayIndicatorInSecondLine() {
|
||||
val adapter = createAdapter(senderAboveSubject = false)
|
||||
val messageListItem = createMessageListItem(ccMe = true)
|
||||
|
||||
val view = adapter.createAndBindView(messageListItem)
|
||||
|
||||
assertTrue(view.secondLineView.containsCcMeIndicator())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun withoutAttachments_shouldHideAttachmentCountView() {
|
||||
val adapter = createAdapter()
|
||||
|
@ -473,8 +429,6 @@ class MessageListAdapterTest : RobolectricTest() {
|
|||
internalDate: Long = 0L,
|
||||
displayName: CharSequence = "irrelevant",
|
||||
displayAddress: Address? = Address.parse("irrelevant@domain.example").first(),
|
||||
toMe: Boolean = false,
|
||||
ccMe: Boolean = false,
|
||||
previewText: String = "irrelevant",
|
||||
isMessageEncrypted: Boolean = false,
|
||||
isRead: Boolean = false,
|
||||
|
@ -496,8 +450,6 @@ class MessageListAdapterTest : RobolectricTest() {
|
|||
internalDate,
|
||||
displayName,
|
||||
displayAddress,
|
||||
toMe,
|
||||
ccMe,
|
||||
previewText,
|
||||
isMessageEncrypted,
|
||||
isRead,
|
||||
|
@ -523,7 +475,7 @@ class MessageListAdapterTest : RobolectricTest() {
|
|||
fun secondLine(senderOrSubject: String, preview: String) = "$senderOrSubject $preview"
|
||||
|
||||
val View.accountChipView: View get() = findViewById(R.id.account_color_chip)
|
||||
val View.starView: CheckBox get() = findViewById(R.id.star)
|
||||
val View.starView: View get() = findViewById(R.id.star)
|
||||
val View.contactPictureContainerView: View get() = findViewById(R.id.contact_picture_container)
|
||||
val View.threadCountView: TextView get() = findViewById(R.id.thread_count)
|
||||
val View.firstLineView: TextView get() = findViewById(R.id.subject)
|
||||
|
@ -531,8 +483,6 @@ class MessageListAdapterTest : RobolectricTest() {
|
|||
val View.attachmentCountView: View get() = findViewById(R.id.attachment)
|
||||
val View.dateView: TextView get() = findViewById(R.id.date)
|
||||
|
||||
fun TextView.containsToMeIndicator() = textString.startsWith("»")
|
||||
fun TextView.containsCcMeIndicator() = textString.startsWith("›")
|
||||
fun TextView.containsNoSubjectIndicator() = textString.contains(context.getString(R.string.general_no_subject))
|
||||
|
||||
fun TextView.getFirstAbsoluteSizeSpanValueOrNull(): Int? {
|
||||
|
|
Loading…
Reference in a new issue