Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75de0862 authored by narinder Rana's avatar narinder Rana
Browse files

Merge branch '5345-ghost-message' into 'main'

5345 ghost message

See merge request !67
parents 7ab11237 d48b4446
Loading
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ import android.content.res.Resources.Theme
import android.graphics.Color
import android.graphics.Typeface
import android.graphics.drawable.Drawable
import android.opengl.Visibility
import android.text.Spannable
import android.text.style.AbsoluteSizeSpan
import android.text.style.StyleSpan
@@ -46,10 +47,13 @@ class MessageListAdapter internal constructor(
    private val forwardedIcon: Drawable = theme.resolveDrawableAttribute(R.attr.messageListForwarded)
    private val answeredIcon: Drawable = theme.resolveDrawableAttribute(R.attr.messageListAnswered)
    private val forwardedAnsweredIcon: Drawable = theme.resolveDrawableAttribute(R.attr.messageListAnsweredForwarded)
    private val activeItemBackgroundColor: Int = theme.resolveColorAttribute(R.attr.messageListActiveItemBackgroundColor)
    private val selectedItemBackgroundColor: Int = theme.resolveColorAttribute(R.attr.messageListSelectedBackgroundColor)
    private val activeItemBackgroundColor: Int =
        theme.resolveColorAttribute(R.attr.messageListActiveItemBackgroundColor)
    private val selectedItemBackgroundColor: Int =
        theme.resolveColorAttribute(R.attr.messageListSelectedBackgroundColor)
    private val readItemBackgroundColor: Int = theme.resolveColorAttribute(R.attr.messageListReadItemBackgroundColor)
    private val unreadItemBackgroundColor: Int = theme.resolveColorAttribute(R.attr.messageListUnreadItemBackgroundColor)
    private val unreadItemBackgroundColor: Int =
        theme.resolveColorAttribute(R.attr.messageListUnreadItemBackgroundColor)

    var messages: List<MessageListItem> = emptyList()
        set(value) {
@@ -98,6 +102,7 @@ class MessageListAdapter internal constructor(
    override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
        val message = getItem(position)
        val view: View = convertView ?: newView(parent)

        bindView(view, context, message)

        return view
@@ -120,7 +125,10 @@ class MessageListAdapter internal constructor(
        holder.preview.setLines(max(appearance.previewLines, 0))
        appearance.fontSizes.setViewTextSize(holder.displayName, appearance.fontSizes.messageListSender)
        appearance.fontSizes.setViewTextSize(holder.preview, appearance.fontSizes.messageListPreview)
        appearance.fontSizes.setViewTextSize(holder.threadCount, appearance.fontSizes.messageListSubject) // thread count is next to subject
        appearance.fontSizes.setViewTextSize(
            holder.threadCount,
            appearance.fontSizes.messageListSubject
        ) // thread count is next to subject

        holder.flagged.isVisible = false
        holder.flagged.tag = holder
@@ -132,6 +140,14 @@ class MessageListAdapter internal constructor(
    }

    private fun bindView(view: View, context: Context, message: MessageListItem) {

        if (message.displayName.trim().toString().equals(res.getString(R.string.unknown_sender))
            && message.subject?.trim().toString().equals(res.getString(R.string.general_no_subject))
        ) {
            view.setVisibility(View.GONE)
            return
        }
        view.setVisibility(View.VISIBLE)
        val isSelected = selected.contains(message.uniqueId)
        val isActive = isActiveMessage(message)

@@ -202,6 +218,7 @@ class MessageListAdapter internal constructor(
            } else {
                holder.status.isVisible = false
            }

        }
    }

+2 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ package com.fsck.k9.fragment
import android.view.View
import android.widget.CheckBox
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import com.fsck.k9.ui.R

@@ -20,4 +21,5 @@ class MessageViewHolder(view: View) {
    val flagged: CheckBox = view.findViewById(R.id.star)
    val attachment: ImageView = view.findViewById(R.id.attachment)
    val status: ImageView = view.findViewById(R.id.status)

}
+2 −1
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
              android:layout_height="wrap_content"
              android:orientation="horizontal"
              android:layout_gravity="center_vertical"

    tools:layout_height="?android:attr/listPreferredItemHeight">

    <FrameLayout