Skip to content

Commit 0eee2a7

Browse files
committed
updating target SDK to 29, but use requestLegacyExternalStorage
1 parent f038da3 commit 0eee2a7

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ if (keystorePropertiesFile.exists()) {
1010
}
1111

1212
android {
13-
compileSdkVersion 28
14-
buildToolsVersion "28.0.3"
13+
compileSdkVersion 29
14+
buildToolsVersion "29.0.2"
1515

1616
defaultConfig {
1717
applicationId "com.simplemobiletools.notes.pro"
1818
minSdkVersion 21
19-
targetSdkVersion 28
19+
targetSdkVersion 29
2020
versionCode 68
2121
versionName "6.3.1"
2222
setProperty("archivesBaseName", "notes")

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
android:allowBackup="true"
2020
android:icon="@mipmap/ic_launcher"
2121
android:label="@string/app_launcher_name"
22+
android:requestLegacyExternalStorage="true"
2223
android:roundIcon="@mipmap/ic_launcher"
2324
android:supportsRtl="true"
2425
android:theme="@style/AppTheme">

app/src/main/kotlin/com/simplemobiletools/notes/pro/activities/MainActivity.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class MainActivity : SimpleActivity() {
203203
val file = File(realPath)
204204
handleUri(Uri.fromFile(file))
205205
} else {
206-
handleUri(data)
206+
handleUri(data!!)
207207
}
208208
intent.removeCategory(Intent.CATEGORY_DEFAULT)
209209
intent.action = null
@@ -239,7 +239,7 @@ class MainActivity : SimpleActivity() {
239239
}
240240

241241
private fun handleUri(uri: Uri) {
242-
NotesHelper(this).getNoteIdWithPath(uri.path) {
242+
NotesHelper(this).getNoteIdWithPath(uri.path!!) {
243243
if (it != null && it > 0L) {
244244
updateSelectedNote(it)
245245
return@getNoteIdWithPath
@@ -397,7 +397,7 @@ class MainActivity : SimpleActivity() {
397397

398398
private fun importUri(uri: Uri) {
399399
when (uri.scheme) {
400-
"file" -> openPath(uri.path)
400+
"file" -> openPath(uri.path!!)
401401
"content" -> {
402402
val realPath = getRealPathFromURI(uri)
403403
if (realPath != null) {
@@ -578,12 +578,13 @@ class MainActivity : SimpleActivity() {
578578
parent.createFile("", path.getFilenameFromPath())!!
579579
}
580580

581-
contentResolver.openOutputStream(document.uri).apply {
581+
contentResolver.openOutputStream(document.uri)!!.apply {
582582
val byteArray = content.toByteArray(Charset.forName("UTF-8"))
583583
write(byteArray, 0, byteArray.size)
584584
flush()
585585
close()
586586
}
587+
587588
if (showSuccessToasts) {
588589
noteExportedSuccessfully(path.getFilenameFromPath())
589590
}

app/src/main/kotlin/com/simplemobiletools/notes/pro/helpers/Config.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ class Config(context: Context) : BaseConfig(context) {
6464
set(enableLineWrap) = prefs.edit().putBoolean(ENABLE_LINE_WRAP, enableLineWrap).apply()
6565

6666
var lastUsedExtension: String
67-
get() = prefs.getString(LAST_USED_EXTENSION, "txt")
67+
get() = prefs.getString(LAST_USED_EXTENSION, "txt")!!
6868
set(lastUsedExtension) = prefs.edit().putString(LAST_USED_EXTENSION, lastUsedExtension).apply()
6969

7070
var lastUsedSavePath: String
71-
get() = prefs.getString(LAST_USED_SAVE_PATH, Environment.getExternalStorageDirectory().toString())
71+
get() = prefs.getString(LAST_USED_SAVE_PATH, Environment.getExternalStorageDirectory().toString())!!
7272
set(lastUsedSavePath) = prefs.edit().putString(LAST_USED_SAVE_PATH, lastUsedSavePath).apply()
7373

7474
var useIncognitoMode: Boolean

0 commit comments

Comments
 (0)