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

Commit 88f25829 authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

update unread message indicator

- hide unread message different background preference general_settings
- remove unread message different background messageItem logic
- add unread message green dot indicator
parent 5ef8450c
Loading
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -12,7 +12,9 @@ import android.text.style.StyleSpan
import android.view.LayoutInflater
import android.view.View
import android.view.View.GONE
import android.view.View.INVISIBLE
import android.view.View.OnClickListener
import android.view.View.VISIBLE
import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.ImageView
@@ -165,7 +167,8 @@ class MessageListAdapter internal constructor(
            if (appearance.showContactPicture && holder.contactPicture.isVisible) {
                setContactPicture(holder.contactPicture, displayAddress)
            }
            setBackgroundColor(view, isSelected, isRead, isActive)
            setBackgroundColor(view, isSelected, isActive)
            holder.unreadMessageIndicator.visibility = if (isRead) INVISIBLE else VISIBLE
            updateWithThreadCount(holder, displayThreadCount)
            val beforePreviewText = if (appearance.senderAboveSubject) subject else displayName
            holder.displayName.setText(beforePreviewText, TextView.BufferType.SPANNABLE)
@@ -242,13 +245,10 @@ class MessageListAdapter internal constructor(
        return null
    }

    private fun setBackgroundColor(view: View, selected: Boolean, read: Boolean, active: Boolean) {
        val backGroundAsReadIndicator = appearance.backGroundAsReadIndicator
    private fun setBackgroundColor(view: View, selected: Boolean, active: Boolean) {
        val backgroundColor = when {
            active -> activeItemBackgroundColor
            selected -> selectedItemBackgroundColor
            backGroundAsReadIndicator && read -> readItemBackgroundColor
            backGroundAsReadIndicator && !read -> unreadItemBackgroundColor
            else -> ContextCompat.getColor(view.context, R.color.color_default_background)
        }

+1 −0
Original line number Diff line number Diff line
@@ -20,4 +20,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)
    val unreadMessageIndicator : View = view.findViewById(R.id.unread_message_indicator)
}
+10 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">

    <size
        android:width="10dp"
        android:height="10dp" />

    <solid android:color="#44B04C" />
</shape>
 No newline at end of file
+9 −0
Original line number Diff line number Diff line
@@ -8,6 +8,15 @@
              android:layout_gravity="center_vertical"
              tools:layout_height="?android:attr/listPreferredItemHeight">

    <View
        android:id="@+id/unread_message_indicator"
        android:layout_width="10dp"
        android:layout_height="10dp"
        android:background="@drawable/ic_unread_message"
        android:layout_marginTop="15dp"
        android:layout_marginStart="12dp"
        android:visibility="invisible"/>

    <FrameLayout
        android:id="@+id/contact_picture_container"
        android:layout_width="40dp"
+1 −0
Original line number Diff line number Diff line
@@ -342,6 +342,7 @@
            <CheckBoxPreference
                android:layout="@layout/custom_preference"
                android:key="messagelist_background_as_unread_indicator"
                app:isPreferenceVisible="false"
                android:summary="@string/global_settings_background_as_unread_indicator_summary"
                android:title="@string/global_settings_background_as_unread_indicator_label" />