mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 13:08:00 +01:00
get file uri the old way
This commit is contained in:
parent
7710dec749
commit
f2ecf5325f
2 changed files with 6 additions and 6 deletions
|
@ -332,7 +332,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
} else {
|
} else {
|
||||||
val file = File(path)
|
val file = File(path)
|
||||||
val isVideo = file.isVideoFast()
|
val isVideo = file.isVideoFast()
|
||||||
if (isVideo && !isNougatPlus()) {
|
if (isVideo) {
|
||||||
openWith(file, false)
|
openWith(file, false)
|
||||||
} else {
|
} else {
|
||||||
Intent(this, ViewPagerActivity::class.java).apply {
|
Intent(this, ViewPagerActivity::class.java).apply {
|
||||||
|
|
|
@ -36,7 +36,7 @@ fun Activity.shareUri(medium: Medium, uri: Uri) {
|
||||||
fun Activity.shareMedium(medium: Medium) {
|
fun Activity.shareMedium(medium: Medium) {
|
||||||
val shareTitle = resources.getString(R.string.share_via)
|
val shareTitle = resources.getString(R.string.share_via)
|
||||||
val file = File(medium.path)
|
val file = File(medium.path)
|
||||||
val uri = getMyFileUri(file)
|
val uri = Uri.fromFile(file)
|
||||||
Intent().apply {
|
Intent().apply {
|
||||||
action = Intent.ACTION_SEND
|
action = Intent.ACTION_SEND
|
||||||
putExtra(Intent.EXTRA_STREAM, uri)
|
putExtra(Intent.EXTRA_STREAM, uri)
|
||||||
|
@ -54,7 +54,7 @@ fun Activity.shareMedia(media: List<Medium>) {
|
||||||
type = "image/* video/*"
|
type = "image/* video/*"
|
||||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||||
media.map { File(it.path) }
|
media.map { File(it.path) }
|
||||||
.mapTo(uris) { getMyFileUri(it) }
|
.mapTo(uris) { Uri.fromFile(it) }
|
||||||
|
|
||||||
putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris)
|
putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris)
|
||||||
startActivity(Intent.createChooser(this, shareTitle))
|
startActivity(Intent.createChooser(this, shareTitle))
|
||||||
|
@ -62,7 +62,7 @@ fun Activity.shareMedia(media: List<Medium>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Activity.setAsWallpaper(file: File) {
|
fun Activity.setAsWallpaper(file: File) {
|
||||||
val uri = getMyFileUri(file)
|
val uri = Uri.fromFile(file)
|
||||||
Intent().apply {
|
Intent().apply {
|
||||||
action = Intent.ACTION_ATTACH_DATA
|
action = Intent.ACTION_ATTACH_DATA
|
||||||
setDataAndType(uri, file.getMimeType("image/*"))
|
setDataAndType(uri, file.getMimeType("image/*"))
|
||||||
|
@ -78,7 +78,7 @@ fun Activity.setAsWallpaper(file: File) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Activity.openWith(file: File, forceChooser: Boolean = true) {
|
fun Activity.openWith(file: File, forceChooser: Boolean = true) {
|
||||||
val uri = getMyFileUri(file)
|
val uri = Uri.fromFile(file)
|
||||||
Intent().apply {
|
Intent().apply {
|
||||||
action = Intent.ACTION_VIEW
|
action = Intent.ACTION_VIEW
|
||||||
setDataAndType(uri, file.getMimeType("image/jpeg"))
|
setDataAndType(uri, file.getMimeType("image/jpeg"))
|
||||||
|
@ -94,7 +94,7 @@ fun Activity.openWith(file: File, forceChooser: Boolean = true) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Activity.openEditor(file: File) {
|
fun Activity.openEditor(file: File) {
|
||||||
val uri = getFileUri(file)
|
val uri = Uri.fromFile(file)
|
||||||
Intent().apply {
|
Intent().apply {
|
||||||
action = Intent.ACTION_EDIT
|
action = Intent.ACTION_EDIT
|
||||||
setDataAndType(uri, "image/*")
|
setDataAndType(uri, "image/*")
|
||||||
|
|
Loading…
Reference in a new issue