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 b14e064e2..0cc34a601 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
@@ -460,6 +460,10 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
config.lastEditorBrushSize = it
updateBrushSize(it)
}
+
+ bottom_draw_undo.setOnClickListener {
+ editor_draw_canvas.undo()
+ }
}
private fun updateBrushSize(percent: Int) {
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 0551cc963..8d1ee75b7 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
@@ -139,4 +139,14 @@ class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, at
draw(canvas)
return bitmap
}
+
+ fun undo() {
+ if (mPaths.isEmpty()) {
+ return
+ }
+
+ val lastKey = mPaths.keys.lastOrNull()
+ mPaths.remove(lastKey)
+ 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 d88f7b995..fb12e40b2 100644
--- a/app/src/main/res/layout/bottom_editor_draw_actions.xml
+++ b/app/src/main/res/layout/bottom_editor_draw_actions.xml
@@ -24,21 +24,34 @@
android:id="@+id/bottom_draw_color_clickable"
android:layout_width="@dimen/bottom_editor_color_picker_size"
android:layout_height="@dimen/bottom_editor_color_picker_size"
- android:layout_marginRight="@dimen/activity_margin"
+ android:layout_marginRight="@dimen/small_margin"
android:background="?attr/selectableItemBackgroundBorderless"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintRight_toRightOf="parent"
+ app:layout_constraintRight_toLeftOf="@+id/bottom_draw_undo"
app:layout_constraintTop_toTopOf="parent"/>
+
+