Use topBar action to add favorite instead of bottomBar
some minor name changes
This commit is contained in:
parent
8ed81b91ba
commit
46ad83a79b
6 changed files with 19 additions and 46 deletions
|
|
@ -159,9 +159,7 @@ fun FeedItem(
|
|||
titles = item.results,
|
||||
getManga = getMangaState,
|
||||
onClick = onClickManga,
|
||||
/* KMK -->
|
||||
onLongClick = onClickManga,
|
||||
*/
|
||||
// KMK -->
|
||||
onLongClick = onLongClickManga,
|
||||
selection = selection,
|
||||
// KMK <--
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ fun SourceFeedScreen(
|
|||
onSearchQueryChange: (String?) -> Unit,
|
||||
getMangaState: @Composable (Manga) -> State<Manga>,
|
||||
// KMK -->
|
||||
id: Long,
|
||||
sourceId: Long,
|
||||
// KMK <--
|
||||
) {
|
||||
Scaffold(
|
||||
|
|
@ -111,7 +111,7 @@ fun SourceFeedScreen(
|
|||
scrollBehavior = scrollBehavior,
|
||||
onClickSearch = onClickSearch,
|
||||
// KMK -->
|
||||
id = id,
|
||||
sourceId = sourceId,
|
||||
// KMK <--
|
||||
)
|
||||
},
|
||||
|
|
@ -222,7 +222,7 @@ fun SourceFeedToolbar(
|
|||
scrollBehavior: TopAppBarScrollBehavior,
|
||||
onClickSearch: (String) -> Unit,
|
||||
// KMK -->
|
||||
id: Long
|
||||
sourceId: Long,
|
||||
// KMK <--
|
||||
) {
|
||||
SearchToolbar(
|
||||
|
|
@ -236,9 +236,9 @@ fun SourceFeedToolbar(
|
|||
// KMK -->
|
||||
actions = {
|
||||
persistentListOf(
|
||||
SourceSettingsButton(id)
|
||||
SourceSettingsButton(sourceId),
|
||||
)
|
||||
}
|
||||
},
|
||||
// KMK <--
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package eu.kanade.presentation.components
|
|||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.foundation.layout.calculateEndPadding
|
||||
import androidx.compose.foundation.layout.calculateStartPadding
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
|
|
@ -25,13 +24,10 @@ import androidx.compose.runtime.remember
|
|||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalLayoutDirection
|
||||
import androidx.compose.ui.zIndex
|
||||
import dev.icerock.moko.resources.StringResource
|
||||
import eu.kanade.presentation.manga.components.LibraryBottomActionMenu
|
||||
import eu.kanade.tachiyomi.ui.browse.feed.FeedScreenModel
|
||||
import eu.kanade.tachiyomi.ui.library.LibraryScreenModel
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import kotlinx.coroutines.launch
|
||||
|
|
@ -48,17 +44,15 @@ fun TabbedScreen(
|
|||
searchQuery: String? = null,
|
||||
onChangeSearchQuery: (String?) -> Unit = {},
|
||||
// KMK -->
|
||||
feedScreenModel: FeedScreenModel,
|
||||
libraryScreenModel: LibraryScreenModel,
|
||||
screenModel: FeedScreenModel,
|
||||
// KMK <--
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val scope = rememberCoroutineScope()
|
||||
val state = rememberPagerState { tabs.size }
|
||||
val snackbarHostState = remember { SnackbarHostState() }
|
||||
|
||||
// KMK -->
|
||||
val feedScreenState by feedScreenModel.state.collectAsState()
|
||||
val screenState by screenModel.state.collectAsState()
|
||||
// KMK <--
|
||||
|
||||
LaunchedEffect(startIndex) {
|
||||
|
|
@ -72,11 +66,11 @@ fun TabbedScreen(
|
|||
val tab = tabs[state.currentPage]
|
||||
val searchEnabled = tab.searchEnabled
|
||||
// KMK -->
|
||||
if (feedScreenState.selection.isNotEmpty())
|
||||
FeedSelectionToolbar(
|
||||
selectedCount = feedScreenState.selection.size,
|
||||
onClickClearSelection = feedScreenModel::clearSelection,
|
||||
actions = { AppBarActions(tab.actions) },
|
||||
if (screenState.selectionMode)
|
||||
SelectionToolbar(
|
||||
selectedCount = screenState.selection.size,
|
||||
onClickClearSelection = screenModel::clearSelection,
|
||||
onChangeCategoryClicked = screenModel::addFavorite,
|
||||
)
|
||||
else
|
||||
// KMK <--
|
||||
|
|
@ -88,21 +82,6 @@ fun TabbedScreen(
|
|||
actions = { AppBarActions(tab.actions) },
|
||||
)
|
||||
},
|
||||
// KMK -->
|
||||
bottomBar = {
|
||||
LibraryBottomActionMenu(
|
||||
visible = feedScreenState.selectionMode,
|
||||
onChangeCategoryClicked = { feedScreenModel.addFavorite() },
|
||||
onMarkAsReadClicked = { libraryScreenModel.markReadSelection(true) },
|
||||
onMarkAsUnreadClicked = { libraryScreenModel.markReadSelection(false) },
|
||||
onDownloadClicked = libraryScreenModel::runDownloadActionSelection,
|
||||
onDeleteClicked = libraryScreenModel::openDeleteMangaDialog,
|
||||
onClickCleanTitles = null,
|
||||
onClickMigrate = null,
|
||||
onClickAddToMangaDex = null,
|
||||
)
|
||||
},
|
||||
// KMK <--
|
||||
snackbarHost = { SnackbarHost(hostState = snackbarHostState) },
|
||||
) { contentPadding ->
|
||||
Column(
|
||||
|
|
@ -150,10 +129,10 @@ data class TabContent(
|
|||
|
||||
// KMK -->
|
||||
@Composable
|
||||
private fun FeedSelectionToolbar(
|
||||
private fun SelectionToolbar(
|
||||
selectedCount: Int,
|
||||
onClickClearSelection: () -> Unit = {},
|
||||
actions: @Composable RowScope.() -> Unit = {},
|
||||
onChangeCategoryClicked: () -> Unit = {},
|
||||
) {
|
||||
AppBar(
|
||||
titleContent = { Text(text = "$selectedCount") },
|
||||
|
|
@ -163,8 +142,7 @@ private fun FeedSelectionToolbar(
|
|||
AppBar.Action(
|
||||
title = stringResource(MR.strings.action_bookmark),
|
||||
icon = Icons.Outlined.BookmarkAdd,
|
||||
// TODO: method to add bookmark goes here
|
||||
onClick = { },
|
||||
onClick = onChangeCategoryClicked,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import eu.kanade.tachiyomi.ui.browse.feed.feedTab
|
|||
import eu.kanade.tachiyomi.ui.browse.migration.sources.migrateSourceTab
|
||||
import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchScreen
|
||||
import eu.kanade.tachiyomi.ui.browse.source.sourcesTab
|
||||
import eu.kanade.tachiyomi.ui.library.LibraryScreenModel
|
||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import tachiyomi.i18n.MR
|
||||
|
|
@ -69,7 +68,6 @@ data class BrowseTab(
|
|||
|
||||
// KMK -->
|
||||
val feedScreenModel = rememberScreenModel { FeedScreenModel() }
|
||||
val libraryScreenModel = rememberScreenModel { LibraryScreenModel() }
|
||||
// KMK <--
|
||||
|
||||
TabbedScreen(
|
||||
|
|
@ -101,8 +99,7 @@ data class BrowseTab(
|
|||
searchQuery = extensionsState.searchQuery,
|
||||
onChangeSearchQuery = extensionsScreenModel::search,
|
||||
// KMK -->
|
||||
feedScreenModel = feedScreenModel,
|
||||
libraryScreenModel = libraryScreenModel,
|
||||
screenModel = feedScreenModel,
|
||||
// KMK <--
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ open class FeedScreenModel(
|
|||
return mangaCategories.flatten().distinct().subtract(common)
|
||||
}
|
||||
|
||||
fun setDialog(dialog: Dialog?) {
|
||||
private fun setDialog(dialog: Dialog?) {
|
||||
mutableState.update { it.copy(dialog = dialog) }
|
||||
}
|
||||
// KMK <--
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class SourceFeedScreen(val sourceId: Long) : Screen() {
|
|||
onSearchQueryChange = screenModel::search,
|
||||
getMangaState = { screenModel.getManga(initialManga = it) },
|
||||
// KMK -->
|
||||
id = screenModel.source.id,
|
||||
sourceId = screenModel.source.id,
|
||||
// KMK <--
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue