|  |  |  | @ -12,10 +12,14 @@ import android.util.AttributeSet | 
		
	
		
			
				|  |  |  |  | import android.util.Log | 
		
	
		
			
				|  |  |  |  | import android.view.* | 
		
	
		
			
				|  |  |  |  | import android.widget.LinearLayout | 
		
	
		
			
				|  |  |  |  | import androidx.annotation.ColorRes | 
		
	
		
			
				|  |  |  |  | import androidx.annotation.DrawableRes | 
		
	
		
			
				|  |  |  |  | import androidx.core.content.ContextCompat | 
		
	
		
			
				|  |  |  |  | import androidx.core.graphics.withClip | 
		
	
		
			
				|  |  |  |  | import androidx.core.view.isVisible | 
		
	
		
			
				|  |  |  |  | import kotlinx.android.synthetic.main.view_conversation.view.* | 
		
	
		
			
				|  |  |  |  | import kotlinx.android.synthetic.main.view_visible_message.view.* | 
		
	
		
			
				|  |  |  |  | import kotlinx.android.synthetic.main.view_visible_message.view.profilePictureView | 
		
	
		
			
				|  |  |  |  | import network.loki.messenger.R | 
		
	
		
			
				|  |  |  |  | import org.session.libsession.messaging.contacts.Contact.ContactContext | 
		
	
		
			
				|  |  |  |  | import org.session.libsession.utilities.ViewUtil | 
		
	
	
		
			
				
					|  |  |  | @ -113,6 +117,17 @@ class VisibleMessageView : LinearLayout { | 
		
	
		
			
				|  |  |  |  |         // Gravity | 
		
	
		
			
				|  |  |  |  |         val gravity = if (message.isOutgoing) Gravity.RIGHT else Gravity.LEFT | 
		
	
		
			
				|  |  |  |  |         mainContainer.gravity = gravity or Gravity.BOTTOM | 
		
	
		
			
				|  |  |  |  |         // Message status indicator | 
		
	
		
			
				|  |  |  |  |         val iconID = getMessageStatusImage(message) | 
		
	
		
			
				|  |  |  |  |         if (iconID != null) { | 
		
	
		
			
				|  |  |  |  |             messageStatusImageView.setImageResource(iconID) | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |         if (message.isOutgoing) { | 
		
	
		
			
				|  |  |  |  |             val lastMessageID = DatabaseFactory.getMmsSmsDatabase(context).getLastMessageID(message.threadId) | 
		
	
		
			
				|  |  |  |  |             messageStatusImageView.isVisible = !message.isSent || message.id == lastMessageID | 
		
	
		
			
				|  |  |  |  |         } else { | 
		
	
		
			
				|  |  |  |  |             messageStatusImageView.isVisible = false | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |         // Populate content view | 
		
	
		
			
				|  |  |  |  |         messageContentView.bind(message, isStartOfMessageCluster, isEndOfMessageCluster, glide) | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
	
		
			
				
					|  |  |  | @ -144,6 +159,16 @@ class VisibleMessageView : LinearLayout { | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     private fun getMessageStatusImage(message: MessageRecord): Int? { | 
		
	
		
			
				|  |  |  |  |         when { | 
		
	
		
			
				|  |  |  |  |             !message.isOutgoing -> return null | 
		
	
		
			
				|  |  |  |  |             message.isFailed -> return R.drawable.ic_error | 
		
	
		
			
				|  |  |  |  |             message.isPending -> return R.drawable.ic_circle_dot_dot_dot | 
		
	
		
			
				|  |  |  |  |             message.isRead -> return R.drawable.ic_filled_circle_check | 
		
	
		
			
				|  |  |  |  |             else -> return R.drawable.ic_circle_check | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     private fun handleIsSelectedChanged() { | 
		
	
		
			
				|  |  |  |  |         background = if (snIsSelected) { | 
		
	
		
			
				|  |  |  |  |             ColorDrawable(context.resources.getColorWithID(R.color.message_selected, context.theme)) | 
		
	
	
		
			
				
					|  |  |  | 
 |