Set share image mimetype with wildcard
This commit is contained in:
parent
bb89b72a81
commit
12dcc2c31f
2 changed files with 9 additions and 12 deletions
|
@ -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)))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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)
|
||||
|
|
Reference in a new issue