diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/Note.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/Note.kt index 4b4818325..6c56d12f4 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/Note.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/Note.kt @@ -87,7 +87,7 @@ fun NoteCompose(baseNote: Note, modifier: Modifier = Modifier, isInnerNote: Bool if (note.event !is RepostEvent) { Text( - " " + timeAgo(note.event?.createdAt), + timeAgo(note.event?.createdAt), color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) ) } else { diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/TimeAgoFormatter.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/TimeAgoFormatter.kt index ed641900b..4fab1e123 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/TimeAgoFormatter.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/TimeAgoFormatter.kt @@ -14,5 +14,24 @@ fun timeAgo(mills: Long?): String { if (humanReadable.startsWith("In") || humanReadable.startsWith("0")) { humanReadable = "now"; } + + return " • " + humanReadable + .replace(" hr. ago", "h") + .replace(" min. ago", "m") +} + +fun timeAgoLong(mills: Long?): String { + if (mills == null) return " " + + var humanReadable = DateUtils.getRelativeTimeSpanString( + mills * 1000, + System.currentTimeMillis(), + DateUtils.MINUTE_IN_MILLIS, + DateUtils.FORMAT_SHOW_TIME + ).toString() + if (humanReadable.startsWith("In") || humanReadable.startsWith("0")) { + humanReadable = "now"; + } + return humanReadable } \ No newline at end of file diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/ThreadFeedView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/ThreadFeedView.kt index 4d00dd8dd..f75898db8 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/ThreadFeedView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/ThreadFeedView.kt @@ -58,6 +58,7 @@ import com.vitorpamplona.amethyst.ui.note.NoteCompose import com.vitorpamplona.amethyst.ui.note.ReactionsRowState import com.vitorpamplona.amethyst.ui.note.UserDisplay import com.vitorpamplona.amethyst.ui.note.timeAgo +import com.vitorpamplona.amethyst.ui.note.timeAgoLong import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import kotlinx.coroutines.launch @@ -201,7 +202,7 @@ fun NoteMaster(baseNote: Note, accountViewModel: AccountViewModel, navController Row(verticalAlignment = Alignment.CenterVertically) { Text( - timeAgo(note.event?.createdAt), + timeAgoLong(note.event?.createdAt), color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f) ) }