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))
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'
}

View File

@ -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<Uri>(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<Uri>(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)) {

View File

@ -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

View File

@ -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
}

View File

@ -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()