fix some file uri issues on android versions below 7

This commit is contained in:
tibbi 2017-03-07 18:55:42 +01:00
parent 4b5e391f80
commit 77ab6178d0

View file

@ -109,7 +109,13 @@ fun Activity.openEditor(file: File) {
} }
} }
fun Activity.getFileUri(file: File) = FileProvider.getUriForFile(this, "$packageName.provider", file) fun Activity.getFileUri(file: File): Uri {
val isNougat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
return if (isNougat)
FileProvider.getUriForFile(this, "$packageName.provider", file)
else
Uri.fromFile(file)
}
fun Activity.hasNavBar(): Boolean { fun Activity.hasNavBar(): Boolean {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {