adding an activity check at showing SAF dialog
This commit is contained in:
parent
097bb4e703
commit
368479b96b
2 changed files with 13 additions and 11 deletions
|
@ -7,7 +7,7 @@ buildscript {
|
|||
propMinSdkVersion = 21
|
||||
propTargetSdkVersion = propCompileSdkVersion
|
||||
propVersionCode = 1
|
||||
propVersionName = '5.7.6'
|
||||
propVersionName = '5.7.7'
|
||||
kotlin_version = '1.3.21'
|
||||
}
|
||||
|
||||
|
|
|
@ -91,17 +91,19 @@ fun Activity.isAppInstalledOnSDCard(): Boolean = try {
|
|||
fun Activity.isShowingSAFDialog(path: String, treeUri: String, requestCode: Int): Boolean {
|
||||
return if (needsStupidWritePermissions(path) && (treeUri.isEmpty() || !hasProperStoredTreeUri())) {
|
||||
runOnUiThread {
|
||||
WritePermissionDialog(this, false) {
|
||||
Intent(Intent.ACTION_OPEN_DOCUMENT_TREE).apply {
|
||||
putExtra("android.content.extra.SHOW_ADVANCED", true)
|
||||
if (resolveActivity(packageManager) == null) {
|
||||
type = "*/*"
|
||||
}
|
||||
if (!isDestroyed) {
|
||||
WritePermissionDialog(this, false) {
|
||||
Intent(Intent.ACTION_OPEN_DOCUMENT_TREE).apply {
|
||||
putExtra("android.content.extra.SHOW_ADVANCED", true)
|
||||
if (resolveActivity(packageManager) == null) {
|
||||
type = "*/*"
|
||||
}
|
||||
|
||||
if (resolveActivity(packageManager) != null) {
|
||||
startActivityForResult(this, requestCode)
|
||||
} else {
|
||||
toast(R.string.unknown_error_occurred)
|
||||
if (resolveActivity(packageManager) != null) {
|
||||
startActivityForResult(this, requestCode)
|
||||
} else {
|
||||
toast(R.string.unknown_error_occurred)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue