diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index 41abd31776..0b5d99be70 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -5,11 +5,13 @@ import android.animation.ValueAnimator import android.content.res.Resources import android.database.Cursor import android.graphics.Rect +import android.graphics.Typeface import android.os.Bundle import android.util.Log import android.util.TypedValue import android.view.* import android.widget.RelativeLayout +import androidx.core.view.isVisible import androidx.loader.app.LoaderManager import androidx.loader.content.Loader import androidx.recyclerview.widget.LinearLayoutManager @@ -18,6 +20,7 @@ import kotlinx.android.synthetic.main.activity_conversation_v2.* import kotlinx.android.synthetic.main.activity_conversation_v2.view.* import kotlinx.android.synthetic.main.activity_conversation_v2_action_bar.* import kotlinx.android.synthetic.main.activity_home.* +import kotlinx.android.synthetic.main.view_conversation.view.* import kotlinx.android.synthetic.main.view_input_bar.view.* import kotlinx.android.synthetic.main.view_input_bar_recording.* import kotlinx.android.synthetic.main.view_input_bar_recording.view.* @@ -331,6 +334,8 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe unreadCountTextView.text = formattedUnreadCount val textSize = if (unreadCount < 100) 12.0f else 9.0f unreadCountTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize) + unreadCountTextView.setTypeface(Typeface.DEFAULT, if (unreadCount < 100) Typeface.BOLD else Typeface.NORMAL) + unreadCountIndicator.isVisible = (unreadCount != 0) } // endregion diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationRecyclerView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationRecyclerView.kt index 3bffcacc0e..7d8957a065 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationRecyclerView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationRecyclerView.kt @@ -34,8 +34,6 @@ class ConversationRecyclerView : RecyclerView { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { bottomOffset += dy // FIXME: Not sure this is fully accurate, but it seems close enough - val layoutManager = recyclerView.layoutManager as LinearLayoutManager - Log.d("Test", "${layoutManager.findFirstVisibleItemPosition()}") delegate?.handleConversationRecyclerViewBottomOffsetChanged(abs(bottomOffset)) } }) diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/views/ConversationView.kt b/app/src/main/java/org/thoughtcrime/securesms/loki/views/ConversationView.kt index 5fa8967d95..cff2096de7 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/views/ConversationView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/loki/views/ConversationView.kt @@ -4,9 +4,11 @@ import android.content.Context import android.content.res.Resources import android.graphics.Typeface import android.util.AttributeSet +import android.util.TypedValue import android.view.LayoutInflater import android.view.View import android.widget.LinearLayout +import androidx.core.view.isVisible import androidx.recyclerview.widget.RecyclerView import kotlinx.android.synthetic.main.view_conversation.view.* import network.loki.messenger.R @@ -37,13 +39,20 @@ class ConversationView : LinearLayout { fun bind(thread: ThreadRecord, isTyping: Boolean, glide: GlideRequests) { this.thread = thread populateUserPublicKeyCacheIfNeeded(thread.threadId, context) // FIXME: This is a bad place to do this + val unreadCount = thread.unreadCount if (thread.recipient.isBlocked) { accentView.setBackgroundResource(R.color.destructive) accentView.visibility = View.VISIBLE } else { accentView.setBackgroundResource(R.color.accent) - accentView.visibility = if (thread.unreadCount > 0) View.VISIBLE else View.INVISIBLE + accentView.visibility = if (unreadCount > 0) View.VISIBLE else View.INVISIBLE } + val formattedUnreadCount = if (unreadCount < 100) unreadCount.toString() else "99+" + unreadCountTextView.text = formattedUnreadCount + val textSize = if (unreadCount < 100) 12.0f else 9.0f + unreadCountTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize) + unreadCountTextView.setTypeface(Typeface.DEFAULT, if (unreadCount < 100) Typeface.BOLD else Typeface.NORMAL) + unreadCountIndicator.isVisible = (unreadCount != 0) profilePictureView.glide = glide profilePictureView.update(thread.recipient, thread.threadId) val senderDisplayName = getUserDisplayName(thread.recipient) ?: thread.recipient.address.toString() @@ -53,7 +62,7 @@ class ConversationView : LinearLayout { val rawSnippet = thread.getDisplayBody(context) val snippet = highlightMentions(rawSnippet, thread.threadId, context) snippetTextView.text = snippet - snippetTextView.typeface = if (thread.unreadCount > 0) Typeface.DEFAULT_BOLD else Typeface.DEFAULT + snippetTextView.typeface = if (unreadCount > 0) Typeface.DEFAULT_BOLD else Typeface.DEFAULT snippetTextView.visibility = if (isTyping) View.GONE else View.VISIBLE if (isTyping) { typingIndicatorView.startAnimation() diff --git a/app/src/main/res/layout/activity_conversation_v2.xml b/app/src/main/res/layout/activity_conversation_v2.xml index db65017001..a66dace7dd 100644 --- a/app/src/main/res/layout/activity_conversation_v2.xml +++ b/app/src/main/res/layout/activity_conversation_v2.xml @@ -98,6 +98,7 @@ - + android:orientation="horizontal" + android:gravity="center_vertical"> + + + + + + + + + + #000000 #171717 #99FFFFFF - #1F1F1F + #303030 #5ff8b0