Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2d906dd authored by tibbi's avatar tibbi
Browse files

fix selecting root folder of OTG devices at the storage picker dialog

parent 3d19426f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ buildscript {
        propMinSdkVersion = 16
        propTargetSdkVersion = propCompileSdkVersion
        propVersionCode = 1
        propVersionName = '3.11.43'
        propVersionName = '3.11.44'
        kotlin_version = '1.2.21'
        support_libs = '27.0.2'
    }
+4 −4
Original line number Diff line number Diff line
@@ -153,18 +153,18 @@ class FilePickerDialog(val activity: BaseSimpleActivity,
        if (currPath.startsWith(OTG_PATH)) {
            val fileDocument = activity.getSomeDocumentFile(currPath) ?: return
            if ((pickFile && fileDocument.isFile) || (!pickFile && fileDocument.isDirectory)) {
                sendSuccess(fileDocument.uri.toString())
                sendSuccess()
            }
        } else {
            val file = File(currPath)
            if ((pickFile && file.isFile) || (!pickFile && file.isDirectory)) {
                sendSuccess(currPath)
                sendSuccess()
            }
        }
    }

    private fun sendSuccess(path: String) {
        callback(if (path.length == 1) path else path.trimEnd('/'))
    private fun sendSuccess() {
        callback(if (currPath.length == 1) currPath else currPath.trimEnd('/'))
        mDialog.dismiss()
    }