mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Fix time display in chat
This commit is contained in:
parent
2ffd6a10b0
commit
bda5edf105
1 changed files with 3 additions and 2 deletions
|
|
@ -14,6 +14,7 @@ import com.habitrpg.android.habitica.ui.adapter.BaseRecyclerViewAdapter
|
|||
import com.habitrpg.android.habitica.ui.adapter.DiffCallback
|
||||
import com.habitrpg.android.habitica.ui.viewHolders.ChatRecyclerMessageViewHolder
|
||||
import com.habitrpg.common.habitica.helpers.LanguageHelper
|
||||
import java.text.DateFormat
|
||||
import java.text.SimpleDateFormat
|
||||
|
||||
class ChatDiffCallback(oldList: List<BaseMainObject>, newList: List<BaseMainObject>) :
|
||||
|
|
@ -126,7 +127,7 @@ class ChatRecyclerViewAdapter(user: User?, private val isTavern: Boolean) :
|
|||
}
|
||||
|
||||
class SystemChatMessageViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
private val dateTime = java.text.SimpleDateFormat.getDateInstance(SimpleDateFormat.MEDIUM, LanguageHelper.systemLocale)
|
||||
private val dateFormatter = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, LanguageHelper.systemLocale)
|
||||
val binding = SystemChatMessageBinding.bind(itemView)
|
||||
|
||||
var onShouldExpand: (() -> Unit)? = null
|
||||
|
|
@ -144,7 +145,7 @@ class SystemChatMessageViewHolder(itemView: View) : RecyclerView.ViewHolder(item
|
|||
binding.textView.text = chatMessage?.text?.removePrefix("`")?.removeSuffix("`")
|
||||
binding.systemMessageTimestamp.text =
|
||||
chatMessage?.timestamp?.let { java.util.Date(it) }
|
||||
?.let { dateTime.format(it) }
|
||||
?.let { dateFormatter.format(it) }
|
||||
if (isExpanded) {
|
||||
binding.systemMessageTimestamp.visibility = View.VISIBLE
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue