mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-03-29 18:00:37 +01:00
close activity after handling View intent
This commit is contained in:
parent
173b6f73c7
commit
83fec3db4e
@ -371,7 +371,7 @@ class MainActivity : SimpleActivity() {
|
||||
}
|
||||
|
||||
if (!File(data.path!!).isDirectory) {
|
||||
tryOpenPathIntent(data.path!!, false)
|
||||
tryOpenPathIntent(data.path!!, false, finishActivity = true)
|
||||
}
|
||||
} else {
|
||||
openPath(config.homeFolder)
|
||||
|
@ -16,7 +16,7 @@ fun Activity.sharePaths(paths: ArrayList<String>) {
|
||||
sharePathsIntent(paths, BuildConfig.APPLICATION_ID)
|
||||
}
|
||||
|
||||
fun Activity.tryOpenPathIntent(path: String, forceChooser: Boolean, openAsType: Int = OPEN_AS_DEFAULT) {
|
||||
fun Activity.tryOpenPathIntent(path: String, forceChooser: Boolean, openAsType: Int = OPEN_AS_DEFAULT, finishActivity: Boolean = false) {
|
||||
if (!forceChooser && path.endsWith(".apk", true)) {
|
||||
val uri = if (isNougatPlus()) {
|
||||
FileProvider.getUriForFile(this, "${BuildConfig.APPLICATION_ID}.provider", File(path))
|
||||
@ -32,6 +32,10 @@ fun Activity.tryOpenPathIntent(path: String, forceChooser: Boolean, openAsType:
|
||||
}
|
||||
} else {
|
||||
openPath(path, forceChooser, openAsType)
|
||||
|
||||
if (finishActivity) {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user