Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6929b050 authored by tibbi's avatar tibbi
Browse files

try getting MediaContent uri in a more general way if one fails

parent a9163919
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ buildscript {
        propMinSdkVersion = 16
        propTargetSdkVersion = propCompileSdkVersion
        propVersionCode = 1
        propVersionName = '3.16.0'
        propVersionName = '3.16.1'
        kotlin_version = '1.2.30'
        support_libs = '27.1.0'
    }
+4 −0
Original line number Diff line number Diff line
@@ -204,6 +204,10 @@ fun Context.getMediaContentUri(path: String): Uri? {
        else -> MediaStore.Files.getContentUri("external")
    }

    return getMediaContent(path, uri) ?: getMediaContent(path, MediaStore.Files.getContentUri("external")) ?: null
}

fun Context.getMediaContent(path: String, uri: Uri): Uri? {
    val projection = arrayOf(MediaStore.Images.Media._ID)
    val selection = MediaStore.Images.Media.DATA + "= ?"
    val selectionArgs = arrayOf(path)