From 004e1c98ee27881f1d70b0b74a912eee81b37e94 Mon Sep 17 00:00:00 2001 From: Jay Date: Sat, 23 May 2020 04:07:36 -0400 Subject: [PATCH] Send manga/chapter/page details when sharing a chapter page --- .../java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt | 6 +++++- .../java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt | 2 +- app/src/main/res/values/strings.xml | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 3d95a58565..9a6687f8c2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -580,9 +580,13 @@ class ReaderActivity : BaseRxActivity() * 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 stream = file.getUriCompat(this) 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) flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_GRANT_READ_URI_PERMISSION type = "image/*" diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt index e87bd67c8b..85b2ee797a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt @@ -569,7 +569,7 @@ class ReaderPresenter( .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribeFirst( - { view, file -> view.onShareImageResult(file) }, + { view, file -> view.onShareImageResult(file, page) }, { _, _ -> /* Empty */ } ) } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cfb027c632..8f2c1aa9f9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -574,6 +574,7 @@ Custom filter Set as cover Cover updated + %1$s: %2$s, page %3$d Page copied to %1$s Downloading… Downloaded %1$d%%