mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-12 10:13:39 +00:00
Add date breaks
This commit is contained in:
parent
2b21f199ea
commit
7e6cd7c86f
@ -88,7 +88,7 @@ class VisibleMessageContentView : LinearLayout {
|
||||
} else if (isEndOfMessageCluster) {
|
||||
backgroundID = if (isOutgoing) R.drawable.message_bubble_background_sent_end else R.drawable.message_bubble_background_received_end
|
||||
} else {
|
||||
backgroundID = if (isOutgoing) R.drawable.message_bubble_background_sent_middle else R.drawable.message_bubble_background_received_middle;
|
||||
backgroundID = if (isOutgoing) R.drawable.message_bubble_background_sent_middle else R.drawable.message_bubble_background_received_middle
|
||||
}
|
||||
return ResourcesCompat.getDrawable(resources, backgroundID, context.theme)!!
|
||||
}
|
||||
|
@ -7,15 +7,15 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.view.isVisible
|
||||
import kotlinx.android.synthetic.main.view_visible_message.view.*
|
||||
import network.loki.messenger.R
|
||||
import nl.komponents.kovenant.combine.Tuple8
|
||||
import org.session.libsession.messaging.contacts.Contact.ContactContext
|
||||
import org.session.libsession.utilities.ViewUtil
|
||||
import org.session.libsignal.utilities.guava.Optional
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory
|
||||
import org.thoughtcrime.securesms.database.model.MessageRecord
|
||||
import org.thoughtcrime.securesms.util.DateUtils
|
||||
import java.util.*
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
class VisibleMessageView : LinearLayout {
|
||||
@ -63,8 +63,9 @@ class VisibleMessageView : LinearLayout {
|
||||
senderNameTextView.visibility = View.GONE
|
||||
}
|
||||
// Date break
|
||||
dateBreakTextView.text = "The Ancient Past"
|
||||
dateBreakTextView.visibility = View.GONE // TODO: Set this correctly
|
||||
val showDateBreak = (previous == null || !DateUtils.isSameDay(message.timestamp, previous.timestamp))
|
||||
dateBreakTextView.isVisible = showDateBreak
|
||||
dateBreakTextView.text = if (showDateBreak) DateUtils.getRelativeDate(context, Locale.getDefault(), message.timestamp) else ""
|
||||
// Margins
|
||||
val messageContentViewLayoutParams = messageContentView.layoutParams as LinearLayout.LayoutParams
|
||||
if (isGroupThread) {
|
||||
|
@ -103,7 +103,7 @@
|
||||
<dimen name="conversation_individual_left_gutter">@dimen/large_spacing</dimen>
|
||||
<dimen name="conversation_group_left_gutter">60dp</dimen>
|
||||
<dimen name="conversation_vertical_message_spacing_default">8dp</dimen>
|
||||
<dimen name="conversation_vertical_message_spacing_collapse">1dp</dimen>
|
||||
<dimen name="conversation_vertical_message_spacing_collapse">1px</dimen>
|
||||
|
||||
<dimen name="conversation_item_avatar_size">36dp</dimen>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user