fix #84, handle view folder intent

This commit is contained in:
tibbi 2017-10-23 13:31:15 +02:00
parent f00aee04b6
commit 0187fb3c03
2 changed files with 13 additions and 3 deletions

View file

@ -31,6 +31,12 @@
<category android:name="android.intent.category.OPENABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="resource/folder"/>
</intent-filter>
</activity>
<activity

View file

@ -79,7 +79,7 @@ class MainActivity : SimpleActivity() {
private fun tryInitFileManager() {
handlePermission(PERMISSION_WRITE_STORAGE) {
if (it) {
initRootFileManager()
initFileManager()
} else {
toast(R.string.no_storage_permissions)
finish()
@ -87,8 +87,12 @@ class MainActivity : SimpleActivity() {
}
}
private fun initRootFileManager() {
openPath(config.homeFolder)
private fun initFileManager() {
if (intent.action == Intent.ACTION_VIEW && intent.data != null && intent.data.scheme == "file") {
openPath(intent.data.path)
} else {
openPath(config.homeFolder)
}
}
private fun openPath(path: String) {