mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-25 02:18:24 +01:00
Send manga/chapter/page details when sharing a chapter page
This commit is contained in:
parent
7641bb4d0d
commit
004e1c98ee
@ -580,9 +580,13 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
|||||||
* Called from the presenter when a page is ready to be shared. It shows Android's default
|
* Called from the presenter when a page is ready to be shared. It shows Android's default
|
||||||
* sharing tool.
|
* sharing tool.
|
||||||
*/
|
*/
|
||||||
fun onShareImageResult(file: File) {
|
fun onShareImageResult(file: File, page: ReaderPage) {
|
||||||
|
val manga = presenter.manga ?: return
|
||||||
|
val chapter = page.chapter.chapter
|
||||||
|
|
||||||
val stream = file.getUriCompat(this)
|
val stream = file.getUriCompat(this)
|
||||||
val intent = Intent(Intent.ACTION_SEND).apply {
|
val intent = Intent(Intent.ACTION_SEND).apply {
|
||||||
|
putExtra(Intent.EXTRA_TEXT, getString(R.string.share_page_info, manga.title, chapter.name, page.number))
|
||||||
putExtra(Intent.EXTRA_STREAM, stream)
|
putExtra(Intent.EXTRA_STREAM, stream)
|
||||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_GRANT_READ_URI_PERMISSION
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_GRANT_READ_URI_PERMISSION
|
||||||
type = "image/*"
|
type = "image/*"
|
||||||
|
@ -569,7 +569,7 @@ class ReaderPresenter(
|
|||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribeFirst(
|
.subscribeFirst(
|
||||||
{ view, file -> view.onShareImageResult(file) },
|
{ view, file -> view.onShareImageResult(file, page) },
|
||||||
{ _, _ -> /* Empty */ }
|
{ _, _ -> /* Empty */ }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -574,6 +574,7 @@
|
|||||||
<string name="custom_filter">Custom filter</string>
|
<string name="custom_filter">Custom filter</string>
|
||||||
<string name="set_as_cover">Set as cover</string>
|
<string name="set_as_cover">Set as cover</string>
|
||||||
<string name="cover_updated">Cover updated</string>
|
<string name="cover_updated">Cover updated</string>
|
||||||
|
<string name="share_page_info">%1$s: %2$s, page %3$d</string>
|
||||||
<string name="page_downloaded">Page copied to %1$s</string>
|
<string name="page_downloaded">Page copied to %1$s</string>
|
||||||
<string name="downloading">Downloading…</string>
|
<string name="downloading">Downloading…</string>
|
||||||
<string name="download_progress">Downloaded %1$d%%</string>
|
<string name="download_progress">Downloaded %1$d%%</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user