diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt
index bbd5e91c6..b14e064e2 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt
@@ -445,13 +445,28 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
private fun setupDrawButtons() {
updateDrawColor(config.lastEditorDrawColor)
- bottom_draw_color.setOnClickListener {
+ bottom_draw_width.progress = config.lastEditorBrushSize
+ updateBrushSize(config.lastEditorBrushSize)
+
+ bottom_draw_color_clickable.setOnClickListener {
ColorPickerDialog(this, drawColor) { wasPositivePressed, color ->
if (wasPositivePressed) {
updateDrawColor(color)
}
}
}
+
+ bottom_draw_width.onSeekBarChangeListener {
+ config.lastEditorBrushSize = it
+ updateBrushSize(it)
+ }
+ }
+
+ private fun updateBrushSize(percent: Int) {
+ editor_draw_canvas.updateBrushSize(percent)
+ val scale = Math.max(0.03f, percent / 100f)
+ bottom_draw_color.scaleX = scale
+ bottom_draw_color.scaleY = scale
}
private fun updatePrimaryActionButtons() {
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt
index ef2b092e7..6b2c9879e 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt
@@ -457,4 +457,8 @@ class Config(context: Context) : BaseConfig(context) {
var lastEditorDrawColor: Int
get() = prefs.getInt(LAST_EDITOR_DRAW_COLOR, primaryColor)
set(lastEditorDrawColor) = prefs.edit().putInt(LAST_EDITOR_DRAW_COLOR, lastEditorDrawColor).apply()
+
+ var lastEditorBrushSize: Int
+ get() = prefs.getInt(LAST_EDITOR_BRUSH_SIZE, 50)
+ set(lastEditorBrushSize) = prefs.edit().putInt(LAST_EDITOR_BRUSH_SIZE, lastEditorBrushSize).apply()
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt
index f84ae3b88..90cbba1a6 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt
@@ -77,6 +77,7 @@ const val GROUP_DIRECT_SUBFOLDERS = "group_direct_subfolders"
const val SHOW_WIDGET_FOLDER_NAME = "show_widget_folder_name"
const val ALLOW_ONE_TO_ONE_ZOOM = "allow_one_to_one_zoom"
const val LAST_EDITOR_DRAW_COLOR = "last_editor_draw_color"
+const val LAST_EDITOR_BRUSH_SIZE = "last_editor_brush_size"
// slideshow
const val SLIDESHOW_INTERVAL = "slideshow_interval"
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt
index d97745055..0551cc963 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt
@@ -8,6 +8,7 @@ import android.graphics.Paint
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
+import com.simplemobiletools.gallery.pro.R
import com.simplemobiletools.gallery.pro.extensions.config
import com.simplemobiletools.gallery.pro.models.MyPath
import com.simplemobiletools.gallery.pro.models.PaintOptions
@@ -122,6 +123,10 @@ class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, at
mPaintOptions.color = newColor
}
+ fun updateBrushSize(newBrushSize: Int) {
+ mPaintOptions.strokeWidth = resources.getDimension(R.dimen.full_brush_size) * (newBrushSize / 100f)
+ }
+
fun updateBackgroundBitmap(bitmap: Bitmap) {
backgroundBitmap = bitmap
invalidate()
diff --git a/app/src/main/res/layout/bottom_editor_draw_actions.xml b/app/src/main/res/layout/bottom_editor_draw_actions.xml
index 4f2a55fbf..d88f7b995 100644
--- a/app/src/main/res/layout/bottom_editor_draw_actions.xml
+++ b/app/src/main/res/layout/bottom_editor_draw_actions.xml
@@ -7,16 +7,39 @@
android:layout_height="@dimen/bottom_actions_height"
android:layout_alignParentBottom="true">
+
+
+
+
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 936d72808..bdebf85ea 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -19,4 +19,5 @@
180dp
86dp
110dp
+ 40dp