Reorder reader menu overflow items

(cherry picked from commit 788235feeca241228eac0561339dd07b5ea0b77d)

# Conflicts:
#	app/src/main/java/eu/kanade/presentation/reader/appbars/ReaderAppBars.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt
This commit is contained in:
AntsyLich 2024-10-15 03:51:11 +06:00 committed by Jobobby04
parent 62afbf8ff3
commit 95ae5211a7
4 changed files with 20 additions and 0 deletions

View File

@ -46,6 +46,7 @@ fun BottomReaderBar(
doublePages: Boolean, doublePages: Boolean,
onClickChapterList: () -> Unit, onClickChapterList: () -> Unit,
onClickWebView: (() -> Unit)?, onClickWebView: (() -> Unit)?,
onClickBrowser: (() -> Unit)?,
onClickShare: (() -> Unit)?, onClickShare: (() -> Unit)?,
onClickPageLayout: () -> Unit, onClickPageLayout: () -> Unit,
onClickShiftPage: () -> Unit, onClickShiftPage: () -> Unit,
@ -78,6 +79,15 @@ fun BottomReaderBar(
} }
} }
if (ReaderBottomButton.Browser.isIn(enabledButtons) && onClickBrowser != null) {
IconButton(onClick = onClickBrowser) {
Icon(
imageVector = Icons.Outlined.Public,
contentDescription = stringResource(MR.strings.action_open_in_browser),
)
}
}
if (ReaderBottomButton.Share.isIn(enabledButtons) && onClickShare != null) { if (ReaderBottomButton.Share.isIn(enabledButtons) && onClickShare != null) {
IconButton(onClick = onClickShare) { IconButton(onClick = onClickShare) {
Icon( Icon(

View File

@ -74,6 +74,7 @@ fun ReaderAppBars(
// bookmarked: Boolean, // bookmarked: Boolean,
// onToggleBookmarked: () -> Unit, // onToggleBookmarked: () -> Unit,
onOpenInWebView: (() -> Unit)?, onOpenInWebView: (() -> Unit)?,
onOpenInBrowser: (() -> Unit)?,
onShare: (() -> Unit)?, onShare: (() -> Unit)?,
viewer: Viewer?, viewer: Viewer?,
@ -308,6 +309,7 @@ fun ReaderAppBars(
doublePages = doublePages, doublePages = doublePages,
onClickChapterList = onClickChapterList, onClickChapterList = onClickChapterList,
onClickWebView = onOpenInWebView, onClickWebView = onOpenInWebView,
onClickBrowser = onOpenInBrowser,
onClickShare = onShare, onClickShare = onShare,
onClickPageLayout = onClickPageLayout, onClickPageLayout = onClickPageLayout,
onClickShiftPage = onClickShiftPage, onClickShiftPage = onClickShiftPage,

View File

@ -467,6 +467,7 @@ class ReaderActivity : BaseActivity() {
// bookmarked = state.bookmarked, // bookmarked = state.bookmarked,
// onToggleBookmarked = viewModel::toggleChapterBookmark, // onToggleBookmarked = viewModel::toggleChapterBookmark,
onOpenInWebView = ::openChapterInWebView.takeIf { isHttpSource }, onOpenInWebView = ::openChapterInWebView.takeIf { isHttpSource },
onOpenInBrowser = ::openChapterInBrowser.takeIf { isHttpSource },
onShare = ::shareChapter.takeIf { isHttpSource }, onShare = ::shareChapter.takeIf { isHttpSource },
viewer = state.viewer, viewer = state.viewer,
@ -912,6 +913,12 @@ class ReaderActivity : BaseActivity() {
} }
} }
private fun openChapterInBrowser() {
assistUrl?.let {
openInBrowser(it.toUri(), forceDefaultBrowser = false)
}
}
private fun shareChapter() { private fun shareChapter() {
assistUrl?.let { assistUrl?.let {
val intent = it.toUri().toShareIntent(this, type = "text/plain") val intent = it.toUri().toShareIntent(this, type = "text/plain")

View File

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