Send manga/chapter/page details when sharing a chapter page

closes #443
Also for page_ string, removing the colon in it
This commit is contained in:
Jay 2020-05-23 04:07:36 -04:00
parent 0657d3db93
commit 32aea55f42
3 changed files with 9 additions and 3 deletions

View File

@ -645,9 +645,15 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
* Called from the presenter when a page is ready to be shared. It shows Android's default
* sharing tool.
*/
fun onShareImageResult(file: File) {
fun onShareImageResult(file: File, page: ReaderPage) {
val manga = presenter.manga ?: return
val chapter = page.chapter.chapter
val text = "${manga.title}: ${chapter.name}, ${getString(R.string.page_, page.number)}"
val stream = file.getUriCompat(this)
val intent = Intent(Intent.ACTION_SEND).apply {
putExtra(Intent.EXTRA_TEXT, text)
putExtra(Intent.EXTRA_STREAM, stream)
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_GRANT_READ_URI_PERMISSION
clipData = ClipData.newRawUri(null, stream)

View File

@ -572,7 +572,7 @@ class ReaderPresenter(
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribeFirst(
{ view, file -> view.onShareImageResult(file) },
{ view, file -> view.onShareImageResult(file, page) },
{ _, _ -> /* Empty */ }
)
}

View File

@ -268,7 +268,7 @@
<string name="set_as_cover">Set as cover</string>
<string name="set_as_default_for_all">Set as default for all</string>
<string name="cover_updated">Cover updated</string>
<string name="page_">Page: %1$d</string>
<string name="page_">Page %1$d</string>
<string name="next_chapter_not_found">Next chapter not found</string>
<string name="decode_image_error">The image could not be decoded</string>
<string name="use_image_as_cover">Use this image as cover art?</string>