Add explicit overflow menu options to refresh library category and manga chapters list
Jetpack Compose treats mouse input differently than just mimicking a touch input, so dragging doesn't actually invoke the pull to refresh. If that changes in the future, we could consider removing these. Doesn't seem too necessary for the extensions list, so I skipped that. Closes #8455 (cherry picked from commit f03a83413689923633c8ebe5634b34c566733961) # Conflicts: # app/src/main/java/eu/kanade/presentation/manga/components/MangaToolbar.kt
This commit is contained in:
@@ -37,6 +37,7 @@ fun LibraryToolbar(
|
||||
onClickInvertSelection: () -> Unit,
|
||||
onClickFilter: () -> Unit,
|
||||
onClickRefresh: () -> Unit,
|
||||
onClickGlobalUpdate: () -> Unit,
|
||||
onClickOpenRandomManga: () -> Unit,
|
||||
// SY -->
|
||||
onClickSyncExh: (() -> Unit)?,
|
||||
@@ -58,6 +59,7 @@ fun LibraryToolbar(
|
||||
onSearchQueryChange = onSearchQueryChange,
|
||||
onClickFilter = onClickFilter,
|
||||
onClickRefresh = onClickRefresh,
|
||||
onClickGlobalUpdate = onClickGlobalUpdate,
|
||||
onClickOpenRandomManga = onClickOpenRandomManga,
|
||||
// SY -->
|
||||
onClickSyncExh = onClickSyncExh,
|
||||
@@ -74,6 +76,7 @@ fun LibraryRegularToolbar(
|
||||
onSearchQueryChange: (String?) -> Unit,
|
||||
onClickFilter: () -> Unit,
|
||||
onClickRefresh: () -> Unit,
|
||||
onClickGlobalUpdate: () -> Unit,
|
||||
onClickOpenRandomManga: () -> Unit,
|
||||
// SY -->
|
||||
onClickSyncExh: (() -> Unit)?,
|
||||
@@ -110,6 +113,13 @@ fun LibraryRegularToolbar(
|
||||
OverflowMenu { closeMenu ->
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.pref_category_library_update)) },
|
||||
onClick = {
|
||||
onClickGlobalUpdate()
|
||||
closeMenu()
|
||||
},
|
||||
)
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.action_update_category)) },
|
||||
onClick = {
|
||||
onClickRefresh()
|
||||
closeMenu()
|
||||
|
||||
@@ -342,6 +342,7 @@ private fun MangaScreenSmallImpl(
|
||||
onClickShare = onShareClicked,
|
||||
onClickDownload = onDownloadActionClicked,
|
||||
onClickEditCategory = onEditCategoryClicked,
|
||||
onClickRefresh = onRefresh,
|
||||
onClickMigrate = onMigrateClicked,
|
||||
// SY -->
|
||||
onClickEditInfo = onEditInfoClicked.takeIf { state.manga.favorite },
|
||||
@@ -638,6 +639,7 @@ fun MangaScreenLargeImpl(
|
||||
onClickShare = onShareClicked,
|
||||
onClickDownload = onDownloadActionClicked,
|
||||
onClickEditCategory = onEditCategoryClicked,
|
||||
onClickRefresh = onRefresh,
|
||||
onClickMigrate = onMigrateClicked,
|
||||
// SY -->
|
||||
onClickEditInfo = onEditInfoClicked.takeIf { state.manga.favorite },
|
||||
|
||||
@@ -44,6 +44,7 @@ fun MangaToolbar(
|
||||
onClickShare: (() -> Unit)?,
|
||||
onClickDownload: ((DownloadAction) -> Unit)?,
|
||||
onClickEditCategory: (() -> Unit)?,
|
||||
onClickRefresh: () -> Unit,
|
||||
onClickMigrate: (() -> Unit)?,
|
||||
// SY -->
|
||||
onClickEditInfo: (() -> Unit)?,
|
||||
@@ -115,74 +116,79 @@ fun MangaToolbar(
|
||||
Icon(Icons.Outlined.FilterList, contentDescription = stringResource(R.string.action_filter), tint = filterTint)
|
||||
}
|
||||
|
||||
if (listOfNotNull(onClickShare, onClickEditCategory, onClickMigrate, onClickEditInfo, onClickRecommend, onClickMergedSettings).isNotEmpty()) {
|
||||
OverflowMenu { closeMenu ->
|
||||
if (onClickEditCategory != null) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.action_edit_categories)) },
|
||||
onClick = {
|
||||
onClickEditCategory()
|
||||
closeMenu()
|
||||
},
|
||||
)
|
||||
}
|
||||
if (onClickMigrate != null) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.action_migrate)) },
|
||||
onClick = {
|
||||
onClickMigrate()
|
||||
closeMenu()
|
||||
},
|
||||
)
|
||||
}
|
||||
if (onClickShare != null) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.action_share)) },
|
||||
onClick = {
|
||||
onClickShare()
|
||||
closeMenu()
|
||||
},
|
||||
)
|
||||
}
|
||||
// SY -->
|
||||
if (onClickMerge != null) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.merge)) },
|
||||
onClick = {
|
||||
onClickMerge()
|
||||
closeMenu()
|
||||
},
|
||||
)
|
||||
}
|
||||
if (onClickEditInfo != null) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.action_edit_info)) },
|
||||
onClick = {
|
||||
onClickEditInfo()
|
||||
closeMenu()
|
||||
},
|
||||
)
|
||||
}
|
||||
if (onClickRecommend != null) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.az_recommends)) },
|
||||
onClick = {
|
||||
onClickRecommend()
|
||||
closeMenu()
|
||||
},
|
||||
)
|
||||
}
|
||||
if (onClickMergedSettings != null) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.merge_settings)) },
|
||||
onClick = {
|
||||
onClickMergedSettings()
|
||||
closeMenu()
|
||||
},
|
||||
)
|
||||
}
|
||||
// SY <--
|
||||
OverflowMenu { closeMenu ->
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.action_webview_refresh)) },
|
||||
onClick = {
|
||||
onClickRefresh()
|
||||
closeMenu()
|
||||
},
|
||||
)
|
||||
if (onClickEditCategory != null) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.action_edit_categories)) },
|
||||
onClick = {
|
||||
onClickEditCategory()
|
||||
closeMenu()
|
||||
},
|
||||
)
|
||||
}
|
||||
if (onClickMigrate != null) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.action_migrate)) },
|
||||
onClick = {
|
||||
onClickMigrate()
|
||||
closeMenu()
|
||||
},
|
||||
)
|
||||
}
|
||||
if (onClickShare != null) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.action_share)) },
|
||||
onClick = {
|
||||
onClickShare()
|
||||
closeMenu()
|
||||
},
|
||||
)
|
||||
}
|
||||
// SY -->
|
||||
if (onClickMerge != null) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.merge)) },
|
||||
onClick = {
|
||||
onClickMerge()
|
||||
closeMenu()
|
||||
},
|
||||
)
|
||||
}
|
||||
if (onClickEditInfo != null) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.action_edit_info)) },
|
||||
onClick = {
|
||||
onClickEditInfo()
|
||||
closeMenu()
|
||||
},
|
||||
)
|
||||
}
|
||||
if (onClickRecommend != null) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.az_recommends)) },
|
||||
onClick = {
|
||||
onClickRecommend()
|
||||
closeMenu()
|
||||
},
|
||||
)
|
||||
}
|
||||
if (onClickMergedSettings != null) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.merge_settings)) },
|
||||
onClick = {
|
||||
onClickMergedSettings()
|
||||
closeMenu()
|
||||
},
|
||||
)
|
||||
}
|
||||
// SY <--
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -138,7 +138,8 @@ object LibraryTab : Tab {
|
||||
onClickSelectAll = { screenModel.selectAll(screenModel.activeCategoryIndex) },
|
||||
onClickInvertSelection = { screenModel.invertSelection(screenModel.activeCategoryIndex) },
|
||||
onClickFilter = { screenModel.showSettingsDialog() },
|
||||
onClickRefresh = { onClickRefresh(null) },
|
||||
onClickRefresh = { onClickRefresh(state.categories[screenModel.activeCategoryIndex]) },
|
||||
onClickGlobalUpdate = { onClickRefresh(null) },
|
||||
onClickOpenRandomManga = {
|
||||
scope.launch {
|
||||
val randomItem = screenModel.getRandomLibraryItemForCurrentCategory()
|
||||
|
||||
Reference in New Issue
Block a user