updating target SDK to 29, but use requestLegacyExternalStorage

This commit is contained in:
tibbi 2020-01-30 20:23:35 +01:00
parent f038da3b4f
commit 0eee2a7de5
4 changed files with 11 additions and 9 deletions

View File

@ -10,13 +10,13 @@ if (keystorePropertiesFile.exists()) {
}
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.simplemobiletools.notes.pro"
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 29
versionCode 68
versionName "6.3.1"
setProperty("archivesBaseName", "notes")

View File

@ -19,6 +19,7 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_launcher_name"
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme">

View File

@ -203,7 +203,7 @@ class MainActivity : SimpleActivity() {
val file = File(realPath)
handleUri(Uri.fromFile(file))
} else {
handleUri(data)
handleUri(data!!)
}
intent.removeCategory(Intent.CATEGORY_DEFAULT)
intent.action = null
@ -239,7 +239,7 @@ class MainActivity : SimpleActivity() {
}
private fun handleUri(uri: Uri) {
NotesHelper(this).getNoteIdWithPath(uri.path) {
NotesHelper(this).getNoteIdWithPath(uri.path!!) {
if (it != null && it > 0L) {
updateSelectedNote(it)
return@getNoteIdWithPath
@ -397,7 +397,7 @@ class MainActivity : SimpleActivity() {
private fun importUri(uri: Uri) {
when (uri.scheme) {
"file" -> openPath(uri.path)
"file" -> openPath(uri.path!!)
"content" -> {
val realPath = getRealPathFromURI(uri)
if (realPath != null) {
@ -578,12 +578,13 @@ class MainActivity : SimpleActivity() {
parent.createFile("", path.getFilenameFromPath())!!
}
contentResolver.openOutputStream(document.uri).apply {
contentResolver.openOutputStream(document.uri)!!.apply {
val byteArray = content.toByteArray(Charset.forName("UTF-8"))
write(byteArray, 0, byteArray.size)
flush()
close()
}
if (showSuccessToasts) {
noteExportedSuccessfully(path.getFilenameFromPath())
}

View File

@ -64,11 +64,11 @@ class Config(context: Context) : BaseConfig(context) {
set(enableLineWrap) = prefs.edit().putBoolean(ENABLE_LINE_WRAP, enableLineWrap).apply()
var lastUsedExtension: String
get() = prefs.getString(LAST_USED_EXTENSION, "txt")
get() = prefs.getString(LAST_USED_EXTENSION, "txt")!!
set(lastUsedExtension) = prefs.edit().putString(LAST_USED_EXTENSION, lastUsedExtension).apply()
var lastUsedSavePath: String
get() = prefs.getString(LAST_USED_SAVE_PATH, Environment.getExternalStorageDirectory().toString())
get() = prefs.getString(LAST_USED_SAVE_PATH, Environment.getExternalStorageDirectory().toString())!!
set(lastUsedSavePath) = prefs.edit().putString(LAST_USED_SAVE_PATH, lastUsedSavePath).apply()
var useIncognitoMode: Boolean