|
|
|
@ -119,8 +119,11 @@ class ImportBookActivity : VMBaseActivity<ImportBookViewModel>(R.layout.activity |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun upRootDoc() { |
|
|
|
|
AppConfig.importBookPath?.let { lastPath -> |
|
|
|
|
val lastPath = AppConfig.importBookPath |
|
|
|
|
when { |
|
|
|
|
lastPath.isNullOrEmpty() -> { |
|
|
|
|
FilePicker.selectFolder(this, requestCodeSelectFolder) |
|
|
|
|
} |
|
|
|
|
lastPath.isContentPath() -> { |
|
|
|
|
val rootUri = Uri.parse(lastPath) |
|
|
|
|
rootDoc = DocumentFile.fromTreeUri(this, rootUri) |
|
|
|
@ -130,8 +133,7 @@ class ImportBookActivity : VMBaseActivity<ImportBookViewModel>(R.layout.activity |
|
|
|
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q -> { |
|
|
|
|
FilePicker.selectFolder(this, requestCodeSelectFolder) |
|
|
|
|
} |
|
|
|
|
lastPath.isNotBlank() -> { |
|
|
|
|
PermissionsCompat.Builder(this) |
|
|
|
|
else -> PermissionsCompat.Builder(this) |
|
|
|
|
.addPermissions(*Permissions.Group.STORAGE) |
|
|
|
|
.rationale(R.string.tip_perm_request_storage) |
|
|
|
|
.onGranted { |
|
|
|
@ -142,9 +144,6 @@ class ImportBookActivity : VMBaseActivity<ImportBookViewModel>(R.layout.activity |
|
|
|
|
} |
|
|
|
|
.request() |
|
|
|
|
} |
|
|
|
|
else -> FilePicker.selectFolder(this, requestCodeSelectFolder) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressLint("SetTextI18n") |
|
|
|
|