mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Show "fetched x time ago" in grouped/all recents
+ show "fetched" when sorting by fetched in updates mode in recents
This commit is contained in:
parent
fd89ca13e7
commit
ebbb6a2129
2 changed files with 26 additions and 4 deletions
|
@ -4,6 +4,7 @@ import androidx.recyclerview.widget.ItemTouchHelper
|
|||
import com.fredporciuncula.flow.preferences.Preference
|
||||
import eu.davidea.flexibleadapter.items.IFlexible
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.asImmediateFlowIn
|
||||
import eu.kanade.tachiyomi.ui.manga.chapter.BaseChapterAdapter
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.flow.drop
|
||||
|
@ -24,6 +25,7 @@ class RecentMangaAdapter(val delegate: RecentsInterface) :
|
|||
var showUpdatedTime = preferences.showUpdatedTime().get()
|
||||
var uniformCovers = preferences.uniformGrid().get()
|
||||
var showOutline = preferences.outlineOnCovers().get()
|
||||
var sortByFetched = preferences.sortFetchedTime().get()
|
||||
|
||||
val viewType: Int
|
||||
get() = delegate.getViewType()
|
||||
|
@ -48,6 +50,7 @@ class RecentMangaAdapter(val delegate: RecentsInterface) :
|
|||
preferences.showTitleFirstInRecents().register { showTitleFirst = it }
|
||||
preferences.showUpdatedTime().register { showUpdatedTime = it }
|
||||
preferences.uniformGrid().register { uniformCovers = it }
|
||||
preferences.sortFetchedTime().asImmediateFlowIn(delegate.scope()) { sortByFetched = it }
|
||||
preferences.outlineOnCovers().register(false) {
|
||||
showOutline = it
|
||||
(0 until itemCount).forEach { i ->
|
||||
|
|
|
@ -124,10 +124,29 @@ class RecentMangaHolder(
|
|||
item.mch.manga.date_added.timeSpanFromNow(itemView.context),
|
||||
)
|
||||
isSmallUpdates -> ""
|
||||
item.mch.history.id == null -> binding.body.context.getString(
|
||||
R.string.updated_,
|
||||
item.chapter.date_upload.timeSpanFromNow(itemView.context),
|
||||
)
|
||||
item.mch.history.id == null -> {
|
||||
if (adapter.viewType == RecentsPresenter.VIEW_TYPE_ONLY_UPDATES) {
|
||||
if (adapter.sortByFetched) {
|
||||
binding.body.context.getString(
|
||||
R.string.fetched_,
|
||||
item.chapter.date_fetch.timeSpanFromNow(itemView.context),
|
||||
)
|
||||
} else {
|
||||
binding.body.context.getString(
|
||||
R.string.updated_,
|
||||
item.chapter.date_upload.timeSpanFromNow(itemView.context),
|
||||
)
|
||||
}
|
||||
} else {
|
||||
binding.body.context.getString(
|
||||
R.string.fetched_,
|
||||
item.chapter.date_fetch.timeSpanFromNow(itemView.context),
|
||||
) + "\n" + binding.body.context.getString(
|
||||
R.string.updated_,
|
||||
item.chapter.date_upload.timeSpanFromNow(itemView.context),
|
||||
)
|
||||
}
|
||||
}
|
||||
item.chapter.id != item.mch.chapter.id ->
|
||||
binding.body.context.getString(
|
||||
R.string.read_,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue