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

Commit 68a68a16 authored by tibbi's avatar tibbi
Browse files

move the SD card getter in a separate function

parent 992a1e63
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ buildscript {
        propMinSdkVersion = 16
        propTargetSdkVersion = propCompileSdkVersion
        propVersionCode = 1
        propVersionName = '3.0.12'
        propVersionName = '3.0.13'
        kotlin_version = '1.2.0'
        support_libs = '27.0.2'
    }
+4 −4
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ class PropertiesDialog() {
        addProperty(R.string.path, file.parent)
        addProperty(R.string.size, "...", R.id.properties_size)

        Thread({
        Thread {
            val size = getItemSize(file).formatSize()
            activity.runOnUiThread {
                view.findViewById<TextView>(R.id.properties_size).property_value.text = size
@@ -68,7 +68,7 @@ class PropertiesDialog() {
                    }
                }
            }
        }).start()
        }.start()

        when {
            file.isDirectory -> {
@@ -130,13 +130,13 @@ class PropertiesDialog() {
        addProperty(R.string.size, "...", R.id.properties_size)
        addProperty(R.string.files_count, "...", R.id.properties_file_count)

        Thread({
        Thread {
            val size = files.sumByLong { getItemSize(it) }.formatSize()
            activity.runOnUiThread {
                view.findViewById<TextView>(R.id.properties_size).property_value.text = size.toString()
                view.findViewById<TextView>(R.id.properties_file_count).property_value.text = mFilesCnt.toString()
            }
        }).start()
        }.start()

        AlertDialog.Builder(activity)
                .setPositiveButton(R.string.ok, null)
+9 −7
Original line number Diff line number Diff line
@@ -64,19 +64,21 @@ fun Activity.showErrorToast(exception: Exception, length: Int = Toast.LENGTH_LON
@SuppressLint("NewApi")
fun Activity.appLaunched() {
    baseConfig.internalStoragePath = getInternalStoragePath()
    updateSDCardPath()
    baseConfig.appRunCount++
    if (!isThankYouInstalled() && (baseConfig.appRunCount % 50 == 0)) {
        DonateDialog(this)
    }
}

    Thread({
fun Activity.updateSDCardPath() {
    Thread {
        val oldPath = baseConfig.sdCardPath
        baseConfig.sdCardPath = getSDCardPath().trimEnd('/')
        if (oldPath != baseConfig.sdCardPath) {
            baseConfig.treeUri = ""
        }
    }).start()

    baseConfig.appRunCount++
    if (!isThankYouInstalled() && (baseConfig.appRunCount % 50 == 0)) {
        DonateDialog(this)
    }
    }.start()
}

fun Activity.isShowingSAFDialog(file: File, treeUri: String, requestCode: Int): Boolean {