Skip to content

Commit

Permalink
updating target SDK to 29, but use requestLegacyExternalStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
tibbi committed Jan 30, 2020
1 parent f038da3 commit 0eee2a7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0eee2a7

Please sign in to comment.