updating kotlin, commons, gradle

This commit is contained in:
tibbi 2019-11-27 22:39:43 +01:00
parent 3344a71dbb
commit d8e1b45451
5 changed files with 17 additions and 17 deletions

View File

@ -7,13 +7,13 @@ def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android { android {
compileSdkVersion 28 compileSdkVersion 29
buildToolsVersion "28.0.3" buildToolsVersion "29.0.2"
defaultConfig { defaultConfig {
applicationId "com.simplemobiletools.draw.pro" applicationId "com.simplemobiletools.draw.pro"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 28 targetSdkVersion 29
versionCode 48 versionCode 48
versionName "6.0.6" versionName "6.0.6"
setProperty("archivesBaseName", "draw") setProperty("archivesBaseName", "draw")
@ -51,5 +51,5 @@ android {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:5.19.2' implementation 'com.simplemobiletools:commons:5.20.0'
} }

View File

@ -191,14 +191,14 @@ class MainActivity : SimpleActivity(), CanvasListener {
} }
private fun checkIntents() { 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 { getStoragePermission {
val uri = intent.getParcelableExtra<Uri>(Intent.EXTRA_STREAM) val uri = intent.getParcelableExtra<Uri>(Intent.EXTRA_STREAM)
tryOpenUri(uri, intent) 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 { getStoragePermission {
val imageUris = intent.getParcelableArrayListExtra<Uri>(Intent.EXTRA_STREAM) val imageUris = intent.getParcelableArrayListExtra<Uri>(Intent.EXTRA_STREAM)
imageUris.any { tryOpenUri(it, intent) } imageUris.any { tryOpenUri(it, intent) }
@ -207,8 +207,8 @@ class MainActivity : SimpleActivity(), CanvasListener {
if (intent?.action == Intent.ACTION_VIEW && intent.data != null) { if (intent?.action == Intent.ACTION_VIEW && intent.data != null) {
getStoragePermission { getStoragePermission {
val path = getRealPathFromURI(intent.data) ?: intent.dataString val path = getRealPathFromURI(intent.data!!) ?: intent.dataString
openPath(path) openPath(path!!)
} }
} }
@ -217,7 +217,7 @@ class MainActivity : SimpleActivity(), CanvasListener {
if (output != null && output is Uri) { if (output != null && output is Uri) {
isImageCaptureIntent = true isImageCaptureIntent = true
intentUri = output intentUri = output
defaultPath = output.path defaultPath = output.path!!
invalidateOptionsMenu() invalidateOptionsMenu()
} }
} }
@ -246,7 +246,7 @@ class MainActivity : SimpleActivity(), CanvasListener {
private fun tryOpenUri(uri: Uri, intent: Intent) = when { private fun tryOpenUri(uri: Uri, intent: Intent) = when {
uri.scheme == "file" -> { uri.scheme == "file" -> {
uriToLoad = uri uriToLoad = uri
openPath(uri.path) openPath(uri.path!!)
} }
uri.scheme == "content" -> { uri.scheme == "content" -> {
uriToLoad = uri uriToLoad = uri
@ -324,14 +324,14 @@ class MainActivity : SimpleActivity(), CanvasListener {
when { when {
isEditIntent -> { isEditIntent -> {
try { try {
val outputStream = contentResolver.openOutputStream(intentUri) val outputStream = contentResolver.openOutputStream(intentUri!!)
saveToOutputStream(outputStream, defaultPath.getCompressionFormat()) saveToOutputStream(outputStream, defaultPath.getCompressionFormat())
} catch (e: Exception) { } catch (e: Exception) {
showErrorToast(e) showErrorToast(e)
} }
} }
intentUri?.scheme == "content" -> { intentUri?.scheme == "content" -> {
val outputStream = contentResolver.openOutputStream(intentUri) val outputStream = contentResolver.openOutputStream(intentUri!!)
saveToOutputStream(outputStream, defaultPath.getCompressionFormat()) saveToOutputStream(outputStream, defaultPath.getCompressionFormat())
} }
else -> handlePermission(PERMISSION_WRITE_STORAGE) { else -> handlePermission(PERMISSION_WRITE_STORAGE) {
@ -497,7 +497,7 @@ class MainActivity : SimpleActivity(), CanvasListener {
override fun onRestoreInstanceState(savedInstanceState: Bundle) { override fun onRestoreInstanceState(savedInstanceState: Bundle) {
super.onRestoreInstanceState(savedInstanceState) super.onRestoreInstanceState(savedInstanceState)
lastBitmapPath = savedInstanceState.getString(BITMAP_PATH) lastBitmapPath = savedInstanceState.getString(BITMAP_PATH)!!
if (lastBitmapPath.isNotEmpty()) { if (lastBitmapPath.isNotEmpty()) {
openPath(lastBitmapPath) openPath(lastBitmapPath)
} else if (savedInstanceState.containsKey(URI_TO_LOAD)) { } else if (savedInstanceState.containsKey(URI_TO_LOAD)) {

View File

@ -27,7 +27,7 @@ class Config(context: Context) : BaseConfig(context) {
set(canvasBackgroundColor) = prefs.edit().putInt(CANVAS_BACKGROUND_COLOR, canvasBackgroundColor).apply() set(canvasBackgroundColor) = prefs.edit().putInt(CANVAS_BACKGROUND_COLOR, canvasBackgroundColor).apply()
var lastSaveFolder: String 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() set(lastSaveFolder) = prefs.edit().putString(LAST_SAVE_FOLDER, lastSaveFolder).apply()
var allowZoomingCanvas: Boolean var allowZoomingCanvas: Boolean

View File

@ -182,7 +182,7 @@ class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) {
if (mBackgroundBitmap != null) { if (mBackgroundBitmap != null) {
val left = (width - mBackgroundBitmap!!.width) / 2 val left = (width - mBackgroundBitmap!!.width) / 2
val top = (height - mBackgroundBitmap!!.height) / 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) { for ((key, value) in mPaths) {
@ -294,7 +294,7 @@ class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) {
public override fun onSaveInstanceState(): Parcelable { public override fun onSaveInstanceState(): Parcelable {
val superState = super.onSaveInstanceState() val superState = super.onSaveInstanceState()
val savedState = MyParcelable(superState) val savedState = MyParcelable(superState!!)
savedState.paths = mPaths savedState.paths = mPaths
return savedState return savedState
} }

View File

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.3.50' ext.kotlin_version = '1.3.60'
repositories { repositories {
google() google()