From c9a3e97f02b051730ea93c44e85fac99ea753df7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 7 Nov 2017 19:56:09 +0100 Subject: [PATCH] minor styling update to MyPath --- .../kotlin/com/simplemobiletools/draw/MyPath.kt | 15 +++++---------- .../main/kotlin/com/simplemobiletools/draw/Svg.kt | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/draw/MyPath.kt b/app/src/main/kotlin/com/simplemobiletools/draw/MyPath.kt index df2c37e..dbad8b0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/draw/MyPath.kt +++ b/app/src/main/kotlin/com/simplemobiletools/draw/MyPath.kt @@ -15,7 +15,7 @@ import java.util.* // https://stackoverflow.com/a/8127953 class MyPath : Path(), Serializable { - private val actions = LinkedList() + val actions = LinkedList() private fun readObject(inputStream: ObjectInputStream) { inputStream.defaultReadObject() @@ -57,13 +57,10 @@ class MyPath : Path(), Serializable { } private fun addAction(action: Action) { - if (action is Move) { - moveTo(action.x, action.y) - } else if (action is Line) { - lineTo(action.x, action.y) - } else if (action is Quad) { - val q = action - quadTo(q.x1, q.y1, q.x2, q.y2) + when (action) { + is Move -> moveTo(action.x, action.y) + is Line -> lineTo(action.x, action.y) + is Quad -> quadTo(action.x1, action.y1, action.x2, action.y2) } } @@ -81,6 +78,4 @@ class MyPath : Path(), Serializable { actions.add(Quad(x1, y1, x2, y2)) super.quadTo(x1, y1, x2, y2) } - - fun getActions() = actions } diff --git a/app/src/main/kotlin/com/simplemobiletools/draw/Svg.kt b/app/src/main/kotlin/com/simplemobiletools/draw/Svg.kt index b1e9398..51c99d5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/draw/Svg.kt +++ b/app/src/main/kotlin/com/simplemobiletools/draw/Svg.kt @@ -39,7 +39,7 @@ object Svg { private fun writePath(writer: Writer, path: MyPath, options: PaintOptions) { writer.apply { write("