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:
arkon 2023-02-26 16:58:36 -05:00 committed by Jobobby04
parent 9baa52db00
commit 16a23f89a5
5 changed files with 88 additions and 68 deletions

View File

@ -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()

View File

@ -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 },

View File

@ -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 <--
}
}
},

View File

@ -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()

View File

@ -76,6 +76,7 @@
<string name="action_disable_all">Disable all</string>
<string name="action_edit">Edit</string>
<string name="action_add">Add</string>
<string name="action_update_category">Update category</string>
<string name="action_open_random_manga">Open random entry</string>
<string name="action_add_category">Add category</string>
<string name="action_edit_categories">Edit categories</string>