mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 03:07:25 +01:00
Replace clear database FAB with button
Also remove a bunch of unnecessary inset paddings since Scaffold handles it
This commit is contained in:
parent
20bbda78e6
commit
f85cbb1582
@ -14,11 +14,8 @@ import androidx.compose.foundation.layout.Column
|
|||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
|
||||||
import androidx.compose.foundation.layout.asPaddingValues
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.navigationBars
|
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
@ -62,7 +59,6 @@ import eu.kanade.presentation.components.PreferenceRow
|
|||||||
import eu.kanade.presentation.components.Scaffold
|
import eu.kanade.presentation.components.Scaffold
|
||||||
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
||||||
import eu.kanade.presentation.util.horizontalPadding
|
import eu.kanade.presentation.util.horizontalPadding
|
||||||
import eu.kanade.presentation.util.plus
|
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.extension.model.Extension
|
import eu.kanade.tachiyomi.extension.model.Extension
|
||||||
import eu.kanade.tachiyomi.source.ConfigurableSource
|
import eu.kanade.tachiyomi.source.ConfigurableSource
|
||||||
@ -131,7 +127,7 @@ fun ExtensionDetailsScreen(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ExtensionDetails(
|
private fun ExtensionDetails(
|
||||||
paddingValues: PaddingValues,
|
contentPadding: PaddingValues,
|
||||||
presenter: ExtensionDetailsPresenter,
|
presenter: ExtensionDetailsPresenter,
|
||||||
onClickSourcePreferences: (sourceId: Long) -> Unit,
|
onClickSourcePreferences: (sourceId: Long) -> Unit,
|
||||||
) {
|
) {
|
||||||
@ -144,7 +140,7 @@ private fun ExtensionDetails(
|
|||||||
var showNsfwWarning by remember { mutableStateOf(false) }
|
var showNsfwWarning by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
ScrollbarLazyColumn(
|
ScrollbarLazyColumn(
|
||||||
contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
contentPadding = contentPadding,
|
||||||
) {
|
) {
|
||||||
when {
|
when {
|
||||||
extension.isUnofficial ->
|
extension.isUnofficial ->
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package eu.kanade.presentation.browse
|
package eu.kanade.presentation.browse
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
|
||||||
import androidx.compose.foundation.layout.asPaddingValues
|
|
||||||
import androidx.compose.foundation.layout.navigationBars
|
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.material3.Switch
|
import androidx.compose.material3.Switch
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@ -17,7 +14,6 @@ import eu.kanade.presentation.components.LazyColumn
|
|||||||
import eu.kanade.presentation.components.LoadingScreen
|
import eu.kanade.presentation.components.LoadingScreen
|
||||||
import eu.kanade.presentation.components.PreferenceRow
|
import eu.kanade.presentation.components.PreferenceRow
|
||||||
import eu.kanade.presentation.components.Scaffold
|
import eu.kanade.presentation.components.Scaffold
|
||||||
import eu.kanade.presentation.util.plus
|
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.ui.browse.extension.ExtensionFilterPresenter
|
import eu.kanade.tachiyomi.ui.browse.extension.ExtensionFilterPresenter
|
||||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||||
@ -38,13 +34,13 @@ fun ExtensionFilterScreen(
|
|||||||
scrollBehavior = scrollBehavior,
|
scrollBehavior = scrollBehavior,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
) { paddingValues ->
|
) { contentPadding ->
|
||||||
when {
|
when {
|
||||||
presenter.isLoading -> LoadingScreen()
|
presenter.isLoading -> LoadingScreen()
|
||||||
presenter.isEmpty -> EmptyScreen(textResource = R.string.empty_screen)
|
presenter.isEmpty -> EmptyScreen(textResource = R.string.empty_screen)
|
||||||
else -> {
|
else -> {
|
||||||
SourceFilterContent(
|
SourceFilterContent(
|
||||||
paddingValues = paddingValues,
|
contentPadding = contentPadding,
|
||||||
state = presenter,
|
state = presenter,
|
||||||
onClickLang = {
|
onClickLang = {
|
||||||
presenter.toggleLanguage(it)
|
presenter.toggleLanguage(it)
|
||||||
@ -66,12 +62,12 @@ fun ExtensionFilterScreen(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SourceFilterContent(
|
fun SourceFilterContent(
|
||||||
paddingValues: PaddingValues,
|
contentPadding: PaddingValues,
|
||||||
state: ExtensionFilterState,
|
state: ExtensionFilterState,
|
||||||
onClickLang: (String) -> Unit,
|
onClickLang: (String) -> Unit,
|
||||||
) {
|
) {
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
contentPadding = contentPadding,
|
||||||
) {
|
) {
|
||||||
items(
|
items(
|
||||||
items = state.items,
|
items = state.items,
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package eu.kanade.presentation.browse
|
package eu.kanade.presentation.browse
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
|
||||||
import androidx.compose.foundation.layout.asPaddingValues
|
|
||||||
import androidx.compose.foundation.layout.navigationBars
|
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
@ -16,7 +13,6 @@ import eu.kanade.presentation.components.LoadingScreen
|
|||||||
import eu.kanade.presentation.components.Scaffold
|
import eu.kanade.presentation.components.Scaffold
|
||||||
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
||||||
import eu.kanade.presentation.manga.components.BaseMangaListItem
|
import eu.kanade.presentation.manga.components.BaseMangaListItem
|
||||||
import eu.kanade.presentation.util.plus
|
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaPresenter
|
import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaPresenter
|
||||||
import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaPresenter.Event
|
import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaPresenter.Event
|
||||||
@ -40,13 +36,13 @@ fun MigrateMangaScreen(
|
|||||||
scrollBehavior = scrollBehavior,
|
scrollBehavior = scrollBehavior,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
) { paddingValues ->
|
) { contentPadding ->
|
||||||
when {
|
when {
|
||||||
presenter.isLoading -> LoadingScreen()
|
presenter.isLoading -> LoadingScreen()
|
||||||
presenter.isEmpty -> EmptyScreen(textResource = R.string.empty_screen)
|
presenter.isEmpty -> EmptyScreen(textResource = R.string.empty_screen)
|
||||||
else -> {
|
else -> {
|
||||||
MigrateMangaContent(
|
MigrateMangaContent(
|
||||||
paddingValues = paddingValues,
|
contentPadding = contentPadding,
|
||||||
state = presenter,
|
state = presenter,
|
||||||
onClickItem = onClickItem,
|
onClickItem = onClickItem,
|
||||||
onClickCover = onClickCover,
|
onClickCover = onClickCover,
|
||||||
@ -67,13 +63,13 @@ fun MigrateMangaScreen(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun MigrateMangaContent(
|
fun MigrateMangaContent(
|
||||||
paddingValues: PaddingValues,
|
contentPadding: PaddingValues,
|
||||||
state: MigrateMangaState,
|
state: MigrateMangaState,
|
||||||
onClickItem: (Manga) -> Unit,
|
onClickItem: (Manga) -> Unit,
|
||||||
onClickCover: (Manga) -> Unit,
|
onClickCover: (Manga) -> Unit,
|
||||||
) {
|
) {
|
||||||
ScrollbarLazyColumn(
|
ScrollbarLazyColumn(
|
||||||
contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
contentPadding = contentPadding,
|
||||||
) {
|
) {
|
||||||
items(state.items) { manga ->
|
items(state.items) { manga ->
|
||||||
MigrateMangaItem(
|
MigrateMangaItem(
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package eu.kanade.presentation.browse
|
package eu.kanade.presentation.browse
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
|
||||||
import androidx.compose.foundation.layout.asPaddingValues
|
|
||||||
import androidx.compose.foundation.layout.navigationBars
|
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.material3.Checkbox
|
import androidx.compose.material3.Checkbox
|
||||||
import androidx.compose.material3.Switch
|
import androidx.compose.material3.Switch
|
||||||
@ -20,7 +17,6 @@ import eu.kanade.presentation.components.LoadingScreen
|
|||||||
import eu.kanade.presentation.components.PreferenceRow
|
import eu.kanade.presentation.components.PreferenceRow
|
||||||
import eu.kanade.presentation.components.Scaffold
|
import eu.kanade.presentation.components.Scaffold
|
||||||
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
||||||
import eu.kanade.presentation.util.plus
|
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.ui.browse.source.FilterUiModel
|
import eu.kanade.tachiyomi.ui.browse.source.FilterUiModel
|
||||||
import eu.kanade.tachiyomi.ui.browse.source.SourcesFilterPresenter
|
import eu.kanade.tachiyomi.ui.browse.source.SourcesFilterPresenter
|
||||||
@ -44,13 +40,13 @@ fun SourcesFilterScreen(
|
|||||||
scrollBehavior = scrollBehavior,
|
scrollBehavior = scrollBehavior,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
) { paddingValues ->
|
) { contentPadding ->
|
||||||
when {
|
when {
|
||||||
presenter.isLoading -> LoadingScreen()
|
presenter.isLoading -> LoadingScreen()
|
||||||
presenter.isEmpty -> EmptyScreen(textResource = R.string.source_filter_empty_screen)
|
presenter.isEmpty -> EmptyScreen(textResource = R.string.source_filter_empty_screen)
|
||||||
else -> {
|
else -> {
|
||||||
SourcesFilterContent(
|
SourcesFilterContent(
|
||||||
paddingValues = paddingValues,
|
contentPadding = contentPadding,
|
||||||
state = presenter,
|
state = presenter,
|
||||||
onClickLang = onClickLang,
|
onClickLang = onClickLang,
|
||||||
onClickSource = onClickSource,
|
onClickSource = onClickSource,
|
||||||
@ -71,13 +67,13 @@ fun SourcesFilterScreen(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SourcesFilterContent(
|
fun SourcesFilterContent(
|
||||||
paddingValues: PaddingValues,
|
contentPadding: PaddingValues,
|
||||||
state: SourcesFilterState,
|
state: SourcesFilterState,
|
||||||
onClickLang: (String) -> Unit,
|
onClickLang: (String) -> Unit,
|
||||||
onClickSource: (Source) -> Unit,
|
onClickSource: (Source) -> Unit,
|
||||||
) {
|
) {
|
||||||
ScrollbarLazyColumn(
|
ScrollbarLazyColumn(
|
||||||
contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
contentPadding = contentPadding,
|
||||||
) {
|
) {
|
||||||
items(
|
items(
|
||||||
items = state.items,
|
items = state.items,
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package eu.kanade.presentation.more
|
package eu.kanade.presentation.more
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
|
||||||
import androidx.compose.foundation.layout.asPaddingValues
|
|
||||||
import androidx.compose.foundation.layout.navigationBars
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.outlined.CloudOff
|
import androidx.compose.material.icons.outlined.CloudOff
|
||||||
import androidx.compose.material.icons.outlined.GetApp
|
import androidx.compose.material.icons.outlined.GetApp
|
||||||
@ -53,9 +50,9 @@ fun MoreScreen(
|
|||||||
scrollBehavior = scrollBehavior,
|
scrollBehavior = scrollBehavior,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
) { paddingValues ->
|
) { contentPadding ->
|
||||||
ScrollbarLazyColumn(
|
ScrollbarLazyColumn(
|
||||||
contentPadding = bottomNavPaddingValues + paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
contentPadding = contentPadding + bottomNavPaddingValues,
|
||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
LogoHeader()
|
LogoHeader()
|
||||||
|
@ -2,10 +2,7 @@ package eu.kanade.presentation.more.about
|
|||||||
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
|
||||||
import androidx.compose.foundation.layout.asPaddingValues
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.navigationBars
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.outlined.Public
|
import androidx.compose.material.icons.outlined.Public
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@ -46,9 +43,9 @@ fun AboutScreen(
|
|||||||
scrollBehavior = scrollBehavior,
|
scrollBehavior = scrollBehavior,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
) { paddingValues ->
|
) { contentPadding ->
|
||||||
ScrollbarLazyColumn(
|
ScrollbarLazyColumn(
|
||||||
contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
contentPadding = contentPadding,
|
||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
LogoHeader()
|
LogoHeader()
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package eu.kanade.presentation.more.about
|
package eu.kanade.presentation.more.about
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
|
||||||
import androidx.compose.foundation.layout.asPaddingValues
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.navigationBars
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -12,7 +9,6 @@ import com.mikepenz.aboutlibraries.ui.compose.LibrariesContainer
|
|||||||
import com.mikepenz.aboutlibraries.ui.compose.LibraryDefaults
|
import com.mikepenz.aboutlibraries.ui.compose.LibraryDefaults
|
||||||
import eu.kanade.presentation.components.AppBar
|
import eu.kanade.presentation.components.AppBar
|
||||||
import eu.kanade.presentation.components.Scaffold
|
import eu.kanade.presentation.components.Scaffold
|
||||||
import eu.kanade.presentation.util.plus
|
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@ -27,11 +23,11 @@ fun LicensesScreen(
|
|||||||
scrollBehavior = scrollBehavior,
|
scrollBehavior = scrollBehavior,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
) { paddingValues ->
|
) { contentPadding ->
|
||||||
LibrariesContainer(
|
LibrariesContainer(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize(),
|
.fillMaxSize(),
|
||||||
contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
contentPadding = contentPadding,
|
||||||
colors = LibraryDefaults.libraryColors(
|
colors = LibraryDefaults.libraryColors(
|
||||||
backgroundColor = MaterialTheme.colorScheme.background,
|
backgroundColor = MaterialTheme.colorScheme.background,
|
||||||
contentColor = MaterialTheme.colorScheme.onBackground,
|
contentColor = MaterialTheme.colorScheme.onBackground,
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package eu.kanade.presentation.more.settings
|
package eu.kanade.presentation.more.settings
|
||||||
|
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
|
||||||
import androidx.compose.foundation.layout.asPaddingValues
|
|
||||||
import androidx.compose.foundation.layout.navigationBars
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.outlined.Search
|
import androidx.compose.material.icons.outlined.Search
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@ -14,7 +11,6 @@ import eu.kanade.presentation.components.AppBarActions
|
|||||||
import eu.kanade.presentation.components.PreferenceRow
|
import eu.kanade.presentation.components.PreferenceRow
|
||||||
import eu.kanade.presentation.components.Scaffold
|
import eu.kanade.presentation.components.Scaffold
|
||||||
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
||||||
import eu.kanade.presentation.util.plus
|
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@ -42,9 +38,9 @@ fun SettingsMainScreen(
|
|||||||
scrollBehavior = scrollBehavior,
|
scrollBehavior = scrollBehavior,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
) { paddingValues ->
|
) { contentPadding ->
|
||||||
ScrollbarLazyColumn(
|
ScrollbarLazyColumn(
|
||||||
contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
contentPadding = contentPadding,
|
||||||
) {
|
) {
|
||||||
sections.map {
|
sections.map {
|
||||||
item {
|
item {
|
||||||
|
@ -2,10 +2,7 @@ package eu.kanade.presentation.more.settings
|
|||||||
|
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
|
||||||
import androidx.compose.foundation.layout.asPaddingValues
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.navigationBars
|
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
@ -22,7 +19,6 @@ import eu.kanade.presentation.components.Scaffold
|
|||||||
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
||||||
import eu.kanade.presentation.components.SearchToolbar
|
import eu.kanade.presentation.components.SearchToolbar
|
||||||
import eu.kanade.presentation.util.horizontalPadding
|
import eu.kanade.presentation.util.horizontalPadding
|
||||||
import eu.kanade.presentation.util.plus
|
|
||||||
import eu.kanade.tachiyomi.ui.setting.SettingsController
|
import eu.kanade.tachiyomi.ui.setting.SettingsController
|
||||||
import eu.kanade.tachiyomi.ui.setting.search.SettingsSearchHelper
|
import eu.kanade.tachiyomi.ui.setting.search.SettingsSearchHelper
|
||||||
import eu.kanade.tachiyomi.ui.setting.search.SettingsSearchPresenter
|
import eu.kanade.tachiyomi.ui.setting.search.SettingsSearchPresenter
|
||||||
@ -53,9 +49,9 @@ fun SettingsSearchScreen(
|
|||||||
// TODO: search placeholder
|
// TODO: search placeholder
|
||||||
// Text(stringResource(R.string.action_search_settings))
|
// Text(stringResource(R.string.action_search_settings))
|
||||||
},
|
},
|
||||||
) { paddingValues ->
|
) { contentPadding ->
|
||||||
ScrollbarLazyColumn(
|
ScrollbarLazyColumn(
|
||||||
contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
contentPadding = contentPadding,
|
||||||
) {
|
) {
|
||||||
items(
|
items(
|
||||||
items = results,
|
items = results,
|
||||||
@ -75,14 +71,14 @@ private fun SearchResult(
|
|||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = horizontalPadding, vertical = 8.dp)
|
|
||||||
.clickable {
|
.clickable {
|
||||||
// Must pass a new Controller instance to avoid this error
|
// Must pass a new Controller instance to avoid this error
|
||||||
// https://github.com/bluelinelabs/Conductor/issues/446
|
// https://github.com/bluelinelabs/Conductor/issues/446
|
||||||
val controller = result.searchController::class.createInstance()
|
val controller = result.searchController::class.createInstance()
|
||||||
controller.preferenceKey = result.key
|
controller.preferenceKey = result.key
|
||||||
onClickResult(controller)
|
onClickResult(controller)
|
||||||
},
|
}
|
||||||
|
.padding(horizontal = horizontalPadding, vertical = 8.dp),
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = result.title,
|
text = result.title,
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
package eu.kanade.presentation.more.settings.database
|
package eu.kanade.presentation.more.settings.database
|
||||||
|
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import eu.kanade.presentation.components.Scaffold
|
import eu.kanade.presentation.components.Scaffold
|
||||||
import eu.kanade.presentation.more.settings.database.components.ClearDatabaseContent
|
import eu.kanade.presentation.more.settings.database.components.ClearDatabaseContent
|
||||||
import eu.kanade.presentation.more.settings.database.components.ClearDatabaseDeleteDialog
|
import eu.kanade.presentation.more.settings.database.components.ClearDatabaseDeleteDialog
|
||||||
import eu.kanade.presentation.more.settings.database.components.ClearDatabaseFloatingActionButton
|
|
||||||
import eu.kanade.presentation.more.settings.database.components.ClearDatabaseToolbar
|
import eu.kanade.presentation.more.settings.database.components.ClearDatabaseToolbar
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.ui.setting.database.ClearDatabasePresenter
|
import eu.kanade.tachiyomi.ui.setting.database.ClearDatabasePresenter
|
||||||
@ -18,7 +16,6 @@ fun ClearDatabaseScreen(
|
|||||||
navigateUp: () -> Unit,
|
navigateUp: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val lazyListState = rememberLazyListState()
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = { scrollBehavior ->
|
topBar = { scrollBehavior ->
|
||||||
ClearDatabaseToolbar(
|
ClearDatabaseToolbar(
|
||||||
@ -29,23 +26,16 @@ fun ClearDatabaseScreen(
|
|||||||
scrollBehavior = scrollBehavior,
|
scrollBehavior = scrollBehavior,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
floatingActionButton = {
|
|
||||||
ClearDatabaseFloatingActionButton(
|
|
||||||
isVisible = presenter.selection.isNotEmpty(),
|
|
||||||
lazyListState = lazyListState,
|
|
||||||
onClickDelete = {
|
|
||||||
presenter.dialog = ClearDatabasePresenter.Dialog.Delete(presenter.selection)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
},
|
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
ClearDatabaseContent(
|
ClearDatabaseContent(
|
||||||
state = presenter,
|
state = presenter,
|
||||||
contentPadding = paddingValues,
|
contentPadding = paddingValues,
|
||||||
lazyListState = lazyListState,
|
|
||||||
onClickSelection = { source ->
|
onClickSelection = { source ->
|
||||||
presenter.toggleSelection(source)
|
presenter.toggleSelection(source)
|
||||||
},
|
},
|
||||||
|
onClickDelete = {
|
||||||
|
presenter.dialog = ClearDatabasePresenter.Dialog.Delete(presenter.selection)
|
||||||
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val dialog = presenter.dialog
|
val dialog = presenter.dialog
|
||||||
|
@ -1,44 +1,73 @@
|
|||||||
package eu.kanade.presentation.more.settings.database.components
|
package eu.kanade.presentation.more.settings.database.components
|
||||||
|
|
||||||
import androidx.compose.animation.Crossfade
|
import androidx.compose.animation.Crossfade
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.asPaddingValues
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.navigationBars
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.lazy.LazyListState
|
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.material3.Button
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
import eu.kanade.domain.source.model.Source
|
import eu.kanade.domain.source.model.Source
|
||||||
|
import eu.kanade.presentation.components.Divider
|
||||||
import eu.kanade.presentation.components.EmptyScreen
|
import eu.kanade.presentation.components.EmptyScreen
|
||||||
import eu.kanade.presentation.components.FastScrollLazyColumn
|
import eu.kanade.presentation.components.FastScrollLazyColumn
|
||||||
import eu.kanade.presentation.more.settings.database.ClearDatabaseState
|
import eu.kanade.presentation.more.settings.database.ClearDatabaseState
|
||||||
import eu.kanade.presentation.util.plus
|
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ClearDatabaseContent(
|
fun ClearDatabaseContent(
|
||||||
state: ClearDatabaseState,
|
state: ClearDatabaseState,
|
||||||
contentPadding: PaddingValues,
|
contentPadding: PaddingValues,
|
||||||
lazyListState: LazyListState,
|
|
||||||
onClickSelection: (Source) -> Unit,
|
onClickSelection: (Source) -> Unit,
|
||||||
|
onClickDelete: () -> Unit,
|
||||||
) {
|
) {
|
||||||
Crossfade(targetState = state.isEmpty.not()) { _state ->
|
Crossfade(targetState = state.isEmpty.not()) { _state ->
|
||||||
when (_state) {
|
when (_state) {
|
||||||
true -> FastScrollLazyColumn(
|
true -> {
|
||||||
contentPadding = contentPadding + WindowInsets.navigationBars.asPaddingValues(),
|
Column(
|
||||||
state = lazyListState,
|
modifier = Modifier
|
||||||
) {
|
.padding(contentPadding)
|
||||||
items(state.items) { sourceWithCount ->
|
.fillMaxSize(),
|
||||||
ClearDatabaseItem(
|
) {
|
||||||
source = sourceWithCount.source,
|
FastScrollLazyColumn(
|
||||||
count = sourceWithCount.count,
|
modifier = Modifier.weight(1f),
|
||||||
isSelected = state.selection.contains(sourceWithCount.id),
|
) {
|
||||||
onClickSelect = { onClickSelection(sourceWithCount.source) },
|
items(state.items) { sourceWithCount ->
|
||||||
)
|
ClearDatabaseItem(
|
||||||
|
source = sourceWithCount.source,
|
||||||
|
count = sourceWithCount.count,
|
||||||
|
isSelected = state.selection.contains(sourceWithCount.id),
|
||||||
|
onClickSelect = { onClickSelection(sourceWithCount.source) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Divider()
|
||||||
|
|
||||||
|
Button(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||||
|
.fillMaxWidth(),
|
||||||
|
onClick = onClickDelete,
|
||||||
|
enabled = state.selection.isNotEmpty(),
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.action_delete),
|
||||||
|
color = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
false -> EmptyScreen(message = stringResource(R.string.database_clean))
|
false -> {
|
||||||
|
EmptyScreen(message = stringResource(R.string.database_clean))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
package eu.kanade.presentation.more.settings.database.components
|
|
||||||
|
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
|
||||||
import androidx.compose.animation.fadeIn
|
|
||||||
import androidx.compose.animation.fadeOut
|
|
||||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
|
||||||
import androidx.compose.foundation.lazy.LazyListState
|
|
||||||
import androidx.compose.material.icons.Icons
|
|
||||||
import androidx.compose.material.icons.outlined.Delete
|
|
||||||
import androidx.compose.material3.Icon
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.res.stringResource
|
|
||||||
import eu.kanade.presentation.components.ExtendedFloatingActionButton
|
|
||||||
import eu.kanade.presentation.util.isScrolledToEnd
|
|
||||||
import eu.kanade.presentation.util.isScrollingUp
|
|
||||||
import eu.kanade.tachiyomi.R
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun ClearDatabaseFloatingActionButton(
|
|
||||||
isVisible: Boolean,
|
|
||||||
lazyListState: LazyListState,
|
|
||||||
onClickDelete: () -> Unit,
|
|
||||||
) {
|
|
||||||
AnimatedVisibility(
|
|
||||||
visible = isVisible,
|
|
||||||
enter = fadeIn(),
|
|
||||||
exit = fadeOut(),
|
|
||||||
) {
|
|
||||||
ExtendedFloatingActionButton(
|
|
||||||
modifier = Modifier.navigationBarsPadding(),
|
|
||||||
text = {
|
|
||||||
Text(text = stringResource(R.string.action_delete))
|
|
||||||
},
|
|
||||||
icon = {
|
|
||||||
Icon(Icons.Outlined.Delete, contentDescription = "")
|
|
||||||
},
|
|
||||||
onClick = onClickDelete,
|
|
||||||
expanded = lazyListState.isScrollingUp() || lazyListState.isScrolledToEnd(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,14 +2,9 @@ package eu.kanade.presentation.updates
|
|||||||
|
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
|
||||||
import androidx.compose.foundation.layout.WindowInsetsSides
|
|
||||||
import androidx.compose.foundation.layout.asPaddingValues
|
|
||||||
import androidx.compose.foundation.layout.calculateEndPadding
|
import androidx.compose.foundation.layout.calculateEndPadding
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.navigationBars
|
|
||||||
import androidx.compose.foundation.layout.only
|
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.FlipToBack
|
import androidx.compose.material.icons.filled.FlipToBack
|
||||||
@ -112,7 +107,7 @@ fun UpdateScreen(
|
|||||||
if (presenter.selectionMode) {
|
if (presenter.selectionMode) {
|
||||||
PaddingValues()
|
PaddingValues()
|
||||||
} else {
|
} else {
|
||||||
bottomNavPaddingValues + WindowInsets.navigationBars.only(WindowInsetsSides.Bottom).asPaddingValues()
|
bottomNavPaddingValues
|
||||||
}
|
}
|
||||||
|
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
|
Loading…
Reference in New Issue
Block a user