Use relative time in ChapterHolder (#5719)

* Use relative time in ChapterHolder

Similar to how J2K does it

* Use custom implementation for relative time

* Changes based on review comments
This commit is contained in:
Andreas
2021-08-15 23:07:48 +02:00
committed by GitHub
parent 91fbccdbaa
commit 57a5862840
7 changed files with 56 additions and 1 deletions

View File

@@ -182,6 +182,7 @@ object PreferenceKeys {
const val libraryDisplayMode = "pref_display_mode_library"
const val relativeTime: String = "relative_time"
const val dateFormat = "app_date_format"
const val defaultCategory = "default_category"

View File

@@ -208,6 +208,8 @@ class PreferencesHelper(val context: Context) {
fun backupsDirectory() = flowPrefs.getString(Keys.backupDirectory, defaultBackupDir.toString())
fun relativeTime() = flowPrefs.getInt(Keys.relativeTime, 7)
fun dateFormat(format: String = flowPrefs.getString(Keys.dateFormat, "").get()): DateFormat = when (format) {
"" -> DateFormat.getDateInstance(DateFormat.SHORT)
else -> SimpleDateFormat(format, Locale.getDefault())