Loading build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ buildscript { propMinSdkVersion = 16 propTargetSdkVersion = propCompileSdkVersion propVersionCode = 1 propVersionName = '4.4.26' propVersionName = '4.4.27' kotlin_version = '1.2.51' support_libs = '27.1.1' } Loading commons/src/main/kotlin/com/simplemobiletools/commons/activities/BaseSimpleActivity.kt +7 −0 Original line number Diff line number Diff line Loading @@ -381,4 +381,11 @@ abstract class BaseSimpleActivity : AppCompatActivity() { } } } fun checkAppOnSDCard() { if (!baseConfig.wasAppOnSDShown && isAppInstalledOnSDCard()) { baseConfig.wasAppOnSDShown = true ConfirmationDialog(this, "", R.string.app_on_sd_card, R.string.ok, 0) {} } } } commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt +8 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ package com.simplemobiletools.commons.extensions import android.annotation.SuppressLint import android.app.Activity import android.content.* import android.content.pm.ApplicationInfo import android.content.pm.PackageManager import android.graphics.drawable.ColorDrawable import android.media.RingtoneManager Loading Loading @@ -118,6 +119,13 @@ fun Activity.appLaunched(appId: String) { } } fun Activity.isAppInstalledOnSDCard(): Boolean = try { val applicationInfo = packageManager.getPackageInfo(packageName, 0).applicationInfo (applicationInfo.flags and ApplicationInfo.FLAG_EXTERNAL_STORAGE) == ApplicationInfo.FLAG_EXTERNAL_STORAGE } catch (e: Exception) { false } @SuppressLint("InlinedApi") fun Activity.isShowingSAFDialog(path: String, treeUri: String, requestCode: Int): Boolean { return if (needsStupidWritePermissions(path) && (treeUri.isEmpty() || !hasProperStoredTreeUri())) { Loading commons/src/main/kotlin/com/simplemobiletools/commons/helpers/BaseConfig.kt +4 −0 Original line number Diff line number Diff line Loading @@ -258,4 +258,8 @@ open class BaseConfig(val context: Context) { var wasOrangeIconChecked: Boolean get() = prefs.getBoolean(WAS_ORANGE_ICON_CHECKED, false) set(wasOrangeIconChecked) = prefs.edit().putBoolean(WAS_ORANGE_ICON_CHECKED, wasOrangeIconChecked).apply() var wasAppOnSDShown: Boolean get() = prefs.getBoolean(WAS_APP_ON_SD_SHOWN, false) set(wasAppOnSDShown) = prefs.edit().putBoolean(WAS_APP_ON_SD_SHOWN, wasAppOnSDShown).apply() } commons/src/main/kotlin/com/simplemobiletools/commons/helpers/Constants.kt +1 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ const val IS_USING_MODIFIED_APP_ICON = "is_using_modified_app_icon" const val INITIAL_WIDGET_HEIGHT = "initial_widget_height" const val WIDGET_ID_TO_MEASURE = "widget_id_to_measure" const val WAS_ORANGE_ICON_CHECKED = "was_orange_icon_checked" const val WAS_APP_ON_SD_SHOWN = "was_app_on_sd_shown" // licenses internal const val LICENSE_KOTLIN = 1 Loading Loading
build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ buildscript { propMinSdkVersion = 16 propTargetSdkVersion = propCompileSdkVersion propVersionCode = 1 propVersionName = '4.4.26' propVersionName = '4.4.27' kotlin_version = '1.2.51' support_libs = '27.1.1' } Loading
commons/src/main/kotlin/com/simplemobiletools/commons/activities/BaseSimpleActivity.kt +7 −0 Original line number Diff line number Diff line Loading @@ -381,4 +381,11 @@ abstract class BaseSimpleActivity : AppCompatActivity() { } } } fun checkAppOnSDCard() { if (!baseConfig.wasAppOnSDShown && isAppInstalledOnSDCard()) { baseConfig.wasAppOnSDShown = true ConfirmationDialog(this, "", R.string.app_on_sd_card, R.string.ok, 0) {} } } }
commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt +8 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ package com.simplemobiletools.commons.extensions import android.annotation.SuppressLint import android.app.Activity import android.content.* import android.content.pm.ApplicationInfo import android.content.pm.PackageManager import android.graphics.drawable.ColorDrawable import android.media.RingtoneManager Loading Loading @@ -118,6 +119,13 @@ fun Activity.appLaunched(appId: String) { } } fun Activity.isAppInstalledOnSDCard(): Boolean = try { val applicationInfo = packageManager.getPackageInfo(packageName, 0).applicationInfo (applicationInfo.flags and ApplicationInfo.FLAG_EXTERNAL_STORAGE) == ApplicationInfo.FLAG_EXTERNAL_STORAGE } catch (e: Exception) { false } @SuppressLint("InlinedApi") fun Activity.isShowingSAFDialog(path: String, treeUri: String, requestCode: Int): Boolean { return if (needsStupidWritePermissions(path) && (treeUri.isEmpty() || !hasProperStoredTreeUri())) { Loading
commons/src/main/kotlin/com/simplemobiletools/commons/helpers/BaseConfig.kt +4 −0 Original line number Diff line number Diff line Loading @@ -258,4 +258,8 @@ open class BaseConfig(val context: Context) { var wasOrangeIconChecked: Boolean get() = prefs.getBoolean(WAS_ORANGE_ICON_CHECKED, false) set(wasOrangeIconChecked) = prefs.edit().putBoolean(WAS_ORANGE_ICON_CHECKED, wasOrangeIconChecked).apply() var wasAppOnSDShown: Boolean get() = prefs.getBoolean(WAS_APP_ON_SD_SHOWN, false) set(wasAppOnSDShown) = prefs.edit().putBoolean(WAS_APP_ON_SD_SHOWN, wasAppOnSDShown).apply() }
commons/src/main/kotlin/com/simplemobiletools/commons/helpers/Constants.kt +1 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ const val IS_USING_MODIFIED_APP_ICON = "is_using_modified_app_icon" const val INITIAL_WIDGET_HEIGHT = "initial_widget_height" const val WIDGET_ID_TO_MEASURE = "widget_id_to_measure" const val WAS_ORANGE_ICON_CHECKED = "was_orange_icon_checked" const val WAS_APP_ON_SD_SHOWN = "was_app_on_sd_shown" // licenses internal const val LICENSE_KOTLIN = 1 Loading