mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Add an "open in browser" button to reader menu (#1110)
* Add an "open in browser" button to reader menu Signed-off-by: Catting <5874051+mm12@users.noreply.github.com> * fixup! Add an "open in browser" button to reader menu Signed-off-by: Catting <5874051+mm12@users.noreply.github.com> --------- Signed-off-by: Catting <5874051+mm12@users.noreply.github.com>
This commit is contained in:
parent
3f1d28c383
commit
c5994e057b
2 changed files with 17 additions and 0 deletions
|
@ -45,6 +45,7 @@ fun ReaderAppBars(
|
||||||
onClickTopAppBar: () -> Unit,
|
onClickTopAppBar: () -> Unit,
|
||||||
bookmarked: Boolean,
|
bookmarked: Boolean,
|
||||||
onToggleBookmarked: () -> Unit,
|
onToggleBookmarked: () -> Unit,
|
||||||
|
onOpenInBrowser: (() -> Unit)?,
|
||||||
onOpenInWebView: (() -> Unit)?,
|
onOpenInWebView: (() -> Unit)?,
|
||||||
onShare: (() -> Unit)?,
|
onShare: (() -> Unit)?,
|
||||||
|
|
||||||
|
@ -119,6 +120,14 @@ fun ReaderAppBars(
|
||||||
onClick = onToggleBookmarked,
|
onClick = onToggleBookmarked,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
onOpenInBrowser?.let {
|
||||||
|
add(
|
||||||
|
AppBar.OverflowAction(
|
||||||
|
title = stringResource(MR.strings.action_open_in_browser),
|
||||||
|
onClick = it,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
onOpenInWebView?.let {
|
onOpenInWebView?.let {
|
||||||
add(
|
add(
|
||||||
AppBar.OverflowAction(
|
AppBar.OverflowAction(
|
||||||
|
|
|
@ -75,6 +75,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.ReaderProgressIndicator
|
||||||
import eu.kanade.tachiyomi.ui.webview.WebViewActivity
|
import eu.kanade.tachiyomi.ui.webview.WebViewActivity
|
||||||
import eu.kanade.tachiyomi.util.system.hasDisplayCutout
|
import eu.kanade.tachiyomi.util.system.hasDisplayCutout
|
||||||
import eu.kanade.tachiyomi.util.system.isNightMode
|
import eu.kanade.tachiyomi.util.system.isNightMode
|
||||||
|
import eu.kanade.tachiyomi.util.system.openInBrowser
|
||||||
import eu.kanade.tachiyomi.util.system.toShareIntent
|
import eu.kanade.tachiyomi.util.system.toShareIntent
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import eu.kanade.tachiyomi.util.view.setComposeContent
|
import eu.kanade.tachiyomi.util.view.setComposeContent
|
||||||
|
@ -389,6 +390,7 @@ class ReaderActivity : BaseActivity() {
|
||||||
onClickTopAppBar = ::openMangaScreen,
|
onClickTopAppBar = ::openMangaScreen,
|
||||||
bookmarked = state.bookmarked,
|
bookmarked = state.bookmarked,
|
||||||
onToggleBookmarked = viewModel::toggleChapterBookmark,
|
onToggleBookmarked = viewModel::toggleChapterBookmark,
|
||||||
|
onOpenInBrowser = ::openChapterInBrowser.takeIf { isHttpSource },
|
||||||
onOpenInWebView = ::openChapterInWebView.takeIf { isHttpSource },
|
onOpenInWebView = ::openChapterInWebView.takeIf { isHttpSource },
|
||||||
onShare = ::shareChapter.takeIf { isHttpSource },
|
onShare = ::shareChapter.takeIf { isHttpSource },
|
||||||
|
|
||||||
|
@ -563,6 +565,12 @@ class ReaderActivity : BaseActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun openChapterInBrowser() {
|
||||||
|
assistUrl?.let {
|
||||||
|
openInBrowser(it.toUri(), forceDefaultBrowser = false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun openChapterInWebView() {
|
private fun openChapterInWebView() {
|
||||||
val manga = viewModel.manga ?: return
|
val manga = viewModel.manga ?: return
|
||||||
val source = viewModel.getSource() ?: return
|
val source = viewModel.getSource() ?: return
|
||||||
|
|
Loading…
Reference in a new issue