From f2ecf5325f0f8df981b3ddd082274141deda9a34 Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Thu, 9 Mar 2017 09:33:08 +0100 Subject: [PATCH] get file uri the old way --- .../gallery/activities/MediaActivity.kt | 2 +- .../simplemobiletools/gallery/extensions/activity.kt | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 803f741f3..48f818bcd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -332,7 +332,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } else { val file = File(path) val isVideo = file.isVideoFast() - if (isVideo && !isNougatPlus()) { + if (isVideo) { openWith(file, false) } else { Intent(this, ViewPagerActivity::class.java).apply { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt index 20ac4c952..c37c76e40 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -36,7 +36,7 @@ fun Activity.shareUri(medium: Medium, uri: Uri) { fun Activity.shareMedium(medium: Medium) { val shareTitle = resources.getString(R.string.share_via) val file = File(medium.path) - val uri = getMyFileUri(file) + val uri = Uri.fromFile(file) Intent().apply { action = Intent.ACTION_SEND putExtra(Intent.EXTRA_STREAM, uri) @@ -54,7 +54,7 @@ fun Activity.shareMedia(media: List) { type = "image/* video/*" addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) media.map { File(it.path) } - .mapTo(uris) { getMyFileUri(it) } + .mapTo(uris) { Uri.fromFile(it) } putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris) startActivity(Intent.createChooser(this, shareTitle)) @@ -62,7 +62,7 @@ fun Activity.shareMedia(media: List) { } fun Activity.setAsWallpaper(file: File) { - val uri = getMyFileUri(file) + val uri = Uri.fromFile(file) Intent().apply { action = Intent.ACTION_ATTACH_DATA setDataAndType(uri, file.getMimeType("image/*")) @@ -78,7 +78,7 @@ fun Activity.setAsWallpaper(file: File) { } fun Activity.openWith(file: File, forceChooser: Boolean = true) { - val uri = getMyFileUri(file) + val uri = Uri.fromFile(file) Intent().apply { action = Intent.ACTION_VIEW setDataAndType(uri, file.getMimeType("image/jpeg")) @@ -94,7 +94,7 @@ fun Activity.openWith(file: File, forceChooser: Boolean = true) { } fun Activity.openEditor(file: File) { - val uri = getFileUri(file) + val uri = Uri.fromFile(file) Intent().apply { action = Intent.ACTION_EDIT setDataAndType(uri, "image/*")