Skip to content

Commit 0187fb3

Browse files
committed
fix #84, handle view folder intent
1 parent f00aee0 commit 0187fb3

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@
3131
<category android:name="android.intent.category.OPENABLE"/>
3232
<category android:name="android.intent.category.DEFAULT"/>
3333
</intent-filter>
34+
35+
<intent-filter>
36+
<action android:name="android.intent.action.VIEW"/>
37+
<category android:name="android.intent.category.DEFAULT"/>
38+
<data android:mimeType="resource/folder"/>
39+
</intent-filter>
3440
</activity>
3541

3642
<activity

app/src/main/kotlin/com/simplemobiletools/filemanager/activities/MainActivity.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,20 @@ class MainActivity : SimpleActivity() {
7979
private fun tryInitFileManager() {
8080
handlePermission(PERMISSION_WRITE_STORAGE) {
8181
if (it) {
82-
initRootFileManager()
82+
initFileManager()
8383
} else {
8484
toast(R.string.no_storage_permissions)
8585
finish()
8686
}
8787
}
8888
}
8989

90-
private fun initRootFileManager() {
91-
openPath(config.homeFolder)
90+
private fun initFileManager() {
91+
if (intent.action == Intent.ACTION_VIEW && intent.data != null && intent.data.scheme == "file") {
92+
openPath(intent.data.path)
93+
} else {
94+
openPath(config.homeFolder)
95+
}
9296
}
9397

9498
private fun openPath(path: String) {

0 commit comments

Comments
 (0)