Skip to content

Commit 488f163

Browse files
committed
update commons to 3.0.21
1 parent 7bc3fb7 commit 488f163

4 files changed

Lines changed: 31 additions & 29 deletions

File tree

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ ext {
4646
}
4747

4848
dependencies {
49-
implementation 'com.simplemobiletools:commons:3.0.12'
49+
implementation 'com.simplemobiletools:commons:3.0.21'
5050

5151
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
5252
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"

app/src/main/kotlin/com/simplemobiletools/draw/dialogs/SaveImageDialog.kt

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import android.support.v7.app.AlertDialog
44
import android.view.WindowManager
55
import com.simplemobiletools.commons.dialogs.FilePickerDialog
66
import com.simplemobiletools.commons.extensions.*
7-
import com.simplemobiletools.draw.views.MyCanvas
87
import com.simplemobiletools.draw.R
9-
import com.simplemobiletools.draw.models.Svg
108
import com.simplemobiletools.draw.activities.SimpleActivity
119
import com.simplemobiletools.draw.helpers.JPG
1210
import com.simplemobiletools.draw.helpers.PNG
1311
import com.simplemobiletools.draw.helpers.SVG
12+
import com.simplemobiletools.draw.models.Svg
13+
import com.simplemobiletools.draw.views.MyCanvas
1414
import kotlinx.android.synthetic.main.dialog_save_image.view.*
1515
import java.io.File
1616
import java.io.OutputStream
@@ -43,33 +43,34 @@ class SaveImageDialog(val activity: SimpleActivity, val suggestedExtension: Stri
4343
.setNegativeButton(R.string.cancel, null)
4444
.create().apply {
4545
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
46-
activity.setupDialogStuff(view, this, R.string.save_as)
47-
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
48-
val filename = view.save_image_filename.value
49-
if (filename.isEmpty()) {
50-
activity.toast(R.string.filename_cannot_be_empty)
51-
return@setOnClickListener
52-
}
46+
activity.setupDialogStuff(view, this, R.string.save_as) {
47+
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
48+
val filename = view.save_image_filename.value
49+
if (filename.isEmpty()) {
50+
activity.toast(R.string.filename_cannot_be_empty)
51+
return@setOnClickListener
52+
}
5353

54-
val extension = when (view.save_image_radio_group.checkedRadioButtonId) {
55-
R.id.save_image_radio_png -> PNG
56-
R.id.save_image_radio_svg -> SVG
57-
else -> JPG
58-
}
54+
val extension = when (view.save_image_radio_group.checkedRadioButtonId) {
55+
R.id.save_image_radio_png -> PNG
56+
R.id.save_image_radio_svg -> SVG
57+
else -> JPG
58+
}
5959

60-
val newFile = File(realPath, "$filename.$extension")
61-
if (!newFile.name.isAValidFilename()) {
62-
activity.toast(R.string.filename_invalid_characters)
63-
return@setOnClickListener
64-
}
60+
val newFile = File(realPath, "$filename.$extension")
61+
if (!newFile.name.isAValidFilename()) {
62+
activity.toast(R.string.filename_invalid_characters)
63+
return@setOnClickListener
64+
}
6565

66-
if (saveFile(newFile)) {
67-
callback(newFile.absolutePath)
68-
dismiss()
69-
} else {
70-
activity.toast(R.string.unknown_error_occurred)
66+
if (saveFile(newFile)) {
67+
callback(newFile.absolutePath)
68+
dismiss()
69+
} else {
70+
activity.toast(R.string.unknown_error_occurred)
71+
}
7172
}
72-
})
73+
}
7374
}
7475
}
7576

app/src/main/kotlin/com/simplemobiletools/draw/views/MyCanvas.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) {
119119
}
120120

121121
fun drawBitmap(activity: Activity, path: Any) {
122-
Thread({
122+
Thread {
123123
val size = Point()
124124
activity.windowManager.defaultDisplay.getSize(size)
125125
val options = RequestOptions()
@@ -141,7 +141,7 @@ class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) {
141141
val errorMsg = String.format(activity.getString(R.string.failed_to_load_image), path)
142142
activity.toast(errorMsg)
143143
}
144-
}).start()
144+
}.start()
145145
}
146146

147147
fun addPath(path: MyPath, options: PaintOptions) {

app/src/main/res/layout/dialog_save_image.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
android:layout_height="wrap_content"
4545
android:layout_marginBottom="@dimen/activity_margin"
4646
android:singleLine="true"
47-
android:textCursorDrawable="@null"/>
47+
android:textCursorDrawable="@null"
48+
android:textSize="@dimen/normal_text_size"/>
4849

4950
<RadioGroup
5051
android:id="@+id/save_image_radio_group"

0 commit comments

Comments
 (0)