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 ac7a86a7f..46a73383f 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 @@ -478,13 +478,12 @@ class ReaderActivity : BaseRxActivity() { if (page.status != Page.READY) return - val shareIntent = Intent().apply { - action = Intent.ACTION_SEND + val intent = Intent(Intent.ACTION_SEND).apply { putExtra(Intent.EXTRA_STREAM, page.uri) flags = Intent.FLAG_ACTIVITY_NEW_TASK - type = "image/jpeg" + type = "image/*" } - startActivity(Intent.createChooser(shareIntent, resources.getText(R.string.action_share))) + startActivity(Intent.createChooser(intent, getString(R.string.action_share))) } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/notification/ImageNotificationReceiver.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/notification/ImageNotificationReceiver.kt index 2c2a83d4e..d3a4d1365 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/notification/ImageNotificationReceiver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/notification/ImageNotificationReceiver.kt @@ -45,13 +45,12 @@ class ImageNotificationReceiver : BroadcastReceiver() { * @param path path of file */ private fun shareImage(context: Context, path: String) { - val shareIntent = Intent().apply { - action = Intent.ACTION_SEND + val intent = Intent(Intent.ACTION_SEND).apply { + flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK putExtra(Intent.EXTRA_STREAM, Uri.parse(path)) - type = "image/jpeg" + type = "image/*" } - context.startActivity(Intent.createChooser(shareIntent, context.resources.getText(R.string.action_share)) - .apply { flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK }) + context.startActivity(Intent.createChooser(intent, context.getString(R.string.action_share))) } /** @@ -60,10 +59,9 @@ class ImageNotificationReceiver : BroadcastReceiver() { * @param path path of file */ private fun showImage(context: Context, path: String) { - val intent = Intent().apply { - action = Intent.ACTION_VIEW + val intent = Intent(Intent.ACTION_VIEW).apply { flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK or Intent.FLAG_GRANT_READ_URI_PERMISSION - val uri = FileProvider.getUriForFile(context,"eu.kanade.tachiyomi.provider",File(path)) + val uri = FileProvider.getUriForFile(context, "eu.kanade.tachiyomi.provider", File(path)) setDataAndType(uri, "image/*") } context.startActivity(intent)