Able to move 'Merge' button to overflow menu (#655)

This commit is contained in:
Tien Long Lam 2022-08-23 02:57:50 +10:00 committed by GitHub
parent 9051178701
commit ad6ffe4fec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 9 deletions

View File

@ -302,6 +302,7 @@ private fun MangaScreenSmallImpl(
onRecommendClicked = onRecommendClicked,
showMergeSettings = state.manga.source == MERGED_SOURCE_ID,
onMergedSettingsClicked = onMergedSettingsClicked,
onMergeClicked = onMergeClicked.takeIf { state.showMergeInOverflow },
// SY <--
actionModeCounter = chapters.count { it.selected },
onSelectAll = { onAllChapterSelected(true) },
@ -404,7 +405,7 @@ private fun MangaScreenSmallImpl(
onTrackingClicked = onTrackingClicked,
onEditCategory = onEditCategoryClicked,
// SY -->
onMergeClicked = onMergeClicked,
onMergeClicked = onMergeClicked.takeUnless { state.showMergeInOverflow },
// SY <--
)
}
@ -597,6 +598,7 @@ fun MangaScreenLargeImpl(
onRecommendClicked = onRecommendClicked,
showMergeSettings = state.manga.source == MERGED_SOURCE_ID,
onMergedSettingsClicked = onMergedSettingsClicked,
onMergeClicked = onMergeClicked.takeIf { state.showMergeInOverflow },
// SY <--
actionModeCounter = chapters.count { it.selected },
onSelectAll = { onAllChapterSelected(true) },
@ -678,7 +680,7 @@ fun MangaScreenLargeImpl(
onTrackingClicked = onTrackingClicked,
onEditCategory = onEditCategoryClicked,
// SY -->
onMergeClicked = onMergeClicked,
onMergeClicked = onMergeClicked.takeUnless { state.showMergeInOverflow },
// SY <--
)
// SY -->

View File

@ -55,6 +55,7 @@ fun MangaAppBar(
onEditInfoClicked: () -> Unit,
showRecommends: Boolean,
onRecommendClicked: () -> Unit,
onMergeClicked: (() -> Unit)?,
showMergeSettings: Boolean,
onMergedSettingsClicked: () -> Unit,
// SY <--
@ -205,6 +206,15 @@ fun MangaAppBar(
},
)
}
if (onMergeClicked != null) {
DropdownMenuItem(
text = { Text(text = stringResource(R.string.merge)) },
onClick = {
onMergeClicked()
onDismissRequest()
},
)
}
if (showEditInfo) {
DropdownMenuItem(
text = { Text(text = stringResource(R.string.action_edit_info)) },

View File

@ -163,7 +163,7 @@ fun MangaActionRow(
onTrackingClicked: (() -> Unit)?,
onEditCategory: (() -> Unit)?,
// SY -->
onMergeClicked: () -> Unit,
onMergeClicked: (() -> Unit)?,
// SY <--
) {
Row(modifier = modifier.padding(start = 16.dp, top = 8.dp, end = 16.dp)) {
@ -200,12 +200,14 @@ fun MangaActionRow(
)
}
// SY -->
MangaActionButton(
title = stringResource(R.string.merge),
icon = Icons.Outlined.CallMerge,
color = defaultActionButtonColor,
onClick = onMergeClicked,
)
if (onMergeClicked != null) {
MangaActionButton(
title = stringResource(R.string.merge),
icon = Icons.Outlined.CallMerge,
color = defaultActionButtonColor,
onClick = onMergeClicked,
)
}
// SY <--
}
}

View File

@ -453,6 +453,8 @@ class PreferencesHelper(val context: Context) {
fun recommendsInOverflow() = flowPrefs.getBoolean("recommends_in_overflow", false)
fun mergeInOverflow() = flowPrefs.getBoolean("merge_in_overflow", false)
fun enhancedEHentaiView() = flowPrefs.getBoolean("enhanced_e_hentai_view", true)
fun webtoonEnableZoomOut() = flowPrefs.getBoolean("webtoon_enable_zoom_out", false)

View File

@ -271,6 +271,7 @@ class MangaPresenter(
isDownloadedOnlyMode = downloadedOnlyMode,
// SY -->
showRecommendationsInOverflow = preferences.recommendsInOverflow().get(),
showMergeInOverflow = preferences.mergeInOverflow().get(),
showMergeWithAnother = smartSearched,
mergedData = null,
meta = null,
@ -1539,6 +1540,7 @@ sealed class MangaScreenState {
val meta: RaisedSearchMetadata?,
val mergedData: MergedMangaData?,
val showRecommendationsInOverflow: Boolean,
val showMergeInOverflow: Boolean,
val showMergeWithAnother: Boolean,
val pagePreviewsState: PagePreviewState,
// SY <--

View File

@ -106,6 +106,12 @@ class SettingsGeneralController : SettingsController() {
titleRes = R.string.put_recommends_in_overflow
summaryRes = R.string.put_recommends_in_overflow_summary
}
switchPreference {
bindTo(preferences.mergeInOverflow())
titleRes = R.string.put_merge_in_overflow
summaryRes = R.string.put_merge_in_overflow_summary
}
}
// <-- EXH
}

View File

@ -174,6 +174,8 @@
<string name="auto_solve_captchas_summary">Use HIGHLY EXPERIMENTAL automatic ReCAPTCHA solver. Will be grayed out if unsupported by your device.</string>
<string name="put_recommends_in_overflow">Recommendations in overflow</string>
<string name="put_recommends_in_overflow_summary">Put the recommendations button in the overflow menu instead of on the manga page</string>
<string name="put_merge_in_overflow">Merge in overflow</string>
<string name="put_merge_in_overflow_summary">Put the merge button in the overflow menu instead of on the manga page</string>
<!-- Appearance Settings -->
<string name="pref_category_navbar">Navbar</string>