update commons to 3.17.19

This commit is contained in:
tibbi 2018-03-31 14:50:49 +02:00
parent 6c0f402e51
commit de8c45fa21
6 changed files with 32 additions and 47 deletions

View File

@ -45,7 +45,7 @@ ext {
}
dependencies {
implementation 'com.simplemobiletools:commons:3.16.11'
implementation 'com.simplemobiletools:commons:3.17.19'
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"

View File

@ -48,8 +48,6 @@ class MainActivity : SimpleActivity(), CanvasListener {
private var isEraserOn = false
private var isImageCaptureIntent = false
private var storedUseEnglish = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
@ -74,15 +72,10 @@ class MainActivity : SimpleActivity(), CanvasListener {
if (!isImageCaptureIntent) {
checkWhatsNewDialog()
}
storeStateVariables()
}
override fun onResume() {
super.onResume()
if (storedUseEnglish != config.useEnglish) {
restartActivity()
return
}
val isStrokeWidthBarEnabled = config.showBrushSize
stroke_width_bar.beVisibleIf(isStrokeWidthBarEnabled)
@ -97,7 +90,6 @@ class MainActivity : SimpleActivity(), CanvasListener {
super.onPause()
config.brushColor = color
config.brushSize = strokeWidth
storeStateVariables()
if (config.preventPhoneFromSleeping) {
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}
@ -134,10 +126,6 @@ class MainActivity : SimpleActivity(), CanvasListener {
return true
}
private fun storeStateVariables() {
storedUseEnglish = config.useEnglish
}
private fun launchSettings() {
startActivity(Intent(applicationContext, SettingsActivity::class.java))
}

View File

@ -3,7 +3,6 @@ package com.simplemobiletools.draw.activities
import android.os.Bundle
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.updateTextColors
import com.simplemobiletools.commons.extensions.useEnglishToggled
import com.simplemobiletools.draw.R
import com.simplemobiletools.draw.extensions.config
import kotlinx.android.synthetic.main.activity_settings.*
@ -38,7 +37,7 @@ class SettingsActivity : SimpleActivity() {
settings_use_english_holder.setOnClickListener {
settings_use_english.toggle()
config.useEnglish = settings_use_english.isChecked
useEnglishToggled()
System.exit(0)
}
}

View File

@ -1,7 +1,6 @@
package com.simplemobiletools.draw.dialogs
import android.support.v7.app.AlertDialog
import android.view.WindowManager
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.dialogs.FilePickerDialog
import com.simplemobiletools.commons.extensions.*
@ -40,40 +39,40 @@ class SaveImageDialog(val activity: SimpleActivity, val defaultExtension: String
.setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null)
.create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
activity.setupDialogStuff(view, this, R.string.save_as) {
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
val filename = view.save_image_filename.value
if (filename.isEmpty()) {
activity.toast(R.string.filename_cannot_be_empty)
return@setOnClickListener
}
activity.setupDialogStuff(view, this, R.string.save_as) {
showKeyboard(view.save_image_filename)
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
val filename = view.save_image_filename.value
if (filename.isEmpty()) {
activity.toast(R.string.filename_cannot_be_empty)
return@setOnClickListener
}
val extension = when (view.save_image_radio_group.checkedRadioButtonId) {
R.id.save_image_radio_png -> PNG
R.id.save_image_radio_svg -> SVG
else -> JPG
}
val extension = when (view.save_image_radio_group.checkedRadioButtonId) {
R.id.save_image_radio_png -> PNG
R.id.save_image_radio_svg -> SVG
else -> JPG
}
val newPath = "${folder.trimEnd('/')}/$filename.$extension"
if (!newPath.getFilenameFromPath().isAValidFilename()) {
activity.toast(R.string.filename_invalid_characters)
return@setOnClickListener
}
val newPath = "${folder.trimEnd('/')}/$filename.$extension"
if (!newPath.getFilenameFromPath().isAValidFilename()) {
activity.toast(R.string.filename_invalid_characters)
return@setOnClickListener
}
if (activity.getDoesFilePathExist(newPath)) {
val title = String.format(activity.getString(R.string.file_already_exists_overwrite), newPath.getFilenameFromPath())
ConfirmationDialog(activity, title) {
callback(newPath)
dismiss()
if (activity.getDoesFilePathExist(newPath)) {
val title = String.format(activity.getString(R.string.file_already_exists_overwrite), newPath.getFilenameFromPath())
ConfirmationDialog(activity, title) {
callback(newPath)
dismiss()
}
} else {
callback(newPath)
dismiss()
}
}
} else {
callback(newPath)
dismiss()
}
}
}
}
}
private fun getInitialFilename(): String {

View File

@ -6,7 +6,6 @@
android:layout_height="match_parent">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/save_image_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"

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.2.21'
ext.kotlin_version = '1.2.31'
repositories {
jcenter()
@ -9,7 +9,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong