From fd78586530b21dfb816b9f1d05263fe124670d30 Mon Sep 17 00:00:00 2001 From: Michal Wolski Date: Mon, 22 Jul 2024 14:00:40 +0200 Subject: [PATCH] Remove undoStackCount and redoStackCount from PhotoEditor --- .../burhanrashid52/photoeditor/PhotoEditor.kt | 18 ++---------------- .../photoeditor/PhotoEditorImpl.kt | 4 ++-- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/photoeditor/src/main/java/ja/burhanrashid52/photoeditor/PhotoEditor.kt b/photoeditor/src/main/java/ja/burhanrashid52/photoeditor/PhotoEditor.kt index 587a0762..6e7dd627 100644 --- a/photoeditor/src/main/java/ja/burhanrashid52/photoeditor/PhotoEditor.kt +++ b/photoeditor/src/main/java/ja/burhanrashid52/photoeditor/PhotoEditor.kt @@ -186,19 +186,12 @@ interface PhotoEditor { */ fun undo(): Boolean - /** - * How many undo operations are available. - * - * @return size of undo stack - */ - val undoStackCount: Int - /** * Returns whether any undo operation is available. * * @return `true` if no undo operations available, `false` otherwise */ - val isUndoAvailable get() = undoStackCount > 0 + val isUndoAvailable: Boolean /** * Redo the last operation perform on the [PhotoEditor] @@ -207,19 +200,12 @@ interface PhotoEditor { */ fun redo(): Boolean - /** - * How many redo operations are available. - * - * @return size of redo stack - */ - val redoStackCount: Int - /** * Returns whether any redo operation is available. * * @return `true` if no redo operations available, `false` otherwise */ - val isRedoAvailable get() = redoStackCount > 0 + val isRedoAvailable: Boolean /** * Removes all the edited operations performed [PhotoEditorView] diff --git a/photoeditor/src/main/java/ja/burhanrashid52/photoeditor/PhotoEditorImpl.kt b/photoeditor/src/main/java/ja/burhanrashid52/photoeditor/PhotoEditorImpl.kt index 37604ee5..8f24ae38 100644 --- a/photoeditor/src/main/java/ja/burhanrashid52/photoeditor/PhotoEditorImpl.kt +++ b/photoeditor/src/main/java/ja/burhanrashid52/photoeditor/PhotoEditorImpl.kt @@ -188,13 +188,13 @@ internal class PhotoEditorImpl @SuppressLint("ClickableViewAccessibility") const return mGraphicManager.undoView() } - override val undoStackCount: Int get() = viewState.addedViewsCount + override val isUndoAvailable get() = viewState.addedViewsCount > 0 override fun redo(): Boolean { return mGraphicManager.redoView() } - override val redoStackCount: Int get() = mGraphicManager.redoStackCount + override val isRedoAvailable get() = mGraphicManager.redoStackCount > 0 override fun clearAllViews() { mBoxHelper.clearAllViews(drawingView)