aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/src
diff options
context:
space:
mode:
authorMarvin Borner2018-09-01 19:01:29 +0200
committerMarvin Borner2018-09-01 19:01:29 +0200
commit48b79e040fa4d633d203dbcbd05eceddbedab636 (patch)
tree1fc11b1115fe3ec12212dd48828eaa7a32e7fd3c /app/src
parent8ab9ed2a0ef2a73b7e61a68321f8e99475593483 (diff)
Added undo and redo buttons
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/me/texx/Texx/PhotoEditorActivity.kt3
-rw-r--r--app/src/main/res/drawable/ic_redo_white_24dp.xml10
-rw-r--r--app/src/main/res/drawable/ic_undo_white_24dp.xml10
-rw-r--r--app/src/main/res/layout/activity_photo_editor.xml30
4 files changed, 50 insertions, 3 deletions
diff --git a/app/src/main/java/me/texx/Texx/PhotoEditorActivity.kt b/app/src/main/java/me/texx/Texx/PhotoEditorActivity.kt
index 38031ad..7fff34a 100644
--- a/app/src/main/java/me/texx/Texx/PhotoEditorActivity.kt
+++ b/app/src/main/java/me/texx/Texx/PhotoEditorActivity.kt
@@ -49,6 +49,9 @@ class PhotoEditorActivity : AppCompatActivity() {
private fun setButtonListeners(photoEditor: PhotoEditor) {
var currentlyDrawing = false
+ undoButton.setOnClickListener { photoEditor.undo() }
+ redoButton.setOnClickListener { photoEditor.redo() }
+
photoDrawButton.setOnClickListener {
currentlyDrawing = !currentlyDrawing
photoEditor.setBrushDrawingMode(currentlyDrawing)
diff --git a/app/src/main/res/drawable/ic_redo_white_24dp.xml b/app/src/main/res/drawable/ic_redo_white_24dp.xml
new file mode 100644
index 0000000..d07c380
--- /dev/null
+++ b/app/src/main/res/drawable/ic_redo_white_24dp.xml
@@ -0,0 +1,10 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:tint="#FFFFFF"
+ android:viewportHeight="24.0"
+ android:viewportWidth="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M18.4,10.6C16.55,8.99 14.15,8 11.5,8c-4.65,0 -8.58,3.03 -9.96,7.22L3.9,16c1.05,-3.19 4.05,-5.5 7.6,-5.5 1.95,0 3.73,0.72 5.12,1.88L13,16h9V7l-3.6,3.6z" />
+</vector>
diff --git a/app/src/main/res/drawable/ic_undo_white_24dp.xml b/app/src/main/res/drawable/ic_undo_white_24dp.xml
new file mode 100644
index 0000000..8c9b8dd
--- /dev/null
+++ b/app/src/main/res/drawable/ic_undo_white_24dp.xml
@@ -0,0 +1,10 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:tint="#FFFFFF"
+ android:viewportHeight="24.0"
+ android:viewportWidth="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M12.5,8c-2.65,0 -5.05,0.99 -6.9,2.6L2,7v9h9l-3.62,-3.62c1.39,-1.16 3.16,-1.88 5.12,-1.88 3.54,0 6.55,2.31 7.6,5.5l2.37,-0.78C21.08,11.03 17.15,8 12.5,8z" />
+</vector>
diff --git a/app/src/main/res/layout/activity_photo_editor.xml b/app/src/main/res/layout/activity_photo_editor.xml
index df62664..da1621f 100644
--- a/app/src/main/res/layout/activity_photo_editor.xml
+++ b/app/src/main/res/layout/activity_photo_editor.xml
@@ -33,8 +33,8 @@
<Button
android:id="@+id/photoDrawButton"
- android:layout_width="50dp"
- android:layout_height="50dp"
+ android:layout_width="30dp"
+ android:layout_height="30dp"
android:layout_marginEnd="24dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_mode_edit_white_24dp"
@@ -43,7 +43,7 @@
<com.rtugeek.android.colorseekbar.ColorSeekBar
android:id="@+id/drawColorSeekbar"
- android:layout_width="50dp"
+ android:layout_width="30dp"
android:layout_height="300dp"
android:layout_marginEnd="24dp"
android:layout_marginTop="16dp"
@@ -55,4 +55,28 @@
app:layout_constraintTop_toBottomOf="@+id/photoDrawButton"
app:thumbHeight="40dp" />
+ <Button
+ android:id="@+id/undoButton"
+ android:layout_width="30dp"
+ android:layout_height="30dp"
+ android:layout_alignParentStart="true"
+ android:layout_alignParentTop="true"
+ android:layout_marginStart="24dp"
+ android:layout_marginTop="24dp"
+ android:background="@drawable/ic_undo_white_24dp"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <Button
+ android:id="@+id/redoButton"
+ android:layout_width="30dp"
+ android:layout_height="30dp"
+ android:layout_alignParentEnd="true"
+ android:layout_alignParentTop="true"
+ android:layout_marginStart="8dp"
+ android:layout_marginTop="24dp"
+ android:background="@drawable/ic_redo_white_24dp"
+ app:layout_constraintStart_toEndOf="@+id/undoButton"
+ app:layout_constraintTop_toTopOf="parent" />
+
</android.support.constraint.ConstraintLayout> \ No newline at end of file