Minor library view cleanup

- Clean up unused code
- Add text shadow in compact mode
- Tweak some paddings to better match stable
This commit is contained in:
arkon
2022-07-16 15:36:38 -04:00
parent 35ec593658
commit fa73e2403b
9 changed files with 22 additions and 30 deletions

View File

@@ -40,7 +40,6 @@ import uy.kohesive.injekt.api.get
* @constructor creates an instance of the adapter.
*/
class LibraryAdapter(
private val controller: LibraryController,
private val presenter: LibraryPresenter,
private val onClickManga: (LibraryManga) -> Unit,
private val preferences: PreferencesHelper = Injekt.get(),
@@ -142,7 +141,6 @@ class LibraryAdapter(
DisplayModeSetting.LIST -> {
LibraryList(
items = mangaList,
columns = presenter.columns,
selection = presenter.selection,
onClick = onClickManga,
onLongClick = {

View File

@@ -142,7 +142,6 @@ class LibraryController(
super.onViewCreated(view)
adapter = LibraryAdapter(
controller = this,
presenter = presenter,
onClickManga = {
openManga(it.id!!)
@@ -466,7 +465,7 @@ class LibraryController(
actionMode = null
}
fun openManga(mangaId: Long) {
private fun openManga(mangaId: Long) {
// Notify the presenter a manga is being opened.
presenter.onOpenManga()

View File

@@ -7,10 +7,9 @@ import uy.kohesive.injekt.api.get
class LibraryItem(
val manga: LibraryManga,
private val sourceManager: SourceManager = Injekt.get(),
) {
private val sourceManager: SourceManager = Injekt.get()
var displayMode: Long = -1
var downloadCount = -1
var unreadCount = -1

View File

@@ -1,10 +1,3 @@
package eu.kanade.tachiyomi.ui.library
import eu.kanade.domain.category.model.Category
class LibraryMangaEvent(val mangas: LibraryMap) {
fun getMangaForCategory(category: Category): List<LibraryItem>? {
return mangas[category.id]
}
}
class LibraryMangaEvent(val mangas: LibraryMap)

View File

@@ -18,7 +18,6 @@ import eu.kanade.domain.category.interactor.SetMangaCategories
import eu.kanade.domain.category.model.Category
import eu.kanade.domain.chapter.interactor.GetChapterByMangaId
import eu.kanade.domain.chapter.interactor.SetReadStatus
import eu.kanade.domain.chapter.interactor.UpdateChapter
import eu.kanade.domain.chapter.model.toDbChapter
import eu.kanade.domain.manga.interactor.GetLibraryManga
import eu.kanade.domain.manga.interactor.UpdateManga
@@ -46,9 +45,7 @@ import eu.kanade.tachiyomi.util.removeCovers
import eu.kanade.tachiyomi.widget.ExtendedNavigationView.Item.TriStateGroup.State
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.drop
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.runBlocking
import rx.Observable
@@ -82,7 +79,6 @@ class LibraryPresenter(
private val getCategories: GetCategories = Injekt.get(),
private val getChapterByMangaId: GetChapterByMangaId = Injekt.get(),
private val setReadStatus: SetReadStatus = Injekt.get(),
private val updateChapter: UpdateChapter = Injekt.get(),
private val updateManga: UpdateManga = Injekt.get(),
private val setMangaCategories: SetMangaCategories = Injekt.get(),
private val preferences: PreferencesHelper = Injekt.get(),
@@ -109,11 +105,11 @@ class LibraryPresenter(
val selection: MutableList<LibraryManga> = mutableStateListOf()
val isPerCategory by mutableStateOf(preferences.categorizedDisplaySettings().get())
val isPerCategory by preferences.categorizedDisplaySettings().asState()
var columns by mutableStateOf(0)
var currentDisplayMode by mutableStateOf(preferences.libraryDisplayMode().get())
var currentDisplayMode by preferences.libraryDisplayMode().asState()
/**
* Relay used to apply the UI filters to the last emission of the library.
@@ -234,8 +230,8 @@ class LibraryPresenter(
if (!containsExclude.any() && !containsInclude.any()) return@tracking true
val exclude = trackedManga?.filterKeys { containsExclude.containsKey(it.toLong()) }?.values ?: emptyList()
val include = trackedManga?.filterKeys { containsInclude.containsKey(it.toLong()) }?.values ?: emptyList()
val exclude = trackedManga?.filterKeys { containsExclude.containsKey(it) }?.values ?: emptyList()
val include = trackedManga?.filterKeys { containsInclude.containsKey(it) }?.values ?: emptyList()
if (containsInclude.any() && containsExclude.any()) {
return@tracking if (exclude.isNotEmpty()) !exclude.any() else include.any()
@@ -449,9 +445,6 @@ class LibraryPresenter(
* value.
*/
private fun getLibraryMangasObservable(): Observable<LibraryMap> {
val defaultLibraryDisplayMode = preferences.libraryDisplayMode()
val shouldSetFromCategory = preferences.categorizedDisplaySettings()
return getLibraryManga.subscribe().asObservable()
.map { list ->
list.map { libraryManga ->