Set share image mimetype with wildcard

This commit is contained in:
len 2016-11-27 15:44:59 +01:00
parent bb89b72a81
commit 12dcc2c31f
2 changed files with 9 additions and 12 deletions

View File

@ -478,13 +478,12 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
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)))
}
/**

View File

@ -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,8 +59,7 @@ 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))
setDataAndType(uri, "image/*")