adding an activity check at showing SAF dialog

This commit is contained in:
tibbi 2019-02-11 22:26:37 +01:00
parent 097bb4e703
commit 368479b96b
2 changed files with 13 additions and 11 deletions

View file

@ -7,7 +7,7 @@ buildscript {
propMinSdkVersion = 21
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '5.7.6'
propVersionName = '5.7.7'
kotlin_version = '1.3.21'
}

View file

@ -91,6 +91,7 @@ fun Activity.isAppInstalledOnSDCard(): Boolean = try {
fun Activity.isShowingSAFDialog(path: String, treeUri: String, requestCode: Int): Boolean {
return if (needsStupidWritePermissions(path) && (treeUri.isEmpty() || !hasProperStoredTreeUri())) {
runOnUiThread {
if (!isDestroyed) {
WritePermissionDialog(this, false) {
Intent(Intent.ACTION_OPEN_DOCUMENT_TREE).apply {
putExtra("android.content.extra.SHOW_ADVANCED", true)
@ -106,6 +107,7 @@ fun Activity.isShowingSAFDialog(path: String, treeUri: String, requestCode: Int)
}
}
}
}
true
} else {
false