This reverts commit 5174c00558.
closes #4145
This commit is contained in:
parent
8a39fc643c
commit
7fef19efc6
49 changed files with 528 additions and 1554 deletions
|
|
@ -39,43 +39,44 @@ fun getRelativeTimeSpanString(context: Context, then: Long, now: Long): String {
|
|||
future = true
|
||||
span = -span
|
||||
}
|
||||
val format = if (span < MINUTE_IN_MILLIS) {
|
||||
val format: Int
|
||||
if (span < MINUTE_IN_MILLIS) {
|
||||
span /= SECOND_IN_MILLIS
|
||||
if (future) {
|
||||
R.plurals.abbreviated_in_seconds
|
||||
format = if (future) {
|
||||
R.string.abbreviated_in_seconds
|
||||
} else {
|
||||
R.plurals.abbreviated_seconds_ago
|
||||
R.string.abbreviated_seconds_ago
|
||||
}
|
||||
} else if (span < HOUR_IN_MILLIS) {
|
||||
span /= MINUTE_IN_MILLIS
|
||||
if (future) {
|
||||
R.plurals.abbreviated_in_minutes
|
||||
format = if (future) {
|
||||
R.string.abbreviated_in_minutes
|
||||
} else {
|
||||
R.plurals.abbreviated_minutes_ago
|
||||
R.string.abbreviated_minutes_ago
|
||||
}
|
||||
} else if (span < DAY_IN_MILLIS) {
|
||||
span /= HOUR_IN_MILLIS
|
||||
if (future) {
|
||||
R.plurals.abbreviated_in_hours
|
||||
format = if (future) {
|
||||
R.string.abbreviated_in_hours
|
||||
} else {
|
||||
R.plurals.abbreviated_hours_ago
|
||||
R.string.abbreviated_hours_ago
|
||||
}
|
||||
} else if (span < YEAR_IN_MILLIS) {
|
||||
span /= DAY_IN_MILLIS
|
||||
if (future) {
|
||||
R.plurals.abbreviated_in_days
|
||||
format = if (future) {
|
||||
R.string.abbreviated_in_days
|
||||
} else {
|
||||
R.plurals.abbreviated_days_ago
|
||||
R.string.abbreviated_days_ago
|
||||
}
|
||||
} else {
|
||||
span /= YEAR_IN_MILLIS
|
||||
if (future) {
|
||||
R.plurals.abbreviated_in_years
|
||||
format = if (future) {
|
||||
R.string.abbreviated_in_years
|
||||
} else {
|
||||
R.plurals.abbreviated_years_ago
|
||||
R.string.abbreviated_years_ago
|
||||
}
|
||||
}
|
||||
return context.resources.getQuantityString(format, span.toInt(), span)
|
||||
return context.getString(format, span)
|
||||
}
|
||||
|
||||
fun formatPollDuration(context: Context, then: Long, now: Long): String {
|
||||
|
|
@ -97,5 +98,5 @@ fun formatPollDuration(context: Context, then: Long, now: Long): String {
|
|||
span /= DAY_IN_MILLIS
|
||||
format = R.plurals.poll_timespan_days
|
||||
}
|
||||
return context.resources.getQuantityString(format, span.toInt(), span)
|
||||
return context.resources.getQuantityString(format, span.toInt(), span.toInt())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue