From d9ee3220a3eebd5ffb211b4748cec162e5d8d45a Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 5 Oct 2017 19:09:41 +0200 Subject: [PATCH] always check internal storage path and sd card path at startup --- .../simplemobiletools/commons/extensions/Activity.kt | 10 ++++------ .../simplemobiletools/commons/extensions/Context.kt | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt index 390eb6025..f17975831 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt @@ -56,13 +56,11 @@ fun Activity.showErrorToast(exception: Exception, length: Int = Toast.LENGTH_LON @SuppressLint("NewApi") fun Activity.storeStoragePaths() { - if (baseConfig.appRunCount == 0) { - baseConfig.internalStoragePath = getInternalStoragePath() + baseConfig.internalStoragePath = getInternalStoragePath() - Thread({ - baseConfig.sdCardPath = getSDCardPath().trimEnd('/') - }).start() - } + Thread({ + baseConfig.sdCardPath = getSDCardPath().trimEnd('/') + }).start() baseConfig.appRunCount++ if (!isThankYouInstalled() && (baseConfig.appRunCount == 50 || baseConfig.appRunCount == 300 || baseConfig.appRunCount == 1000)) { diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context.kt index 8623bc7d1..0271b8c33 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context.kt @@ -26,7 +26,6 @@ import com.simplemobiletools.commons.helpers.PREFS_KEY import com.simplemobiletools.commons.views.* import kotlinx.android.synthetic.main.dialog_title.view.* - fun Context.isOnMainThread() = Looper.myLooper() == Looper.getMainLooper() fun Context.getSharedPrefs() = getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE)