|  |  | @ -4,9 +4,11 @@ import android.content.Context | 
			
		
	
		
		
			
				
					
					|  |  |  | import android.content.res.Resources |  |  |  | import android.content.res.Resources | 
			
		
	
		
		
			
				
					
					|  |  |  | import android.graphics.Typeface |  |  |  | import android.graphics.Typeface | 
			
		
	
		
		
			
				
					
					|  |  |  | import android.util.AttributeSet |  |  |  | import android.util.AttributeSet | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import android.util.TypedValue | 
			
		
	
		
		
			
				
					
					|  |  |  | import android.view.LayoutInflater |  |  |  | import android.view.LayoutInflater | 
			
		
	
		
		
			
				
					
					|  |  |  | import android.view.View |  |  |  | import android.view.View | 
			
		
	
		
		
			
				
					
					|  |  |  | import android.widget.LinearLayout |  |  |  | import android.widget.LinearLayout | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import androidx.core.view.isVisible | 
			
		
	
		
		
			
				
					
					|  |  |  | import androidx.recyclerview.widget.RecyclerView |  |  |  | import androidx.recyclerview.widget.RecyclerView | 
			
		
	
		
		
			
				
					
					|  |  |  | import kotlinx.android.synthetic.main.view_conversation.view.* |  |  |  | import kotlinx.android.synthetic.main.view_conversation.view.* | 
			
		
	
		
		
			
				
					
					|  |  |  | import network.loki.messenger.R |  |  |  | import network.loki.messenger.R | 
			
		
	
	
		
		
			
				
					|  |  | @ -37,13 +39,20 @@ class ConversationView : LinearLayout { | 
			
		
	
		
		
			
				
					
					|  |  |  |     fun bind(thread: ThreadRecord, isTyping: Boolean, glide: GlideRequests) { |  |  |  |     fun bind(thread: ThreadRecord, isTyping: Boolean, glide: GlideRequests) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         this.thread = thread |  |  |  |         this.thread = thread | 
			
		
	
		
		
			
				
					
					|  |  |  |         populateUserPublicKeyCacheIfNeeded(thread.threadId, context) // FIXME: This is a bad place to do this |  |  |  |         populateUserPublicKeyCacheIfNeeded(thread.threadId, context) // FIXME: This is a bad place to do this | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         val unreadCount = thread.unreadCount | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (thread.recipient.isBlocked) { |  |  |  |         if (thread.recipient.isBlocked) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             accentView.setBackgroundResource(R.color.destructive) |  |  |  |             accentView.setBackgroundResource(R.color.destructive) | 
			
		
	
		
		
			
				
					
					|  |  |  |             accentView.visibility = View.VISIBLE |  |  |  |             accentView.visibility = View.VISIBLE | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else { |  |  |  |         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |             accentView.setBackgroundResource(R.color.accent) |  |  |  |             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.glide = glide | 
			
		
	
		
		
			
				
					
					|  |  |  |         profilePictureView.update(thread.recipient, thread.threadId) |  |  |  |         profilePictureView.update(thread.recipient, thread.threadId) | 
			
		
	
		
		
			
				
					
					|  |  |  |         val senderDisplayName = getUserDisplayName(thread.recipient) ?: thread.recipient.address.toString() |  |  |  |         val senderDisplayName = getUserDisplayName(thread.recipient) ?: thread.recipient.address.toString() | 
			
		
	
	
		
		
			
				
					|  |  | @ -53,7 +62,7 @@ class ConversationView : LinearLayout { | 
			
		
	
		
		
			
				
					
					|  |  |  |         val rawSnippet = thread.getDisplayBody(context) |  |  |  |         val rawSnippet = thread.getDisplayBody(context) | 
			
		
	
		
		
			
				
					
					|  |  |  |         val snippet = highlightMentions(rawSnippet, thread.threadId, context) |  |  |  |         val snippet = highlightMentions(rawSnippet, thread.threadId, context) | 
			
		
	
		
		
			
				
					
					|  |  |  |         snippetTextView.text = snippet |  |  |  |         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 |  |  |  |         snippetTextView.visibility = if (isTyping) View.GONE else View.VISIBLE | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (isTyping) { |  |  |  |         if (isTyping) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             typingIndicatorView.startAnimation() |  |  |  |             typingIndicatorView.startAnimation() | 
			
		
	
	
		
		
			
				
					|  |  | 
 |