diff --git a/app/build.gradle b/app/build.gradle index f6a2bae..32f0cfa 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,13 +7,13 @@ def keystoreProperties = new Properties() keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) android { - compileSdkVersion 28 - buildToolsVersion "28.0.3" + compileSdkVersion 29 + buildToolsVersion "29.0.2" defaultConfig { applicationId "com.simplemobiletools.draw.pro" minSdkVersion 21 - targetSdkVersion 28 + targetSdkVersion 29 versionCode 48 versionName "6.0.6" setProperty("archivesBaseName", "draw") @@ -51,5 +51,5 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.19.2' + implementation 'com.simplemobiletools:commons:5.20.0' } diff --git a/app/src/main/kotlin/com/simplemobiletools/draw/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/draw/pro/activities/MainActivity.kt index 74206fb..ddc4a6d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/draw/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/draw/pro/activities/MainActivity.kt @@ -191,14 +191,14 @@ class MainActivity : SimpleActivity(), CanvasListener { } private fun checkIntents() { - if (intent?.action == Intent.ACTION_SEND && intent.type.startsWith("image/")) { + if (intent?.action == Intent.ACTION_SEND && intent.type?.startsWith("image/") == true) { getStoragePermission { val uri = intent.getParcelableExtra(Intent.EXTRA_STREAM) tryOpenUri(uri, intent) } } - if (intent?.action == Intent.ACTION_SEND_MULTIPLE && intent.type.startsWith("image/")) { + if (intent?.action == Intent.ACTION_SEND_MULTIPLE && intent.type?.startsWith("image/") == true) { getStoragePermission { val imageUris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM) imageUris.any { tryOpenUri(it, intent) } @@ -207,8 +207,8 @@ class MainActivity : SimpleActivity(), CanvasListener { if (intent?.action == Intent.ACTION_VIEW && intent.data != null) { getStoragePermission { - val path = getRealPathFromURI(intent.data) ?: intent.dataString - openPath(path) + val path = getRealPathFromURI(intent.data!!) ?: intent.dataString + openPath(path!!) } } @@ -217,7 +217,7 @@ class MainActivity : SimpleActivity(), CanvasListener { if (output != null && output is Uri) { isImageCaptureIntent = true intentUri = output - defaultPath = output.path + defaultPath = output.path!! invalidateOptionsMenu() } } @@ -246,7 +246,7 @@ class MainActivity : SimpleActivity(), CanvasListener { private fun tryOpenUri(uri: Uri, intent: Intent) = when { uri.scheme == "file" -> { uriToLoad = uri - openPath(uri.path) + openPath(uri.path!!) } uri.scheme == "content" -> { uriToLoad = uri @@ -324,14 +324,14 @@ class MainActivity : SimpleActivity(), CanvasListener { when { isEditIntent -> { try { - val outputStream = contentResolver.openOutputStream(intentUri) + val outputStream = contentResolver.openOutputStream(intentUri!!) saveToOutputStream(outputStream, defaultPath.getCompressionFormat()) } catch (e: Exception) { showErrorToast(e) } } intentUri?.scheme == "content" -> { - val outputStream = contentResolver.openOutputStream(intentUri) + val outputStream = contentResolver.openOutputStream(intentUri!!) saveToOutputStream(outputStream, defaultPath.getCompressionFormat()) } else -> handlePermission(PERMISSION_WRITE_STORAGE) { @@ -497,7 +497,7 @@ class MainActivity : SimpleActivity(), CanvasListener { override fun onRestoreInstanceState(savedInstanceState: Bundle) { super.onRestoreInstanceState(savedInstanceState) - lastBitmapPath = savedInstanceState.getString(BITMAP_PATH) + lastBitmapPath = savedInstanceState.getString(BITMAP_PATH)!! if (lastBitmapPath.isNotEmpty()) { openPath(lastBitmapPath) } else if (savedInstanceState.containsKey(URI_TO_LOAD)) { diff --git a/app/src/main/kotlin/com/simplemobiletools/draw/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/draw/pro/helpers/Config.kt index 7b42ae0..2b513fa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/draw/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/draw/pro/helpers/Config.kt @@ -27,7 +27,7 @@ class Config(context: Context) : BaseConfig(context) { set(canvasBackgroundColor) = prefs.edit().putInt(CANVAS_BACKGROUND_COLOR, canvasBackgroundColor).apply() var lastSaveFolder: String - get() = prefs.getString(LAST_SAVE_FOLDER, "") + get() = prefs.getString(LAST_SAVE_FOLDER, "")!! set(lastSaveFolder) = prefs.edit().putString(LAST_SAVE_FOLDER, lastSaveFolder).apply() var allowZoomingCanvas: Boolean diff --git a/app/src/main/kotlin/com/simplemobiletools/draw/pro/views/MyCanvas.kt b/app/src/main/kotlin/com/simplemobiletools/draw/pro/views/MyCanvas.kt index 9ba9e25..091f2f7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/draw/pro/views/MyCanvas.kt +++ b/app/src/main/kotlin/com/simplemobiletools/draw/pro/views/MyCanvas.kt @@ -182,7 +182,7 @@ class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) { if (mBackgroundBitmap != null) { val left = (width - mBackgroundBitmap!!.width) / 2 val top = (height - mBackgroundBitmap!!.height) / 2 - canvas.drawBitmap(mBackgroundBitmap, left.toFloat(), top.toFloat(), null) + canvas.drawBitmap(mBackgroundBitmap!!, left.toFloat(), top.toFloat(), null) } for ((key, value) in mPaths) { @@ -294,7 +294,7 @@ class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) { public override fun onSaveInstanceState(): Parcelable { val superState = super.onSaveInstanceState() - val savedState = MyParcelable(superState) + val savedState = MyParcelable(superState!!) savedState.paths = mPaths return savedState } diff --git a/build.gradle b/build.gradle index 632456e..4b51eb4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.3.60' repositories { google()