mirror of
https://github.com/FossifyOrg/File-Manager.git
synced 2026-09-21 21:25:04 -04:00
close activity after handling View intent
This commit is contained in:
1 parent
173b6f73c7
commit
83fec3db4e
2 files changed
+6
-2
No files matched your search
+1
-1
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user