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:
parent
9baa52db00
commit
16a23f89a5
@ -37,6 +37,7 @@ fun LibraryToolbar(
|
|||||||
onClickInvertSelection: () -> Unit,
|
onClickInvertSelection: () -> Unit,
|
||||||
onClickFilter: () -> Unit,
|
onClickFilter: () -> Unit,
|
||||||
onClickRefresh: () -> Unit,
|
onClickRefresh: () -> Unit,
|
||||||
|
onClickGlobalUpdate: () -> Unit,
|
||||||
onClickOpenRandomManga: () -> Unit,
|
onClickOpenRandomManga: () -> Unit,
|
||||||
// SY -->
|
// SY -->
|
||||||
onClickSyncExh: (() -> Unit)?,
|
onClickSyncExh: (() -> Unit)?,
|
||||||
@ -58,6 +59,7 @@ fun LibraryToolbar(
|
|||||||
onSearchQueryChange = onSearchQueryChange,
|
onSearchQueryChange = onSearchQueryChange,
|
||||||
onClickFilter = onClickFilter,
|
onClickFilter = onClickFilter,
|
||||||
onClickRefresh = onClickRefresh,
|
onClickRefresh = onClickRefresh,
|
||||||
|
onClickGlobalUpdate = onClickGlobalUpdate,
|
||||||
onClickOpenRandomManga = onClickOpenRandomManga,
|
onClickOpenRandomManga = onClickOpenRandomManga,
|
||||||
// SY -->
|
// SY -->
|
||||||
onClickSyncExh = onClickSyncExh,
|
onClickSyncExh = onClickSyncExh,
|
||||||
@ -74,6 +76,7 @@ fun LibraryRegularToolbar(
|
|||||||
onSearchQueryChange: (String?) -> Unit,
|
onSearchQueryChange: (String?) -> Unit,
|
||||||
onClickFilter: () -> Unit,
|
onClickFilter: () -> Unit,
|
||||||
onClickRefresh: () -> Unit,
|
onClickRefresh: () -> Unit,
|
||||||
|
onClickGlobalUpdate: () -> Unit,
|
||||||
onClickOpenRandomManga: () -> Unit,
|
onClickOpenRandomManga: () -> Unit,
|
||||||
// SY -->
|
// SY -->
|
||||||
onClickSyncExh: (() -> Unit)?,
|
onClickSyncExh: (() -> Unit)?,
|
||||||
@ -110,6 +113,13 @@ fun LibraryRegularToolbar(
|
|||||||
OverflowMenu { closeMenu ->
|
OverflowMenu { closeMenu ->
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
text = { Text(text = stringResource(R.string.pref_category_library_update)) },
|
text = { Text(text = stringResource(R.string.pref_category_library_update)) },
|
||||||
|
onClick = {
|
||||||
|
onClickGlobalUpdate()
|
||||||
|
closeMenu()
|
||||||
|
},
|
||||||
|
)
|
||||||
|
DropdownMenuItem(
|
||||||
|
text = { Text(text = stringResource(R.string.action_update_category)) },
|
||||||
onClick = {
|
onClick = {
|
||||||
onClickRefresh()
|
onClickRefresh()
|
||||||
closeMenu()
|
closeMenu()
|
||||||
|
@ -342,6 +342,7 @@ private fun MangaScreenSmallImpl(
|
|||||||
onClickShare = onShareClicked,
|
onClickShare = onShareClicked,
|
||||||
onClickDownload = onDownloadActionClicked,
|
onClickDownload = onDownloadActionClicked,
|
||||||
onClickEditCategory = onEditCategoryClicked,
|
onClickEditCategory = onEditCategoryClicked,
|
||||||
|
onClickRefresh = onRefresh,
|
||||||
onClickMigrate = onMigrateClicked,
|
onClickMigrate = onMigrateClicked,
|
||||||
// SY -->
|
// SY -->
|
||||||
onClickEditInfo = onEditInfoClicked.takeIf { state.manga.favorite },
|
onClickEditInfo = onEditInfoClicked.takeIf { state.manga.favorite },
|
||||||
@ -638,6 +639,7 @@ fun MangaScreenLargeImpl(
|
|||||||
onClickShare = onShareClicked,
|
onClickShare = onShareClicked,
|
||||||
onClickDownload = onDownloadActionClicked,
|
onClickDownload = onDownloadActionClicked,
|
||||||
onClickEditCategory = onEditCategoryClicked,
|
onClickEditCategory = onEditCategoryClicked,
|
||||||
|
onClickRefresh = onRefresh,
|
||||||
onClickMigrate = onMigrateClicked,
|
onClickMigrate = onMigrateClicked,
|
||||||
// SY -->
|
// SY -->
|
||||||
onClickEditInfo = onEditInfoClicked.takeIf { state.manga.favorite },
|
onClickEditInfo = onEditInfoClicked.takeIf { state.manga.favorite },
|
||||||
|
@ -44,6 +44,7 @@ fun MangaToolbar(
|
|||||||
onClickShare: (() -> Unit)?,
|
onClickShare: (() -> Unit)?,
|
||||||
onClickDownload: ((DownloadAction) -> Unit)?,
|
onClickDownload: ((DownloadAction) -> Unit)?,
|
||||||
onClickEditCategory: (() -> Unit)?,
|
onClickEditCategory: (() -> Unit)?,
|
||||||
|
onClickRefresh: () -> Unit,
|
||||||
onClickMigrate: (() -> Unit)?,
|
onClickMigrate: (() -> Unit)?,
|
||||||
// SY -->
|
// SY -->
|
||||||
onClickEditInfo: (() -> Unit)?,
|
onClickEditInfo: (() -> Unit)?,
|
||||||
@ -115,74 +116,79 @@ fun MangaToolbar(
|
|||||||
Icon(Icons.Outlined.FilterList, contentDescription = stringResource(R.string.action_filter), tint = filterTint)
|
Icon(Icons.Outlined.FilterList, contentDescription = stringResource(R.string.action_filter), tint = filterTint)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listOfNotNull(onClickShare, onClickEditCategory, onClickMigrate, onClickEditInfo, onClickRecommend, onClickMergedSettings).isNotEmpty()) {
|
OverflowMenu { closeMenu ->
|
||||||
OverflowMenu { closeMenu ->
|
DropdownMenuItem(
|
||||||
if (onClickEditCategory != null) {
|
text = { Text(text = stringResource(R.string.action_webview_refresh)) },
|
||||||
DropdownMenuItem(
|
onClick = {
|
||||||
text = { Text(text = stringResource(R.string.action_edit_categories)) },
|
onClickRefresh()
|
||||||
onClick = {
|
closeMenu()
|
||||||
onClickEditCategory()
|
},
|
||||||
closeMenu()
|
)
|
||||||
},
|
if (onClickEditCategory != null) {
|
||||||
)
|
DropdownMenuItem(
|
||||||
}
|
text = { Text(text = stringResource(R.string.action_edit_categories)) },
|
||||||
if (onClickMigrate != null) {
|
onClick = {
|
||||||
DropdownMenuItem(
|
onClickEditCategory()
|
||||||
text = { Text(text = stringResource(R.string.action_migrate)) },
|
closeMenu()
|
||||||
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 <--
|
|
||||||
}
|
}
|
||||||
|
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) },
|
onClickSelectAll = { screenModel.selectAll(screenModel.activeCategoryIndex) },
|
||||||
onClickInvertSelection = { screenModel.invertSelection(screenModel.activeCategoryIndex) },
|
onClickInvertSelection = { screenModel.invertSelection(screenModel.activeCategoryIndex) },
|
||||||
onClickFilter = { screenModel.showSettingsDialog() },
|
onClickFilter = { screenModel.showSettingsDialog() },
|
||||||
onClickRefresh = { onClickRefresh(null) },
|
onClickRefresh = { onClickRefresh(state.categories[screenModel.activeCategoryIndex]) },
|
||||||
|
onClickGlobalUpdate = { onClickRefresh(null) },
|
||||||
onClickOpenRandomManga = {
|
onClickOpenRandomManga = {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
val randomItem = screenModel.getRandomLibraryItemForCurrentCategory()
|
val randomItem = screenModel.getRandomLibraryItemForCurrentCategory()
|
||||||
|
@ -76,6 +76,7 @@
|
|||||||
<string name="action_disable_all">Disable all</string>
|
<string name="action_disable_all">Disable all</string>
|
||||||
<string name="action_edit">Edit</string>
|
<string name="action_edit">Edit</string>
|
||||||
<string name="action_add">Add</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_open_random_manga">Open random entry</string>
|
||||||
<string name="action_add_category">Add category</string>
|
<string name="action_add_category">Add category</string>
|
||||||
<string name="action_edit_categories">Edit categories</string>
|
<string name="action_edit_categories">Edit categories</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user