Reorder reader menu overflow items

(cherry picked from commit 788235feeca241228eac0561339dd07b5ea0b77d)
This commit is contained in:
AntsyLich 2024-10-15 03:51:11 +06:00 committed by Cuong-Tran
parent 7d8f96d856
commit 3e473e5698
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2
4 changed files with 27 additions and 37 deletions

View file

@ -47,10 +47,8 @@ fun BottomReaderBar(
dualPageSplitEnabled: Boolean,
doublePages: Boolean,
onClickChapterList: () -> Unit,
// KMK -->
onClickBrowser: (() -> Unit)?,
// KMK <--
onClickWebView: (() -> Unit)?,
onClickBrowser: (() -> Unit)?,
onClickShare: (() -> Unit)?,
onClickPageLayout: () -> Unit,
onClickShiftPage: () -> Unit,
@ -80,25 +78,23 @@ fun BottomReaderBar(
}
}
// KMK -->
if (ReaderBottomButton.Browser.isIn(enabledButtons) && onClickBrowser != null) {
IconButton(onClick = onClickBrowser) {
if (ReaderBottomButton.WebView.isIn(enabledButtons) && onClickWebView != null) {
IconButton(onClick = onClickWebView) {
Icon(
imageVector = Icons.Outlined.Explore,
contentDescription = stringResource(MR.strings.action_open_in_browser),
imageVector = Icons.Outlined.Public,
contentDescription = stringResource(MR.strings.action_open_in_web_view),
// KMK -->
tint = iconColor,
// KMK <--
)
}
}
// KMK <--
if (ReaderBottomButton.WebView.isIn(enabledButtons) && onClickWebView != null) {
IconButton(onClick = onClickWebView) {
if (ReaderBottomButton.Browser.isIn(enabledButtons) && onClickBrowser != null) {
IconButton(onClick = onClickBrowser) {
Icon(
imageVector = Icons.Outlined.Public,
contentDescription = stringResource(MR.strings.action_open_in_web_view),
imageVector = Icons.Outlined.Explore,
contentDescription = stringResource(MR.strings.action_open_in_browser),
// KMK -->
tint = iconColor,
// KMK <--

View file

@ -73,8 +73,8 @@ fun ReaderAppBars(
onClickTopAppBar: () -> Unit,
// bookmarked: Boolean,
// onToggleBookmarked: () -> Unit,
onOpenInBrowser: (() -> Unit)?,
onOpenInWebView: (() -> Unit)?,
onOpenInBrowser: (() -> Unit)?,
onShare: (() -> Unit)?,
viewer: Viewer?,
@ -235,14 +235,6 @@ fun ReaderAppBars(
onClick = onToggleBookmarked,
),
)
onOpenInBrowser?.let {
add(
AppBar.OverflowAction(
title = stringResource(MR.strings.action_open_in_browser),
onClick = it,
),
)
}
onOpenInWebView?.let {
add(
AppBar.OverflowAction(
@ -251,6 +243,14 @@ fun ReaderAppBars(
),
)
}
onOpenInBrowser?.let {
add(
AppBar.OverflowAction(
title = stringResource(MR.strings.action_open_in_browser),
onClick = it,
),
)
}
onShare?.let {
add(
AppBar.OverflowAction(
@ -334,10 +334,8 @@ fun ReaderAppBars(
dualPageSplitEnabled = dualPageSplitEnabled,
doublePages = doublePages,
onClickChapterList = onClickChapterList,
// KMK -->
onClickBrowser = onOpenInBrowser,
// KMK <--
onClickWebView = onOpenInWebView,
onClickBrowser = onOpenInBrowser,
onClickShare = onShare,
onClickPageLayout = onClickPageLayout,
onClickShiftPage = onClickShiftPage,

View file

@ -519,8 +519,8 @@ class ReaderActivity : BaseActivity() {
onClickTopAppBar = ::openMangaScreen,
// bookmarked = state.bookmarked,
// onToggleBookmarked = viewModel::toggleChapterBookmark,
onOpenInBrowser = ::openChapterInBrowser.takeIf { isHttpSource },
onOpenInWebView = ::openChapterInWebView.takeIf { isHttpSource },
onOpenInBrowser = ::openChapterInBrowser.takeIf { isHttpSource },
onShare = ::shareChapter.takeIf { isHttpSource },
viewer = state.viewer,
@ -1034,12 +1034,6 @@ class ReaderActivity : BaseActivity() {
}
}
private fun openChapterInBrowser() {
assistUrl?.let {
openInBrowser(it.toUri(), forceDefaultBrowser = false)
}
}
private fun openChapterInWebView() {
val manga = viewModel.manga ?: return
val source = viewModel.getSource() ?: return
@ -1049,6 +1043,12 @@ class ReaderActivity : BaseActivity() {
}
}
private fun openChapterInBrowser() {
assistUrl?.let {
openInBrowser(it.toUri(), forceDefaultBrowser = false)
}
}
private fun shareChapter() {
assistUrl?.let {
val intent = it.toUri().toShareIntent(this, type = "text/plain")

View file

@ -6,12 +6,8 @@ import tachiyomi.i18n.sy.SYMR
enum class ReaderBottomButton(val value: String, val stringRes: StringResource) {
ViewChapters("vc", MR.strings.action_view_chapters),
// KMK -->
Browser("br", MR.strings.action_open_in_browser),
// KMK <--
WebView("wb", MR.strings.action_open_in_web_view),
Browser("br", MR.strings.action_open_in_browser),
Share("sh", MR.strings.action_share),
ReadingMode("rm", MR.strings.viewer),
Rotation("rot", MR.strings.rotation_type),