mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05: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
13 changed files with 77 additions and 140 deletions
|
@ -14,11 +14,8 @@ import androidx.compose.foundation.layout.Column
|
|||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
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.height
|
||||
import androidx.compose.foundation.layout.navigationBars
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
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.ScrollbarLazyColumn
|
||||
import eu.kanade.presentation.util.horizontalPadding
|
||||
import eu.kanade.presentation.util.plus
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.extension.model.Extension
|
||||
import eu.kanade.tachiyomi.source.ConfigurableSource
|
||||
|
@ -131,7 +127,7 @@ fun ExtensionDetailsScreen(
|
|||
|
||||
@Composable
|
||||
private fun ExtensionDetails(
|
||||
paddingValues: PaddingValues,
|
||||
contentPadding: PaddingValues,
|
||||
presenter: ExtensionDetailsPresenter,
|
||||
onClickSourcePreferences: (sourceId: Long) -> Unit,
|
||||
) {
|
||||
|
@ -144,7 +140,7 @@ private fun ExtensionDetails(
|
|||
var showNsfwWarning by remember { mutableStateOf(false) }
|
||||
|
||||
ScrollbarLazyColumn(
|
||||
contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
||||
contentPadding = contentPadding,
|
||||
) {
|
||||
when {
|
||||
extension.isUnofficial ->
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package eu.kanade.presentation.browse
|
||||
|
||||
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.material3.Switch
|
||||
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.PreferenceRow
|
||||
import eu.kanade.presentation.components.Scaffold
|
||||
import eu.kanade.presentation.util.plus
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.ui.browse.extension.ExtensionFilterPresenter
|
||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||
|
@ -38,13 +34,13 @@ fun ExtensionFilterScreen(
|
|||
scrollBehavior = scrollBehavior,
|
||||
)
|
||||
},
|
||||
) { paddingValues ->
|
||||
) { contentPadding ->
|
||||
when {
|
||||
presenter.isLoading -> LoadingScreen()
|
||||
presenter.isEmpty -> EmptyScreen(textResource = R.string.empty_screen)
|
||||
else -> {
|
||||
SourceFilterContent(
|
||||
paddingValues = paddingValues,
|
||||
contentPadding = contentPadding,
|
||||
state = presenter,
|
||||
onClickLang = {
|
||||
presenter.toggleLanguage(it)
|
||||
|
@ -66,12 +62,12 @@ fun ExtensionFilterScreen(
|
|||
|
||||
@Composable
|
||||
fun SourceFilterContent(
|
||||
paddingValues: PaddingValues,
|
||||
contentPadding: PaddingValues,
|
||||
state: ExtensionFilterState,
|
||||
onClickLang: (String) -> Unit,
|
||||
) {
|
||||
LazyColumn(
|
||||
contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
||||
contentPadding = contentPadding,
|
||||
) {
|
||||
items(
|
||||
items = state.items,
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package eu.kanade.presentation.browse
|
||||
|
||||
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.runtime.Composable
|
||||
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.ScrollbarLazyColumn
|
||||
import eu.kanade.presentation.manga.components.BaseMangaListItem
|
||||
import eu.kanade.presentation.util.plus
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaPresenter
|
||||
import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaPresenter.Event
|
||||
|
@ -40,13 +36,13 @@ fun MigrateMangaScreen(
|
|||
scrollBehavior = scrollBehavior,
|
||||
)
|
||||
},
|
||||
) { paddingValues ->
|
||||
) { contentPadding ->
|
||||
when {
|
||||
presenter.isLoading -> LoadingScreen()
|
||||
presenter.isEmpty -> EmptyScreen(textResource = R.string.empty_screen)
|
||||
else -> {
|
||||
MigrateMangaContent(
|
||||
paddingValues = paddingValues,
|
||||
contentPadding = contentPadding,
|
||||
state = presenter,
|
||||
onClickItem = onClickItem,
|
||||
onClickCover = onClickCover,
|
||||
|
@ -67,13 +63,13 @@ fun MigrateMangaScreen(
|
|||
|
||||
@Composable
|
||||
fun MigrateMangaContent(
|
||||
paddingValues: PaddingValues,
|
||||
contentPadding: PaddingValues,
|
||||
state: MigrateMangaState,
|
||||
onClickItem: (Manga) -> Unit,
|
||||
onClickCover: (Manga) -> Unit,
|
||||
) {
|
||||
ScrollbarLazyColumn(
|
||||
contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
||||
contentPadding = contentPadding,
|
||||
) {
|
||||
items(state.items) { manga ->
|
||||
MigrateMangaItem(
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package eu.kanade.presentation.browse
|
||||
|
||||
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.material3.Checkbox
|
||||
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.Scaffold
|
||||
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
||||
import eu.kanade.presentation.util.plus
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.ui.browse.source.FilterUiModel
|
||||
import eu.kanade.tachiyomi.ui.browse.source.SourcesFilterPresenter
|
||||
|
@ -44,13 +40,13 @@ fun SourcesFilterScreen(
|
|||
scrollBehavior = scrollBehavior,
|
||||
)
|
||||
},
|
||||
) { paddingValues ->
|
||||
) { contentPadding ->
|
||||
when {
|
||||
presenter.isLoading -> LoadingScreen()
|
||||
presenter.isEmpty -> EmptyScreen(textResource = R.string.source_filter_empty_screen)
|
||||
else -> {
|
||||
SourcesFilterContent(
|
||||
paddingValues = paddingValues,
|
||||
contentPadding = contentPadding,
|
||||
state = presenter,
|
||||
onClickLang = onClickLang,
|
||||
onClickSource = onClickSource,
|
||||
|
@ -71,13 +67,13 @@ fun SourcesFilterScreen(
|
|||
|
||||
@Composable
|
||||
fun SourcesFilterContent(
|
||||
paddingValues: PaddingValues,
|
||||
contentPadding: PaddingValues,
|
||||
state: SourcesFilterState,
|
||||
onClickLang: (String) -> Unit,
|
||||
onClickSource: (Source) -> Unit,
|
||||
) {
|
||||
ScrollbarLazyColumn(
|
||||
contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
||||
contentPadding = contentPadding,
|
||||
) {
|
||||
items(
|
||||
items = state.items,
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
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.outlined.CloudOff
|
||||
import androidx.compose.material.icons.outlined.GetApp
|
||||
|
@ -53,9 +50,9 @@ fun MoreScreen(
|
|||
scrollBehavior = scrollBehavior,
|
||||
)
|
||||
},
|
||||
) { paddingValues ->
|
||||
) { contentPadding ->
|
||||
ScrollbarLazyColumn(
|
||||
contentPadding = bottomNavPaddingValues + paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
||||
contentPadding = contentPadding + bottomNavPaddingValues,
|
||||
) {
|
||||
item {
|
||||
LogoHeader()
|
||||
|
|
|
@ -2,10 +2,7 @@ package eu.kanade.presentation.more.about
|
|||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
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.navigationBars
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.Public
|
||||
import androidx.compose.runtime.Composable
|
||||
|
@ -46,9 +43,9 @@ fun AboutScreen(
|
|||
scrollBehavior = scrollBehavior,
|
||||
)
|
||||
},
|
||||
) { paddingValues ->
|
||||
) { contentPadding ->
|
||||
ScrollbarLazyColumn(
|
||||
contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
||||
contentPadding = contentPadding,
|
||||
) {
|
||||
item {
|
||||
LogoHeader()
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
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.navigationBars
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
|
@ -12,7 +9,6 @@ import com.mikepenz.aboutlibraries.ui.compose.LibrariesContainer
|
|||
import com.mikepenz.aboutlibraries.ui.compose.LibraryDefaults
|
||||
import eu.kanade.presentation.components.AppBar
|
||||
import eu.kanade.presentation.components.Scaffold
|
||||
import eu.kanade.presentation.util.plus
|
||||
import eu.kanade.tachiyomi.R
|
||||
|
||||
@Composable
|
||||
|
@ -27,11 +23,11 @@ fun LicensesScreen(
|
|||
scrollBehavior = scrollBehavior,
|
||||
)
|
||||
},
|
||||
) { paddingValues ->
|
||||
) { contentPadding ->
|
||||
LibrariesContainer(
|
||||
modifier = Modifier
|
||||
.fillMaxSize(),
|
||||
contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
||||
contentPadding = contentPadding,
|
||||
colors = LibraryDefaults.libraryColors(
|
||||
backgroundColor = MaterialTheme.colorScheme.background,
|
||||
contentColor = MaterialTheme.colorScheme.onBackground,
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package eu.kanade.presentation.more.settings
|
||||
|
||||
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.outlined.Search
|
||||
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.Scaffold
|
||||
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
||||
import eu.kanade.presentation.util.plus
|
||||
import eu.kanade.tachiyomi.R
|
||||
|
||||
@Composable
|
||||
|
@ -42,9 +38,9 @@ fun SettingsMainScreen(
|
|||
scrollBehavior = scrollBehavior,
|
||||
)
|
||||
},
|
||||
) { paddingValues ->
|
||||
) { contentPadding ->
|
||||
ScrollbarLazyColumn(
|
||||
contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
||||
contentPadding = contentPadding,
|
||||
) {
|
||||
sections.map {
|
||||
item {
|
||||
|
|
|
@ -2,10 +2,7 @@ package eu.kanade.presentation.more.settings
|
|||
|
||||
import androidx.compose.foundation.clickable
|
||||
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.navigationBars
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.items
|
||||
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.SearchToolbar
|
||||
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.search.SettingsSearchHelper
|
||||
import eu.kanade.tachiyomi.ui.setting.search.SettingsSearchPresenter
|
||||
|
@ -53,9 +49,9 @@ fun SettingsSearchScreen(
|
|||
// TODO: search placeholder
|
||||
// Text(stringResource(R.string.action_search_settings))
|
||||
},
|
||||
) { paddingValues ->
|
||||
) { contentPadding ->
|
||||
ScrollbarLazyColumn(
|
||||
contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
||||
contentPadding = contentPadding,
|
||||
) {
|
||||
items(
|
||||
items = results,
|
||||
|
@ -75,14 +71,14 @@ private fun SearchResult(
|
|||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = horizontalPadding, vertical = 8.dp)
|
||||
.clickable {
|
||||
// Must pass a new Controller instance to avoid this error
|
||||
// https://github.com/bluelinelabs/Conductor/issues/446
|
||||
val controller = result.searchController::class.createInstance()
|
||||
controller.preferenceKey = result.key
|
||||
onClickResult(controller)
|
||||
},
|
||||
}
|
||||
.padding(horizontal = horizontalPadding, vertical = 8.dp),
|
||||
) {
|
||||
Text(
|
||||
text = result.title,
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package eu.kanade.presentation.more.settings.database
|
||||
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import eu.kanade.presentation.components.Scaffold
|
||||
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.ClearDatabaseFloatingActionButton
|
||||
import eu.kanade.presentation.more.settings.database.components.ClearDatabaseToolbar
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.ui.setting.database.ClearDatabasePresenter
|
||||
|
@ -18,7 +16,6 @@ fun ClearDatabaseScreen(
|
|||
navigateUp: () -> Unit,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val lazyListState = rememberLazyListState()
|
||||
Scaffold(
|
||||
topBar = { scrollBehavior ->
|
||||
ClearDatabaseToolbar(
|
||||
|
@ -29,23 +26,16 @@ fun ClearDatabaseScreen(
|
|||
scrollBehavior = scrollBehavior,
|
||||
)
|
||||
},
|
||||
floatingActionButton = {
|
||||
ClearDatabaseFloatingActionButton(
|
||||
isVisible = presenter.selection.isNotEmpty(),
|
||||
lazyListState = lazyListState,
|
||||
onClickDelete = {
|
||||
presenter.dialog = ClearDatabasePresenter.Dialog.Delete(presenter.selection)
|
||||
},
|
||||
)
|
||||
},
|
||||
) { paddingValues ->
|
||||
ClearDatabaseContent(
|
||||
state = presenter,
|
||||
contentPadding = paddingValues,
|
||||
lazyListState = lazyListState,
|
||||
onClickSelection = { source ->
|
||||
presenter.toggleSelection(source)
|
||||
},
|
||||
onClickDelete = {
|
||||
presenter.dialog = ClearDatabasePresenter.Dialog.Delete(presenter.selection)
|
||||
},
|
||||
)
|
||||
}
|
||||
val dialog = presenter.dialog
|
||||
|
|
|
@ -1,33 +1,43 @@
|
|||
package eu.kanade.presentation.more.settings.database.components
|
||||
|
||||
import androidx.compose.animation.Crossfade
|
||||
import androidx.compose.foundation.layout.Column
|
||||
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.LazyListState
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
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.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import eu.kanade.domain.source.model.Source
|
||||
import eu.kanade.presentation.components.Divider
|
||||
import eu.kanade.presentation.components.EmptyScreen
|
||||
import eu.kanade.presentation.components.FastScrollLazyColumn
|
||||
import eu.kanade.presentation.more.settings.database.ClearDatabaseState
|
||||
import eu.kanade.presentation.util.plus
|
||||
import eu.kanade.tachiyomi.R
|
||||
|
||||
@Composable
|
||||
fun ClearDatabaseContent(
|
||||
state: ClearDatabaseState,
|
||||
contentPadding: PaddingValues,
|
||||
lazyListState: LazyListState,
|
||||
onClickSelection: (Source) -> Unit,
|
||||
onClickDelete: () -> Unit,
|
||||
) {
|
||||
Crossfade(targetState = state.isEmpty.not()) { _state ->
|
||||
when (_state) {
|
||||
true -> FastScrollLazyColumn(
|
||||
contentPadding = contentPadding + WindowInsets.navigationBars.asPaddingValues(),
|
||||
state = lazyListState,
|
||||
true -> {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(contentPadding)
|
||||
.fillMaxSize(),
|
||||
) {
|
||||
FastScrollLazyColumn(
|
||||
modifier = Modifier.weight(1f),
|
||||
) {
|
||||
items(state.items) { sourceWithCount ->
|
||||
ClearDatabaseItem(
|
||||
|
@ -38,7 +48,26 @@ fun ClearDatabaseContent(
|
|||
)
|
||||
}
|
||||
}
|
||||
false -> EmptyScreen(message = stringResource(R.string.database_clean))
|
||||
|
||||
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))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.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.fillMaxHeight
|
||||
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.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.FlipToBack
|
||||
|
@ -112,7 +107,7 @@ fun UpdateScreen(
|
|||
if (presenter.selectionMode) {
|
||||
PaddingValues()
|
||||
} else {
|
||||
bottomNavPaddingValues + WindowInsets.navigationBars.only(WindowInsetsSides.Bottom).asPaddingValues()
|
||||
bottomNavPaddingValues
|
||||
}
|
||||
|
||||
val scope = rememberCoroutineScope()
|
||||
|
|
Loading…
Reference in a new issue