From f85cbb158257f61d70b79e230671e3fa252a32c5 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 18 Sep 2022 18:38:22 -0400 Subject: [PATCH] Replace clear database FAB with button Also remove a bunch of unnecessary inset paddings since Scaffold handles it --- .../browse/ExtensionDetailsScreen.kt | 8 +-- .../browse/ExtensionFilterScreen.kt | 12 ++-- .../presentation/browse/MigrateMangaScreen.kt | 12 ++-- .../browse/SourcesFilterScreen.kt | 12 ++-- .../eu/kanade/presentation/more/MoreScreen.kt | 7 +- .../presentation/more/about/AboutScreen.kt | 7 +- .../presentation/more/about/LicensesScreen.kt | 8 +-- .../more/settings/SettingsMainScreen.kt | 8 +-- .../more/settings/SettingsSearchScreen.kt | 12 ++-- .../settings/database/ClearDatabaseScreen.kt | 16 +---- .../components/ClearDatabaseContent.kt | 65 ++++++++++++++----- .../ClearDatabaseFloatingActionButton.kt | 43 ------------ .../presentation/updates/UpdatesScreen.kt | 7 +- 13 files changed, 77 insertions(+), 140 deletions(-) delete mode 100644 app/src/main/java/eu/kanade/presentation/more/settings/database/components/ClearDatabaseFloatingActionButton.kt diff --git a/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt index 8ea7c6d1e..0cf5e57d2 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt @@ -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 -> diff --git a/app/src/main/java/eu/kanade/presentation/browse/ExtensionFilterScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/ExtensionFilterScreen.kt index af2176bf6..8d85d7fdf 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/ExtensionFilterScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/ExtensionFilterScreen.kt @@ -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, diff --git a/app/src/main/java/eu/kanade/presentation/browse/MigrateMangaScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/MigrateMangaScreen.kt index a0a06519b..7dbf09899 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/MigrateMangaScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/MigrateMangaScreen.kt @@ -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( diff --git a/app/src/main/java/eu/kanade/presentation/browse/SourcesFilterScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/SourcesFilterScreen.kt index 13cf93b4a..7940b47a9 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/SourcesFilterScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/SourcesFilterScreen.kt @@ -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, diff --git a/app/src/main/java/eu/kanade/presentation/more/MoreScreen.kt b/app/src/main/java/eu/kanade/presentation/more/MoreScreen.kt index 25c12c905..df8f3b240 100644 --- a/app/src/main/java/eu/kanade/presentation/more/MoreScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/MoreScreen.kt @@ -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() diff --git a/app/src/main/java/eu/kanade/presentation/more/about/AboutScreen.kt b/app/src/main/java/eu/kanade/presentation/more/about/AboutScreen.kt index 89d636a6c..e14a75cab 100644 --- a/app/src/main/java/eu/kanade/presentation/more/about/AboutScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/about/AboutScreen.kt @@ -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() diff --git a/app/src/main/java/eu/kanade/presentation/more/about/LicensesScreen.kt b/app/src/main/java/eu/kanade/presentation/more/about/LicensesScreen.kt index cfca9441a..14bfb2222 100644 --- a/app/src/main/java/eu/kanade/presentation/more/about/LicensesScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/about/LicensesScreen.kt @@ -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, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/SettingsMainScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/SettingsMainScreen.kt index 8fd7b5b00..90a526287 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/SettingsMainScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/SettingsMainScreen.kt @@ -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 { diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/SettingsSearchScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/SettingsSearchScreen.kt index af391d461..0a860d439 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/SettingsSearchScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/SettingsSearchScreen.kt @@ -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, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/database/ClearDatabaseScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/database/ClearDatabaseScreen.kt index 54601e092..29472a5f1 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/database/ClearDatabaseScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/database/ClearDatabaseScreen.kt @@ -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 diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/database/components/ClearDatabaseContent.kt b/app/src/main/java/eu/kanade/presentation/more/settings/database/components/ClearDatabaseContent.kt index fe9b3b085..5ea34717d 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/database/components/ClearDatabaseContent.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/database/components/ClearDatabaseContent.kt @@ -1,44 +1,73 @@ 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, - ) { - items(state.items) { sourceWithCount -> - ClearDatabaseItem( - source = sourceWithCount.source, - count = sourceWithCount.count, - isSelected = state.selection.contains(sourceWithCount.id), - onClickSelect = { onClickSelection(sourceWithCount.source) }, - ) + true -> { + Column( + modifier = Modifier + .padding(contentPadding) + .fillMaxSize(), + ) { + FastScrollLazyColumn( + modifier = Modifier.weight(1f), + ) { + 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)) + } } } } diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/database/components/ClearDatabaseFloatingActionButton.kt b/app/src/main/java/eu/kanade/presentation/more/settings/database/components/ClearDatabaseFloatingActionButton.kt deleted file mode 100644 index fe6b2bbdb..000000000 --- a/app/src/main/java/eu/kanade/presentation/more/settings/database/components/ClearDatabaseFloatingActionButton.kt +++ /dev/null @@ -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(), - ) - } -} diff --git a/app/src/main/java/eu/kanade/presentation/updates/UpdatesScreen.kt b/app/src/main/java/eu/kanade/presentation/updates/UpdatesScreen.kt index 463991424..e22589fe1 100644 --- a/app/src/main/java/eu/kanade/presentation/updates/UpdatesScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/updates/UpdatesScreen.kt @@ -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()