mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-05 22:35:09 +01:00
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:
parent
35ec593658
commit
fa73e2403b
@ -22,9 +22,9 @@ fun LazyLibraryGrid(
|
|||||||
LazyVerticalGrid(
|
LazyVerticalGrid(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
columns = if (columns == 0) GridCells.Adaptive(128.dp) else GridCells.Fixed(columns),
|
columns = if (columns == 0) GridCells.Adaptive(128.dp) else GridCells.Fixed(columns),
|
||||||
contentPadding = PaddingValues(8.dp) + WindowInsets.navigationBars.asPaddingValues(),
|
contentPadding = PaddingValues(12.dp) + WindowInsets.navigationBars.asPaddingValues(),
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
content = content,
|
content = content,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,14 @@ package eu.kanade.presentation.library.components
|
|||||||
|
|
||||||
import androidx.compose.foundation.combinedClickable
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.lazy.grid.items
|
import androidx.compose.foundation.lazy.grid.items
|
||||||
import androidx.compose.material3.LocalTextStyle
|
import androidx.compose.material3.LocalTextStyle
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
import eu.kanade.domain.manga.model.MangaCover
|
import eu.kanade.domain.manga.model.MangaCover
|
||||||
import eu.kanade.tachiyomi.data.database.models.LibraryManga
|
import eu.kanade.tachiyomi.data.database.models.LibraryManga
|
||||||
import eu.kanade.tachiyomi.ui.library.LibraryItem
|
import eu.kanade.tachiyomi.ui.library.LibraryItem
|
||||||
@ -73,6 +75,7 @@ fun LibraryComfortableGridItem(
|
|||||||
language = item.sourceLanguage,
|
language = item.sourceLanguage,
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
|
modifier = Modifier.padding(4.dp),
|
||||||
text = manga.title,
|
text = manga.title,
|
||||||
maxLines = 2,
|
maxLines = 2,
|
||||||
style = LocalTextStyle.current.copy(fontWeight = FontWeight.SemiBold),
|
style = LocalTextStyle.current.copy(fontWeight = FontWeight.SemiBold),
|
||||||
|
@ -16,6 +16,7 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Brush
|
import androidx.compose.ui.graphics.Brush
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.graphics.Shadow
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import eu.kanade.tachiyomi.data.database.models.LibraryManga
|
import eu.kanade.tachiyomi.data.database.models.LibraryManga
|
||||||
@ -98,7 +99,14 @@ fun LibraryCompactGridItem(
|
|||||||
.padding(8.dp)
|
.padding(8.dp)
|
||||||
.align(Alignment.BottomStart),
|
.align(Alignment.BottomStart),
|
||||||
maxLines = 2,
|
maxLines = 2,
|
||||||
style = LocalTextStyle.current.copy(color = Color.White, fontWeight = FontWeight.SemiBold),
|
style = LocalTextStyle.current.copy(
|
||||||
|
color = Color.White,
|
||||||
|
fontWeight = FontWeight.SemiBold,
|
||||||
|
shadow = Shadow(
|
||||||
|
color = Color.Black,
|
||||||
|
blurRadius = 4f,
|
||||||
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ import eu.kanade.tachiyomi.ui.library.LibraryItem
|
|||||||
@Composable
|
@Composable
|
||||||
fun LibraryList(
|
fun LibraryList(
|
||||||
items: List<LibraryItem>,
|
items: List<LibraryItem>,
|
||||||
columns: Int,
|
|
||||||
selection: List<LibraryManga>,
|
selection: List<LibraryManga>,
|
||||||
onClick: (LibraryManga) -> Unit,
|
onClick: (LibraryManga) -> Unit,
|
||||||
onLongClick: (LibraryManga) -> Unit,
|
onLongClick: (LibraryManga) -> Unit,
|
||||||
|
@ -40,7 +40,6 @@ import uy.kohesive.injekt.api.get
|
|||||||
* @constructor creates an instance of the adapter.
|
* @constructor creates an instance of the adapter.
|
||||||
*/
|
*/
|
||||||
class LibraryAdapter(
|
class LibraryAdapter(
|
||||||
private val controller: LibraryController,
|
|
||||||
private val presenter: LibraryPresenter,
|
private val presenter: LibraryPresenter,
|
||||||
private val onClickManga: (LibraryManga) -> Unit,
|
private val onClickManga: (LibraryManga) -> Unit,
|
||||||
private val preferences: PreferencesHelper = Injekt.get(),
|
private val preferences: PreferencesHelper = Injekt.get(),
|
||||||
@ -142,7 +141,6 @@ class LibraryAdapter(
|
|||||||
DisplayModeSetting.LIST -> {
|
DisplayModeSetting.LIST -> {
|
||||||
LibraryList(
|
LibraryList(
|
||||||
items = mangaList,
|
items = mangaList,
|
||||||
columns = presenter.columns,
|
|
||||||
selection = presenter.selection,
|
selection = presenter.selection,
|
||||||
onClick = onClickManga,
|
onClick = onClickManga,
|
||||||
onLongClick = {
|
onLongClick = {
|
||||||
|
@ -142,7 +142,6 @@ class LibraryController(
|
|||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
|
|
||||||
adapter = LibraryAdapter(
|
adapter = LibraryAdapter(
|
||||||
controller = this,
|
|
||||||
presenter = presenter,
|
presenter = presenter,
|
||||||
onClickManga = {
|
onClickManga = {
|
||||||
openManga(it.id!!)
|
openManga(it.id!!)
|
||||||
@ -466,7 +465,7 @@ class LibraryController(
|
|||||||
actionMode = null
|
actionMode = null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun openManga(mangaId: Long) {
|
private fun openManga(mangaId: Long) {
|
||||||
// Notify the presenter a manga is being opened.
|
// Notify the presenter a manga is being opened.
|
||||||
presenter.onOpenManga()
|
presenter.onOpenManga()
|
||||||
|
|
||||||
|
@ -7,10 +7,9 @@ import uy.kohesive.injekt.api.get
|
|||||||
|
|
||||||
class LibraryItem(
|
class LibraryItem(
|
||||||
val manga: LibraryManga,
|
val manga: LibraryManga,
|
||||||
|
private val sourceManager: SourceManager = Injekt.get(),
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private val sourceManager: SourceManager = Injekt.get()
|
|
||||||
|
|
||||||
var displayMode: Long = -1
|
var displayMode: Long = -1
|
||||||
var downloadCount = -1
|
var downloadCount = -1
|
||||||
var unreadCount = -1
|
var unreadCount = -1
|
||||||
|
@ -1,10 +1,3 @@
|
|||||||
package eu.kanade.tachiyomi.ui.library
|
package eu.kanade.tachiyomi.ui.library
|
||||||
|
|
||||||
import eu.kanade.domain.category.model.Category
|
class LibraryMangaEvent(val mangas: LibraryMap)
|
||||||
|
|
||||||
class LibraryMangaEvent(val mangas: LibraryMap) {
|
|
||||||
|
|
||||||
fun getMangaForCategory(category: Category): List<LibraryItem>? {
|
|
||||||
return mangas[category.id]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -18,7 +18,6 @@ import eu.kanade.domain.category.interactor.SetMangaCategories
|
|||||||
import eu.kanade.domain.category.model.Category
|
import eu.kanade.domain.category.model.Category
|
||||||
import eu.kanade.domain.chapter.interactor.GetChapterByMangaId
|
import eu.kanade.domain.chapter.interactor.GetChapterByMangaId
|
||||||
import eu.kanade.domain.chapter.interactor.SetReadStatus
|
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.chapter.model.toDbChapter
|
||||||
import eu.kanade.domain.manga.interactor.GetLibraryManga
|
import eu.kanade.domain.manga.interactor.GetLibraryManga
|
||||||
import eu.kanade.domain.manga.interactor.UpdateManga
|
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 eu.kanade.tachiyomi.widget.ExtendedNavigationView.Item.TriStateGroup.State
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.drop
|
import kotlinx.coroutines.flow.drop
|
||||||
import kotlinx.coroutines.flow.filter
|
|
||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
import kotlinx.coroutines.flow.map
|
|
||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
@ -82,7 +79,6 @@ class LibraryPresenter(
|
|||||||
private val getCategories: GetCategories = Injekt.get(),
|
private val getCategories: GetCategories = Injekt.get(),
|
||||||
private val getChapterByMangaId: GetChapterByMangaId = Injekt.get(),
|
private val getChapterByMangaId: GetChapterByMangaId = Injekt.get(),
|
||||||
private val setReadStatus: SetReadStatus = Injekt.get(),
|
private val setReadStatus: SetReadStatus = Injekt.get(),
|
||||||
private val updateChapter: UpdateChapter = Injekt.get(),
|
|
||||||
private val updateManga: UpdateManga = Injekt.get(),
|
private val updateManga: UpdateManga = Injekt.get(),
|
||||||
private val setMangaCategories: SetMangaCategories = Injekt.get(),
|
private val setMangaCategories: SetMangaCategories = Injekt.get(),
|
||||||
private val preferences: PreferencesHelper = Injekt.get(),
|
private val preferences: PreferencesHelper = Injekt.get(),
|
||||||
@ -109,11 +105,11 @@ class LibraryPresenter(
|
|||||||
|
|
||||||
val selection: MutableList<LibraryManga> = mutableStateListOf()
|
val selection: MutableList<LibraryManga> = mutableStateListOf()
|
||||||
|
|
||||||
val isPerCategory by mutableStateOf(preferences.categorizedDisplaySettings().get())
|
val isPerCategory by preferences.categorizedDisplaySettings().asState()
|
||||||
|
|
||||||
var columns by mutableStateOf(0)
|
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.
|
* 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
|
if (!containsExclude.any() && !containsInclude.any()) return@tracking true
|
||||||
|
|
||||||
val exclude = trackedManga?.filterKeys { containsExclude.containsKey(it.toLong()) }?.values ?: emptyList()
|
val exclude = trackedManga?.filterKeys { containsExclude.containsKey(it) }?.values ?: emptyList()
|
||||||
val include = trackedManga?.filterKeys { containsInclude.containsKey(it.toLong()) }?.values ?: emptyList()
|
val include = trackedManga?.filterKeys { containsInclude.containsKey(it) }?.values ?: emptyList()
|
||||||
|
|
||||||
if (containsInclude.any() && containsExclude.any()) {
|
if (containsInclude.any() && containsExclude.any()) {
|
||||||
return@tracking if (exclude.isNotEmpty()) !exclude.any() else include.any()
|
return@tracking if (exclude.isNotEmpty()) !exclude.any() else include.any()
|
||||||
@ -449,9 +445,6 @@ class LibraryPresenter(
|
|||||||
* value.
|
* value.
|
||||||
*/
|
*/
|
||||||
private fun getLibraryMangasObservable(): Observable<LibraryMap> {
|
private fun getLibraryMangasObservable(): Observable<LibraryMap> {
|
||||||
val defaultLibraryDisplayMode = preferences.libraryDisplayMode()
|
|
||||||
val shouldSetFromCategory = preferences.categorizedDisplaySettings()
|
|
||||||
|
|
||||||
return getLibraryManga.subscribe().asObservable()
|
return getLibraryManga.subscribe().asObservable()
|
||||||
.map { list ->
|
.map { list ->
|
||||||
list.map { libraryManga ->
|
list.map { libraryManga ->
|
||||||
|
Loading…
Reference in New Issue
Block a user