mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 13:21:50 +01:00
Added new string to for mentioning times when the date time is at 0
This commit is contained in:
parent
5b840161e7
commit
3553013191
@ -146,7 +146,7 @@ class LibraryCategoryAdapter(val controller: LibraryController) :
|
||||
if (last != null && last.last_read > 100) {
|
||||
recyclerView.context.getString(
|
||||
R.string.read_,
|
||||
last.last_read.timeSpanFromNow
|
||||
last.last_read.timeSpanFromNow(preferences.context)
|
||||
)
|
||||
} else {
|
||||
"N/A"
|
||||
@ -173,7 +173,7 @@ class LibraryCategoryAdapter(val controller: LibraryController) :
|
||||
if (lastUpdate > 0) {
|
||||
recyclerView.context.getString(
|
||||
R.string.updated_,
|
||||
lastUpdate.timeSpanFromNow
|
||||
lastUpdate.timeSpanFromNow(preferences.context)
|
||||
)
|
||||
} else {
|
||||
"N/A"
|
||||
@ -182,7 +182,7 @@ class LibraryCategoryAdapter(val controller: LibraryController) :
|
||||
LibrarySort.DATE_ADDED -> {
|
||||
val added = item.manga.date_added
|
||||
if (added > 0) {
|
||||
recyclerView.context.getString(R.string.added_, added.timeSpanFromNow)
|
||||
recyclerView.context.getString(R.string.added_, added.timeSpanFromNow(preferences.context))
|
||||
} else {
|
||||
"N/A"
|
||||
}
|
||||
|
@ -86,12 +86,12 @@ class RecentMangaHolder(
|
||||
binding.body.text = when {
|
||||
item.mch.chapter.id == null -> binding.body.context.getString(
|
||||
R.string.added_,
|
||||
item.mch.manga.date_added.timeSpanFromNow
|
||||
item.mch.manga.date_added.timeSpanFromNow(itemView.context)
|
||||
)
|
||||
adapter.viewType == RecentsPresenter.VIEW_TYPE_ONLY_UPDATES -> ""
|
||||
item.mch.history.id == null -> binding.body.context.getString(
|
||||
R.string.updated_,
|
||||
item.chapter.date_upload.timeSpanFromNow
|
||||
item.chapter.date_upload.timeSpanFromNow(itemView.context)
|
||||
)
|
||||
item.chapter.id != item.mch.chapter.id ->
|
||||
binding.body.context.getString(
|
||||
@ -104,7 +104,7 @@ class RecentMangaHolder(
|
||||
item.chapter.pages_left > 0 && !item.chapter.read ->
|
||||
binding.body.context.getString(
|
||||
R.string.read_,
|
||||
item.mch.history.last_read.timeSpanFromNow
|
||||
item.mch.history.last_read.timeSpanFromNow(itemView.context)
|
||||
) + "\n" + itemView.resources.getQuantityString(
|
||||
R.plurals.pages_left,
|
||||
item.chapter.pages_left,
|
||||
@ -112,7 +112,7 @@ class RecentMangaHolder(
|
||||
)
|
||||
else -> binding.body.context.getString(
|
||||
R.string.read_,
|
||||
item.mch.history.last_read.timeSpanFromNow
|
||||
item.mch.history.last_read.timeSpanFromNow(itemView.context)
|
||||
)
|
||||
}
|
||||
if ((itemView.context as? Activity)?.isDestroyed != true) {
|
||||
|
@ -1,6 +1,17 @@
|
||||
package eu.kanade.tachiyomi.util.system
|
||||
|
||||
import android.content.Context
|
||||
import android.text.format.DateUtils
|
||||
import eu.kanade.tachiyomi.R
|
||||
import java.util.Locale
|
||||
|
||||
val Long.timeSpanFromNow: String
|
||||
get() = DateUtils.getRelativeTimeSpanString(this).toString()
|
||||
|
||||
fun Long.timeSpanFromNow(context: Context): String {
|
||||
return if (this == 0L) {
|
||||
context.getString(R.string.a_while_ago).lowercase(Locale.ROOT)
|
||||
} else {
|
||||
DateUtils.getRelativeTimeSpanString(this).toString()
|
||||
}
|
||||
}
|
||||
|
@ -229,6 +229,7 @@
|
||||
<string name="show_reset_history_button">Show reset history button</string>
|
||||
<string name="show_read_in_all">Show read in all</string>
|
||||
<string name="show_title_first">Show title first</string>
|
||||
<string name="a_while_ago">A while ago</string>
|
||||
|
||||
<!-- Browse -->
|
||||
<string name="search_filters">Search filters</string>
|
||||
|
Loading…
Reference in New Issue
Block a user