diff --git a/Paintroid/src/androidTest/java/org/catrobat/paintroid/test/espresso/tools/EraserToolIntegrationTest.kt b/Paintroid/src/androidTest/java/org/catrobat/paintroid/test/espresso/tools/EraserToolIntegrationTest.kt index 987d74d499..8c7a408606 100644 --- a/Paintroid/src/androidTest/java/org/catrobat/paintroid/test/espresso/tools/EraserToolIntegrationTest.kt +++ b/Paintroid/src/androidTest/java/org/catrobat/paintroid/test/espresso/tools/EraserToolIntegrationTest.kt @@ -22,24 +22,31 @@ package org.catrobat.paintroid.test.espresso.tools import android.graphics.Color import android.graphics.Paint.Cap -import androidx.test.espresso.action.ViewActions -import androidx.test.espresso.assertion.ViewAssertions +import androidx.test.espresso.Espresso +import androidx.test.espresso.action.ViewActions.click +import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.matcher.ViewMatchers +import androidx.test.espresso.matcher.ViewMatchers.isDisplayed +import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.rule.ActivityTestRule import org.catrobat.paintroid.MainActivity import org.catrobat.paintroid.test.espresso.util.BitmapLocationProvider import org.catrobat.paintroid.test.espresso.util.DrawingSurfaceLocationProvider import org.catrobat.paintroid.test.espresso.util.EspressoUtils.DEFAULT_STROKE_WIDTH -import org.catrobat.paintroid.test.espresso.util.UiInteractions -import org.catrobat.paintroid.test.espresso.util.UiMatcher +import org.catrobat.paintroid.test.espresso.util.UiInteractions.setProgress +import org.catrobat.paintroid.test.espresso.util.UiInteractions.swipeAccurate +import org.catrobat.paintroid.test.espresso.util.UiInteractions.touchAt +import org.catrobat.paintroid.test.espresso.util.UiInteractions.waitFor +import org.catrobat.paintroid.test.espresso.util.UiMatcher.withProgress import org.catrobat.paintroid.test.espresso.util.wrappers.BrushPickerViewInteraction.Companion.onBrushPickerView import org.catrobat.paintroid.test.espresso.util.wrappers.DrawingSurfaceInteraction.Companion.onDrawingSurfaceView import org.catrobat.paintroid.test.espresso.util.wrappers.ToolBarViewInteraction.Companion.onToolBarView import org.catrobat.paintroid.test.espresso.util.wrappers.ToolPropertiesInteraction.Companion.onToolProperties +import org.catrobat.paintroid.test.espresso.util.wrappers.TopBarViewInteraction.Companion.onTopBarView import org.catrobat.paintroid.test.utils.ScreenshotOnFailRule import org.catrobat.paintroid.tools.ToolType -import org.hamcrest.Matchers +import org.hamcrest.Matchers.allOf import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith @@ -51,6 +58,7 @@ class EraserToolIntegrationTest { @get:Rule var screenshotOnFailRule = ScreenshotOnFailRule() + @Test fun testEraseOnEmptyBitmap() { onDrawingSurfaceView() @@ -58,7 +66,7 @@ class EraserToolIntegrationTest { onToolBarView() .performSelectTool(ToolType.ERASER) onDrawingSurfaceView() - .perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) onDrawingSurfaceView() .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.MIDDLE) } @@ -66,13 +74,13 @@ class EraserToolIntegrationTest { @Test fun testEraseSinglePixel() { onDrawingSurfaceView() - .perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) onDrawingSurfaceView() .checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE) onToolBarView() .performSelectTool(ToolType.ERASER) onDrawingSurfaceView() - .perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) onDrawingSurfaceView() .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.MIDDLE) } @@ -80,25 +88,25 @@ class EraserToolIntegrationTest { @Test fun testSwitchingBetweenBrushAndEraser() { onDrawingSurfaceView() - .perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) onDrawingSurfaceView() .checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE) onToolBarView() .performSelectTool(ToolType.ERASER) onDrawingSurfaceView() - .perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) onDrawingSurfaceView() .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.MIDDLE) onToolBarView() .performSelectTool(ToolType.BRUSH) onDrawingSurfaceView() - .perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) onDrawingSurfaceView() .checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE) onToolBarView() .performSelectTool(ToolType.ERASER) onDrawingSurfaceView() - .perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) onDrawingSurfaceView() .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.MIDDLE) } @@ -107,29 +115,29 @@ class EraserToolIntegrationTest { fun testChangeEraserBrushSize() { var newStrokeWidth = 90 onBrushPickerView().onStrokeWidthSeekBar() - .perform(UiInteractions.setProgress(newStrokeWidth)) - .check(ViewAssertions.matches(UiMatcher.withProgress(newStrokeWidth))) + .perform(setProgress(newStrokeWidth)) + .check(matches(withProgress(newStrokeWidth))) onDrawingSurfaceView() - .perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) onDrawingSurfaceView() .checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE) onToolBarView() .performSelectTool(ToolType.ERASER) onBrushPickerView().onStrokeWidthSeekBar() .check( - ViewAssertions.matches( - Matchers.allOf( - ViewMatchers.isDisplayed(), - UiMatcher.withProgress(newStrokeWidth) + matches( + allOf( + isDisplayed(), + withProgress(newStrokeWidth) ) ) ) onBrushPickerView().onStrokeWidthTextView() .check( - ViewAssertions.matches( - Matchers.allOf( - ViewMatchers.isDisplayed(), - ViewMatchers.withText( + matches( + allOf( + isDisplayed(), + withText( newStrokeWidth.toString() ) ) @@ -137,14 +145,14 @@ class EraserToolIntegrationTest { ) newStrokeWidth = 80 onBrushPickerView().onStrokeWidthSeekBar() - .perform(UiInteractions.setProgress(newStrokeWidth)) - .check(ViewAssertions.matches(UiMatcher.withProgress(newStrokeWidth))) + .perform(setProgress(newStrokeWidth)) + .check(matches(withProgress(newStrokeWidth))) onToolBarView() .performCloseToolOptionsView() onToolProperties() .checkStrokeWidth(80f) onDrawingSurfaceView() - .perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) onDrawingSurfaceView() .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.MIDDLE) } @@ -153,24 +161,24 @@ class EraserToolIntegrationTest { fun testChangeEraserBrushForm() { onBrushPickerView() .onStrokeWidthSeekBar() - .perform(UiInteractions.setProgress(70)) + .perform(setProgress(70)) onDrawingSurfaceView() - .perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) onDrawingSurfaceView() .checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE) onBrushPickerView() .onStrokeWidthSeekBar() - .perform(UiInteractions.setProgress(50)) + .perform(setProgress(50)) onToolBarView() .performSelectTool(ToolType.ERASER) onBrushPickerView().onStrokeCapSquareView() - .perform(ViewActions.click()) + .perform(click()) onToolBarView() .performCloseToolOptionsView() onToolProperties() .checkCap(Cap.SQUARE) onDrawingSurfaceView() - .perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) onDrawingSurfaceView() .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.MIDDLE) } @@ -179,17 +187,17 @@ class EraserToolIntegrationTest { @Test fun testRestorePreviousToolSettings() { onDrawingSurfaceView() - .perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) onDrawingSurfaceView() .checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE) onToolBarView() .performSelectTool(ToolType.ERASER) onBrushPickerView().onStrokeWidthTextView() .check( - ViewAssertions.matches( - Matchers.allOf( - ViewMatchers.isDisplayed(), - ViewMatchers.withText( + matches( + allOf( + isDisplayed(), + withText( TEXT_DEFAULT_STROKE_WIDTH ) ) @@ -197,19 +205,19 @@ class EraserToolIntegrationTest { ) onBrushPickerView().onStrokeWidthSeekBar() .check( - ViewAssertions.matches( - Matchers.allOf( - ViewMatchers.isDisplayed(), - UiMatcher.withProgress(DEFAULT_STROKE_WIDTH) + matches( + allOf( + isDisplayed(), + withProgress(DEFAULT_STROKE_WIDTH) ) ) ) val newStrokeWidth = 80 onBrushPickerView().onStrokeWidthSeekBar() - .perform(UiInteractions.setProgress(newStrokeWidth)) - .check(ViewAssertions.matches(UiMatcher.withProgress(newStrokeWidth))) + .perform(setProgress(newStrokeWidth)) + .check(matches(withProgress(newStrokeWidth))) onBrushPickerView().onStrokeCapSquareView() - .perform(ViewActions.click()) + .perform(click()) onToolProperties() .checkStrokeWidth(newStrokeWidth.toFloat()) .checkCap(Cap.SQUARE) @@ -217,27 +225,110 @@ class EraserToolIntegrationTest { .performCloseToolOptionsView() .performOpenToolOptionsView() onBrushPickerView().onStrokeWidthSeekBar() - .check(ViewAssertions.matches(UiMatcher.withProgress(newStrokeWidth))) + .check(matches(withProgress(newStrokeWidth))) val eraserStrokeWidth = 60 onBrushPickerView().onStrokeWidthSeekBar() - .perform(UiInteractions.setProgress(eraserStrokeWidth)) - .check(ViewAssertions.matches(UiMatcher.withProgress(eraserStrokeWidth))) + .perform(setProgress(eraserStrokeWidth)) + .check(matches(withProgress(eraserStrokeWidth))) onBrushPickerView().onStrokeCapRoundView() - .perform(ViewActions.click()) + .perform(click()) onToolProperties() .checkStrokeWidth(eraserStrokeWidth.toFloat()) .checkCap(Cap.ROUND) onToolBarView() .performSelectTool(ToolType.BRUSH) onBrushPickerView().onStrokeWidthSeekBar() - .check(ViewAssertions.matches(UiMatcher.withProgress(eraserStrokeWidth))) + .check(matches(withProgress(eraserStrokeWidth))) onBrushPickerView().onStrokeCapRoundView() - .check(ViewAssertions.matches(ViewMatchers.isSelected())) + .check(matches(ViewMatchers.isSelected())) onToolProperties() .checkCap(Cap.ROUND) .checkStrokeWidth(eraserStrokeWidth.toFloat()) } + @Test + fun fillBitmapEraseASpotThenFillTheErasedSpotCreatesNoCheckeredPattern() { + onToolBarView() + .performSelectTool(ToolType.FILL) + onDrawingSurfaceView() + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + onDrawingSurfaceView() + .checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE) + onToolBarView() + .performSelectTool(ToolType.ERASER) + onDrawingSurfaceView().perform( + swipeAccurate( + DrawingSurfaceLocationProvider.HALFWAY_TOP_MIDDLE, + DrawingSurfaceLocationProvider.HALFWAY_BOTTOM_MIDDLE + ) + ) + onDrawingSurfaceView() + .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.MIDDLE) + onDrawingSurfaceView() + .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.HALFWAY_TOP_MIDDLE) + onDrawingSurfaceView() + .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.HALFWAY_BOTTOM_MIDDLE) + onToolBarView() + .performSelectTool(ToolType.FILL) + onDrawingSurfaceView() + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + onDrawingSurfaceView() + .checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE) + onDrawingSurfaceView() + .checkPixelColor(Color.BLACK, BitmapLocationProvider.HALFWAY_TOP_MIDDLE) + onDrawingSurfaceView() + .checkPixelColor(Color.BLACK, BitmapLocationProvider.HALFWAY_BOTTOM_MIDDLE) + } + + @Test + fun fillBitmapEraseASpotThenFillTheErasedSpotUndoRedoNoCheckeredPattern() { + onToolBarView() + .performSelectTool(ToolType.FILL) + onDrawingSurfaceView() + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + onDrawingSurfaceView() + .checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE) + onToolBarView() + .performSelectTool(ToolType.ERASER) + onDrawingSurfaceView().perform( + swipeAccurate( + DrawingSurfaceLocationProvider.HALFWAY_TOP_MIDDLE, + DrawingSurfaceLocationProvider.HALFWAY_BOTTOM_MIDDLE + ) + ) + onDrawingSurfaceView() + .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.MIDDLE) + onDrawingSurfaceView() + .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.HALFWAY_TOP_MIDDLE) + onDrawingSurfaceView() + .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.HALFWAY_BOTTOM_MIDDLE) + onToolBarView() + .performSelectTool(ToolType.FILL) + onDrawingSurfaceView() + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + onDrawingSurfaceView() + .checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE) + onDrawingSurfaceView() + .checkPixelColor(Color.BLACK, BitmapLocationProvider.HALFWAY_TOP_MIDDLE) + onDrawingSurfaceView() + .checkPixelColor(Color.BLACK, BitmapLocationProvider.HALFWAY_BOTTOM_MIDDLE) + onTopBarView().performUndo() + Espresso.onView(ViewMatchers.isRoot()).perform(waitFor(2000)) + onDrawingSurfaceView() + .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.MIDDLE) + onDrawingSurfaceView() + .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.HALFWAY_TOP_MIDDLE) + onDrawingSurfaceView() + .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.HALFWAY_BOTTOM_MIDDLE) + onTopBarView().performRedo() + onDrawingSurfaceView() + .checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE) + onDrawingSurfaceView() + .checkPixelColor(Color.BLACK, BitmapLocationProvider.HALFWAY_TOP_MIDDLE) + onDrawingSurfaceView() + .checkPixelColor(Color.BLACK, BitmapLocationProvider.HALFWAY_BOTTOM_MIDDLE) + } + companion object { private const val TEXT_DEFAULT_STROKE_WIDTH = DEFAULT_STROKE_WIDTH.toString() } diff --git a/Paintroid/src/androidTest/java/org/catrobat/paintroid/test/espresso/tools/FillToolIntegrationTest.kt b/Paintroid/src/androidTest/java/org/catrobat/paintroid/test/espresso/tools/FillToolIntegrationTest.kt index 896682fe83..ee54bf52f2 100644 --- a/Paintroid/src/androidTest/java/org/catrobat/paintroid/test/espresso/tools/FillToolIntegrationTest.kt +++ b/Paintroid/src/androidTest/java/org/catrobat/paintroid/test/espresso/tools/FillToolIntegrationTest.kt @@ -20,21 +20,25 @@ package org.catrobat.paintroid.test.espresso.tools import android.graphics.Color import android.net.Uri -import androidx.test.espresso.Espresso +import androidx.test.espresso.Espresso.onView import androidx.test.espresso.IdlingRegistry -import androidx.test.espresso.action.ViewActions -import androidx.test.espresso.assertion.ViewAssertions +import androidx.test.espresso.action.ViewActions.replaceText +import androidx.test.espresso.action.ViewActions.closeSoftKeyboard +import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.idling.CountingIdlingResource -import androidx.test.espresso.matcher.ViewMatchers +import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.espresso.matcher.ViewMatchers.withId +import androidx.test.espresso.matcher.ViewMatchers.isRoot import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.rule.ActivityTestRule import org.catrobat.paintroid.MainActivity import org.catrobat.paintroid.R import org.catrobat.paintroid.test.espresso.util.BitmapLocationProvider import org.catrobat.paintroid.test.espresso.util.DrawingSurfaceLocationProvider -import org.catrobat.paintroid.test.espresso.util.UiInteractions -import org.catrobat.paintroid.test.espresso.util.UiMatcher +import org.catrobat.paintroid.test.espresso.util.UiInteractions.swipeAccurate +import org.catrobat.paintroid.test.espresso.util.UiInteractions.touchAt +import org.catrobat.paintroid.test.espresso.util.UiInteractions.waitFor +import org.catrobat.paintroid.test.espresso.util.UiMatcher.withProgress import org.catrobat.paintroid.test.espresso.util.wrappers.DrawingSurfaceInteraction.Companion.onDrawingSurfaceView import org.catrobat.paintroid.test.espresso.util.wrappers.ToolBarViewInteraction.Companion.onToolBarView import org.catrobat.paintroid.test.espresso.util.wrappers.ToolPropertiesInteraction.Companion.onToolProperties @@ -45,13 +49,12 @@ import org.catrobat.paintroid.tools.ToolType import org.catrobat.paintroid.tools.implementation.DEFAULT_TOLERANCE_IN_PERCENT import org.catrobat.paintroid.tools.implementation.FillTool import org.catrobat.paintroid.ui.Perspective +import org.junit.Rule import org.junit.After -import org.junit.runner.RunWith import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.Assert -import org.junit.Ignore +import org.junit.runner.RunWith import java.io.File @RunWith(AndroidJUnit4::class) @@ -89,7 +92,7 @@ class FillToolIntegrationTest { onToolProperties() .checkMatchesColor(Color.BLACK) onDrawingSurfaceView() - .perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) onDrawingSurfaceView() .checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE) mainActivity.model.savedPictureUri = null @@ -100,7 +103,7 @@ class FillToolIntegrationTest { onToolProperties() .checkMatchesColor(Color.BLACK) onDrawingSurfaceView() - .perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) onDrawingSurfaceView() .checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE) } @@ -111,7 +114,7 @@ class FillToolIntegrationTest { onToolProperties() .checkMatchesColor(Color.BLACK) onDrawingSurfaceView() - .perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.OUTSIDE_MIDDLE_RIGHT)) + .perform(touchAt(DrawingSurfaceLocationProvider.OUTSIDE_MIDDLE_RIGHT)) onDrawingSurfaceView() .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.MIDDLE) } @@ -123,16 +126,16 @@ class FillToolIntegrationTest { onToolProperties() .checkMatchesColor(Color.BLACK) onDrawingSurfaceView() - .perform(UiInteractions.swipeAccurate(DrawingSurfaceLocationProvider.HALFWAY_TOP_MIDDLE, DrawingSurfaceLocationProvider.HALFWAY_RIGHT_MIDDLE)) - .perform(UiInteractions.swipeAccurate(DrawingSurfaceLocationProvider.HALFWAY_RIGHT_MIDDLE, DrawingSurfaceLocationProvider.HALFWAY_BOTTOM_MIDDLE)) - .perform(UiInteractions.swipeAccurate(DrawingSurfaceLocationProvider.HALFWAY_BOTTOM_MIDDLE, DrawingSurfaceLocationProvider.HALFWAY_LEFT_MIDDLE)) - .perform(UiInteractions.swipeAccurate(DrawingSurfaceLocationProvider.HALFWAY_LEFT_MIDDLE, DrawingSurfaceLocationProvider.HALFWAY_TOP_MIDDLE)) + .perform(swipeAccurate(DrawingSurfaceLocationProvider.HALFWAY_TOP_MIDDLE, DrawingSurfaceLocationProvider.HALFWAY_RIGHT_MIDDLE)) + .perform(swipeAccurate(DrawingSurfaceLocationProvider.HALFWAY_RIGHT_MIDDLE, DrawingSurfaceLocationProvider.HALFWAY_BOTTOM_MIDDLE)) + .perform(swipeAccurate(DrawingSurfaceLocationProvider.HALFWAY_BOTTOM_MIDDLE, DrawingSurfaceLocationProvider.HALFWAY_LEFT_MIDDLE)) + .perform(swipeAccurate(DrawingSurfaceLocationProvider.HALFWAY_LEFT_MIDDLE, DrawingSurfaceLocationProvider.HALFWAY_TOP_MIDDLE)) onToolBarView() .performSelectTool(ToolType.FILL) onToolProperties() .setColorResource(R.color.pocketpaint_color_picker_green1) onDrawingSurfaceView() - .perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) onDrawingSurfaceView() .checkPixelColorResource(R.color.pocketpaint_color_picker_green1, BitmapLocationProvider.MIDDLE) .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.MIDDLE_RIGHT) @@ -148,15 +151,19 @@ class FillToolIntegrationTest { fillTool.colorTolerance.toDouble(), TOLERANCE_DELTA ) - val colorToleranceInput = Espresso.onView(withId(R.id.pocketpaint_fill_tool_dialog_color_tolerance_input)) - val colorToleranceSeekBar = Espresso.onView(withId(R.id.pocketpaint_color_tolerance_seek_bar)) + val colorToleranceInput = onView(withId(R.id.pocketpaint_fill_tool_dialog_color_tolerance_input)) + val colorToleranceSeekBar = onView(withId(R.id.pocketpaint_color_tolerance_seek_bar)) val testToleranceText = "100" - colorToleranceInput.check(ViewAssertions.matches(ViewMatchers.withText( + colorToleranceInput.check( + matches( + withText( DEFAULT_TOLERANCE_IN_PERCENT.toString() - ))) - colorToleranceInput.perform(ViewActions.replaceText(testToleranceText), ViewActions.closeSoftKeyboard()) - colorToleranceInput.check(ViewAssertions.matches(ViewMatchers.withText(testToleranceText))) - colorToleranceSeekBar.check(ViewAssertions.matches(UiMatcher.withProgress(testToleranceText.toInt()))) + ) + ) + ) + colorToleranceInput.perform(replaceText(testToleranceText), closeSoftKeyboard()) + colorToleranceInput.check(matches(withText(testToleranceText))) + colorToleranceSeekBar.check(matches(withProgress(testToleranceText.toInt()))) val expectedAbsoluteTolerance = fillTool.getToleranceAbsoluteValue(100) Assert.assertEquals("Wrong fill tool member value for color tolerance", expectedAbsoluteTolerance.toDouble(), fillTool.colorTolerance.toDouble(), TOLERANCE_DELTA) @@ -168,10 +175,10 @@ class FillToolIntegrationTest { @Test fun testFillToolDialogAfterToolSwitch() { val fillTool = toolReference!!.tool as FillTool? - val colorToleranceInput = Espresso.onView(withId(R.id.pocketpaint_fill_tool_dialog_color_tolerance_input)) - val colorToleranceSeekBar = Espresso.onView(withId(R.id.pocketpaint_color_tolerance_seek_bar)) + val colorToleranceInput = onView(withId(R.id.pocketpaint_fill_tool_dialog_color_tolerance_input)) + val colorToleranceSeekBar = onView(withId(R.id.pocketpaint_color_tolerance_seek_bar)) val toleranceInPercent = 50 - colorToleranceInput.perform(ViewActions.replaceText(toleranceInPercent.toString())) + colorToleranceInput.perform(replaceText(toleranceInPercent.toString())) val expectedAbsoluteTolerance = fillTool!!.getToleranceAbsoluteValue(toleranceInPercent) Assert.assertEquals("Wrong fill tool member value for color tolerance", expectedAbsoluteTolerance.toDouble(), fillTool.colorTolerance.toDouble(), TOLERANCE_DELTA) @@ -182,20 +189,23 @@ class FillToolIntegrationTest { .performSelectTool(ToolType.BRUSH) onToolBarView() .performSelectTool(ToolType.FILL) - colorToleranceInput.check(ViewAssertions.matches(ViewMatchers.withText( + colorToleranceInput.check( + matches( + withText( DEFAULT_TOLERANCE_IN_PERCENT.toString() - ))) - colorToleranceSeekBar.check(ViewAssertions.matches(UiMatcher.withProgress(DEFAULT_TOLERANCE_IN_PERCENT))) + ) + ) + ) + colorToleranceSeekBar.check(matches(withProgress(DEFAULT_TOLERANCE_IN_PERCENT))) } - @Ignore("Fails on Jenkins, trying out if everything works without this test or if error is due to a bug on Jenkins") @Test fun testFillToolUndoRedoWithTolerance() { onToolBarView() .performSelectTool(ToolType.BRUSH) onDrawingSurfaceView() .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.MIDDLE) - .perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) onDrawingSurfaceView() .checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE) onToolProperties() @@ -203,13 +213,11 @@ class FillToolIntegrationTest { .checkMatchesColorResource(R.color.pocketpaint_color_picker_brown2) onToolBarView() .performSelectTool(ToolType.FILL) - .performOpenToolOptionsView() - Espresso.onView(withId(R.id.pocketpaint_fill_tool_dialog_color_tolerance_input)) - .perform(ViewActions.replaceText(100.toString())) + onView(withId(R.id.pocketpaint_fill_tool_dialog_color_tolerance_input)).perform(replaceText("100")) onToolBarView() .performCloseToolOptionsView() onDrawingSurfaceView() - .perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) onDrawingSurfaceView() .checkPixelColorResource(R.color.pocketpaint_color_picker_brown2, BitmapLocationProvider.MIDDLE) .checkPixelColorResource(R.color.pocketpaint_color_picker_brown2, BitmapLocationProvider.HALFWAY_RIGHT_MIDDLE) @@ -225,6 +233,38 @@ class FillToolIntegrationTest { .checkPixelColorResource(R.color.pocketpaint_color_picker_brown2, BitmapLocationProvider.HALFWAY_RIGHT_MIDDLE) } + @Test + fun testFillBitmapAndEraseASpotAndFillTheErasedSpotAgain() { + onToolProperties() + .checkMatchesColor(Color.BLACK) + onDrawingSurfaceView() + .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)) + onDrawingSurfaceView() + .checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE) + onToolBarView() + .performSelectTool(ToolType.ERASER) + onDrawingSurfaceView() + .perform( + swipeAccurate( + DrawingSurfaceLocationProvider.HALFWAY_TOP_MIDDLE, + DrawingSurfaceLocationProvider.HALFWAY_BOTTOM_MIDDLE + ) + ) + onView(isRoot()).perform(waitFor(1000)) + onDrawingSurfaceView() + .checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.MIDDLE) + onView(isRoot()).perform(waitFor(1000)) + onToolBarView() + .performSelectTool(ToolType.FILL) + onToolProperties() + .checkMatchesColor(Color.BLACK) + onDrawingSurfaceView() + .perform(touchAt(DrawingSurfaceLocationProvider.HALFWAY_BOTTOM_MIDDLE)) + onView(isRoot()).perform(waitFor(1000)) + onDrawingSurfaceView() + .checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE) + } + companion object { private const val TOLERANCE_DELTA = 0.05 } diff --git a/Paintroid/src/androidTest/java/org/catrobat/paintroid/test/junit/algorithm/FillAlgorithmTest.kt b/Paintroid/src/androidTest/java/org/catrobat/paintroid/test/junit/algorithm/FillAlgorithmTest.kt index ab7c0ac42b..f1856857f5 100644 --- a/Paintroid/src/androidTest/java/org/catrobat/paintroid/test/junit/algorithm/FillAlgorithmTest.kt +++ b/Paintroid/src/androidTest/java/org/catrobat/paintroid/test/junit/algorithm/FillAlgorithmTest.kt @@ -52,7 +52,7 @@ class FillAlgorithmTest { assertEquals("Wrong array size", height, algorithmPixels.size) assertEquals("Wrong array size", width, algorithmPixels[0].size) val algorithmTargetColor = fillAlgorithm.targetColor - val algorithmReplacementColor = fillAlgorithm.replacementColor + val algorithmReplacementColor = fillAlgorithm.colorToBeReplaced val algorithmColorTolerance = fillAlgorithm.colorToleranceThresholdSquared.toFloat() assertEquals( "Wrong target color", diff --git a/Paintroid/src/main/java/org/catrobat/paintroid/command/implementation/FillCommand.kt b/Paintroid/src/main/java/org/catrobat/paintroid/command/implementation/FillCommand.kt index 5e95d2df7d..d3a9bc1328 100644 --- a/Paintroid/src/main/java/org/catrobat/paintroid/command/implementation/FillCommand.kt +++ b/Paintroid/src/main/java/org/catrobat/paintroid/command/implementation/FillCommand.kt @@ -35,15 +35,15 @@ class FillCommand(private val fillAlgorithmFactory: FillAlgorithmFactory, clicke override fun run(canvas: Canvas, layerModel: LayerContracts.Model) { val currentLayer = layerModel.currentLayer currentLayer ?: return - currentLayer.bitmap?.let { bitmap -> - val replacementColor = bitmap.getPixel(clickedPixel.x, clickedPixel.y) + currentLayer.bitmap.let { bitmap -> + val colorToBeReplaced = bitmap.getPixel(clickedPixel.x, clickedPixel.y) val fillAlgorithm = fillAlgorithmFactory.createFillAlgorithm() fillAlgorithm.setParameters( - bitmap, - clickedPixel, - paint.color, - replacementColor, - colorTolerance + bitmap, + clickedPixel, + paint.color, + colorToBeReplaced, + colorTolerance ) fillAlgorithm.performFilling() } diff --git a/Paintroid/src/main/java/org/catrobat/paintroid/contract/MainActivityContracts.kt b/Paintroid/src/main/java/org/catrobat/paintroid/contract/MainActivityContracts.kt index cb3670335f..510cce9aac 100644 --- a/Paintroid/src/main/java/org/catrobat/paintroid/contract/MainActivityContracts.kt +++ b/Paintroid/src/main/java/org/catrobat/paintroid/contract/MainActivityContracts.kt @@ -401,6 +401,8 @@ interface MainActivityContracts { fun showCurrentTool(toolType: ToolType?) + fun enableColorItemView(show: Boolean) + fun setColorButtonColor(@ColorInt color: Int) } diff --git a/Paintroid/src/main/java/org/catrobat/paintroid/controller/DefaultToolController.kt b/Paintroid/src/main/java/org/catrobat/paintroid/controller/DefaultToolController.kt index c02c3ad7c4..3b3cd1e8b9 100644 --- a/Paintroid/src/main/java/org/catrobat/paintroid/controller/DefaultToolController.kt +++ b/Paintroid/src/main/java/org/catrobat/paintroid/controller/DefaultToolController.kt @@ -34,6 +34,7 @@ import org.catrobat.paintroid.tools.ToolReference import org.catrobat.paintroid.tools.ToolType import org.catrobat.paintroid.tools.Workspace import org.catrobat.paintroid.tools.implementation.ClippingTool +import org.catrobat.paintroid.tools.implementation.EraserTool import org.catrobat.paintroid.tools.implementation.ImportTool import org.catrobat.paintroid.tools.implementation.LineTool import org.catrobat.paintroid.tools.implementation.SprayTool @@ -130,6 +131,9 @@ class DefaultToolController( private fun switchTool(tool: Tool) { val currentTool = toolReference.tool val currentToolType = currentTool?.toolType + if (currentToolType == ToolType.ERASER) { + (currentTool as EraserTool).setSavedColor() + } currentToolType?.let { hidePlusIfShown(it) } if (currentToolType == tool.toolType) { diff --git a/Paintroid/src/main/java/org/catrobat/paintroid/tools/helper/JavaFillAlgorithm.kt b/Paintroid/src/main/java/org/catrobat/paintroid/tools/helper/JavaFillAlgorithm.kt index d716b25e70..9b461ba1ab 100644 --- a/Paintroid/src/main/java/org/catrobat/paintroid/tools/helper/JavaFillAlgorithm.kt +++ b/Paintroid/src/main/java/org/catrobat/paintroid/tools/helper/JavaFillAlgorithm.kt @@ -42,7 +42,7 @@ class JavaFillAlgorithm : FillAlgorithm { var targetColor = 0 @VisibleForTesting - var replacementColor = 0 + var colorToBeReplaced = 0 @VisibleForTesting var colorToleranceThresholdSquared = 0 @@ -70,7 +70,7 @@ class JavaFillAlgorithm : FillAlgorithm { filledPixels = Array(bitmap.height) { BooleanArray(bitmap.width) } this.clickedPixel = clickedPixel this.targetColor = targetColor - this.replacementColor = replacementColor + this.colorToBeReplaced = replacementColor colorToleranceThresholdSquared = square(colorToleranceThreshold.toInt()) considerTolerance = colorToleranceThreshold > 0 } @@ -97,9 +97,9 @@ class JavaFillAlgorithm : FillAlgorithm { private fun shouldCellBeFilled(row: Int, col: Int): Boolean = !filledPixels[row][col] && ( - pixels[row][col] == replacementColor || considerTolerance && isPixelWithinColorTolerance( + pixels[row][col] == colorToBeReplaced || considerTolerance && isPixelWithinColorTolerance( pixels[row][col], - replacementColor + colorToBeReplaced ) ) diff --git a/Paintroid/src/main/java/org/catrobat/paintroid/tools/implementation/DefaultToolFactory.kt b/Paintroid/src/main/java/org/catrobat/paintroid/tools/implementation/DefaultToolFactory.kt index d1f5771db0..ec89b04ace 100644 --- a/Paintroid/src/main/java/org/catrobat/paintroid/tools/implementation/DefaultToolFactory.kt +++ b/Paintroid/src/main/java/org/catrobat/paintroid/tools/implementation/DefaultToolFactory.kt @@ -131,6 +131,7 @@ class DefaultToolFactory(mainActivity: MainActivity) : ToolFactory { workspace, idlingResource, commandManager, + mainActivity.bottomNavigationViewHolder, DRAW_TIME_INIT ) ToolType.LINE -> LineTool( diff --git a/Paintroid/src/main/java/org/catrobat/paintroid/tools/implementation/EraserTool.kt b/Paintroid/src/main/java/org/catrobat/paintroid/tools/implementation/EraserTool.kt index e7f99fa095..356150109e 100644 --- a/Paintroid/src/main/java/org/catrobat/paintroid/tools/implementation/EraserTool.kt +++ b/Paintroid/src/main/java/org/catrobat/paintroid/tools/implementation/EraserTool.kt @@ -28,16 +28,18 @@ import org.catrobat.paintroid.tools.ToolType import org.catrobat.paintroid.tools.Workspace import org.catrobat.paintroid.tools.options.BrushToolOptionsView import org.catrobat.paintroid.tools.options.ToolOptionsViewController +import org.catrobat.paintroid.ui.viewholder.BottomNavigationViewHolder class EraserTool( - brushToolOptionsView: BrushToolOptionsView, - contextCallback: ContextCallback, - toolOptionsViewController: ToolOptionsViewController, - toolPaint: ToolPaint, - workspace: Workspace, - idlingResource: CountingIdlingResource, - commandManager: CommandManager, - drawTime: Long + brushToolOptionsView: BrushToolOptionsView, + contextCallback: ContextCallback, + toolOptionsViewController: ToolOptionsViewController, + toolPaint: ToolPaint, + workspace: Workspace, + idlingResource: CountingIdlingResource, + commandManager: CommandManager, + bottomNavigationViewHolder: BottomNavigationViewHolder, + drawTime: Long ) : BrushTool( brushToolOptionsView, contextCallback, @@ -48,10 +50,22 @@ class EraserTool( commandManager, drawTime ) { + + private var savedColor: Int + private var bottomNavigationViewHolder: BottomNavigationViewHolder + + init { + this.bottomNavigationViewHolder = bottomNavigationViewHolder + bottomNavigationViewHolder.enableColorItemView(false) + bottomNavigationViewHolder.setColorButtonColor(Color.TRANSPARENT) + savedColor = toolPaint.color + toolPaint.color = Color.TRANSPARENT + brushToolOptionsView.setCurrentPaint(toolPaint.paint) + } override val previewPaint: Paint get() = Paint().apply { set(super.previewPaint) - color = Color.BLACK + color = Color.TRANSPARENT shader = toolPaint.checkeredShader } @@ -64,4 +78,11 @@ class EraserTool( override val toolType: ToolType get() = ToolType.ERASER + + fun setSavedColor() { + bottomNavigationViewHolder.enableColorItemView(true) + bottomNavigationViewHolder.setColorButtonColor(savedColor) + toolPaint.color = savedColor + brushToolOptionsView.setCurrentPaint(toolPaint.paint) + } } diff --git a/Paintroid/src/main/java/org/catrobat/paintroid/ui/MainActivityNavigator.kt b/Paintroid/src/main/java/org/catrobat/paintroid/ui/MainActivityNavigator.kt index 3136f1cc98..3fe38f60f9 100644 --- a/Paintroid/src/main/java/org/catrobat/paintroid/ui/MainActivityNavigator.kt +++ b/Paintroid/src/main/java/org/catrobat/paintroid/ui/MainActivityNavigator.kt @@ -44,51 +44,51 @@ import org.catrobat.paintroid.colorpicker.OnColorPickedListener import org.catrobat.paintroid.command.CommandFactory import org.catrobat.paintroid.command.implementation.DefaultCommandFactory import org.catrobat.paintroid.common.ABOUT_DIALOG_FRAGMENT_TAG -import org.catrobat.paintroid.common.ADVANCED_SETTINGS_DIALOG_FRAGMENT_TAG -import org.catrobat.paintroid.common.CATROBAT_INFORMATION_DIALOG_TAG import org.catrobat.paintroid.common.CATROID_MEDIA_GALLERY_FRAGMENT_TAG import org.catrobat.paintroid.common.COLOR_PICKER_DIALOG_TAG +import org.catrobat.paintroid.common.LIKE_US_DIALOG_FRAGMENT_TAG +import org.catrobat.paintroid.common.RATE_US_DIALOG_FRAGMENT_TAG import org.catrobat.paintroid.common.FEEDBACK_DIALOG_FRAGMENT_TAG -import org.catrobat.paintroid.common.INDETERMINATE_PROGRESS_DIALOG_TAG +import org.catrobat.paintroid.common.ZOOM_WINDOW_SETTINGS_DIALOG_FRAGMENT_TAG +import org.catrobat.paintroid.common.ADVANCED_SETTINGS_DIALOG_FRAGMENT_TAG +import org.catrobat.paintroid.common.OVERWRITE_INFORMATION_DIALOG_TAG +import org.catrobat.paintroid.common.PNG_INFORMATION_DIALOG_TAG import org.catrobat.paintroid.common.JPG_INFORMATION_DIALOG_TAG -import org.catrobat.paintroid.common.LIKE_US_DIALOG_FRAGMENT_TAG -import org.catrobat.paintroid.common.LOAD_DIALOG_FRAGMENT_TAG -import org.catrobat.paintroid.common.MainActivityConstants.ActivityRequestCode import org.catrobat.paintroid.common.ORA_INFORMATION_DIALOG_TAG -import org.catrobat.paintroid.common.OVERWRITE_INFORMATION_DIALOG_TAG +import org.catrobat.paintroid.common.CATROBAT_INFORMATION_DIALOG_TAG +import org.catrobat.paintroid.common.INDETERMINATE_PROGRESS_DIALOG_TAG import org.catrobat.paintroid.common.PAINTROID_PICTURE_PATH -import org.catrobat.paintroid.common.PERMISSION_DIALOG_FRAGMENT_TAG -import org.catrobat.paintroid.common.PERMISSION_EXTERNAL_STORAGE_SAVE_COPY -import org.catrobat.paintroid.common.PNG_INFORMATION_DIALOG_TAG -import org.catrobat.paintroid.common.RATE_US_DIALOG_FRAGMENT_TAG import org.catrobat.paintroid.common.SAVE_DIALOG_FRAGMENT_TAG -import org.catrobat.paintroid.common.SAVE_INFORMATION_DIALOG_TAG +import org.catrobat.paintroid.common.LOAD_DIALOG_FRAGMENT_TAG +import org.catrobat.paintroid.common.PERMISSION_DIALOG_FRAGMENT_TAG import org.catrobat.paintroid.common.SAVE_QUESTION_FRAGMENT_TAG import org.catrobat.paintroid.common.SCALE_IMAGE_FRAGMENT_TAG -import org.catrobat.paintroid.common.ZOOM_WINDOW_SETTINGS_DIALOG_FRAGMENT_TAG +import org.catrobat.paintroid.common.PERMISSION_EXTERNAL_STORAGE_SAVE_COPY +import org.catrobat.paintroid.common.SAVE_INFORMATION_DIALOG_TAG +import org.catrobat.paintroid.common.MainActivityConstants.ActivityRequestCode import org.catrobat.paintroid.contract.MainActivityContracts -import org.catrobat.paintroid.dialog.AboutDialog +import org.catrobat.paintroid.dialog.FeedbackDialog +import org.catrobat.paintroid.dialog.ZoomWindowSettingsDialog import org.catrobat.paintroid.dialog.AdvancedSettingsDialog +import org.catrobat.paintroid.dialog.OverwriteDialog +import org.catrobat.paintroid.dialog.PngInfoDialog +import org.catrobat.paintroid.dialog.JpgInfoDialog +import org.catrobat.paintroid.dialog.OraInfoDialog import org.catrobat.paintroid.dialog.CatrobatImageInfoDialog -import org.catrobat.paintroid.dialog.FeedbackDialog import org.catrobat.paintroid.dialog.ImportImageDialog import org.catrobat.paintroid.dialog.IndeterminateProgressDialog import org.catrobat.paintroid.dialog.InfoDialog -import org.catrobat.paintroid.dialog.JpgInfoDialog -import org.catrobat.paintroid.dialog.LikeUsDialog -import org.catrobat.paintroid.dialog.OraInfoDialog -import org.catrobat.paintroid.dialog.OverwriteDialog -import org.catrobat.paintroid.dialog.PermanentDenialPermissionInfoDialog import org.catrobat.paintroid.dialog.PermissionInfoDialog -import org.catrobat.paintroid.dialog.PermissionInfoDialog.PermissionType -import org.catrobat.paintroid.dialog.PngInfoDialog -import org.catrobat.paintroid.dialog.RateUsDialog +import org.catrobat.paintroid.dialog.PermanentDenialPermissionInfoDialog import org.catrobat.paintroid.dialog.SaveBeforeFinishDialog -import org.catrobat.paintroid.dialog.SaveBeforeLoadImageDialog import org.catrobat.paintroid.dialog.SaveBeforeNewImageDialog -import org.catrobat.paintroid.dialog.SaveInformationDialog +import org.catrobat.paintroid.dialog.SaveBeforeLoadImageDialog import org.catrobat.paintroid.dialog.ScaleImageOnLoadDialog -import org.catrobat.paintroid.dialog.ZoomWindowSettingsDialog +import org.catrobat.paintroid.dialog.AboutDialog +import org.catrobat.paintroid.dialog.LikeUsDialog +import org.catrobat.paintroid.dialog.PermissionInfoDialog.PermissionType +import org.catrobat.paintroid.dialog.RateUsDialog +import org.catrobat.paintroid.dialog.SaveInformationDialog import org.catrobat.paintroid.tools.ToolReference import org.catrobat.paintroid.tools.ToolType import org.catrobat.paintroid.ui.fragments.CatroidMediaGalleryFragment diff --git a/Paintroid/src/main/java/org/catrobat/paintroid/ui/viewholder/BottomNavigationViewHolder.kt b/Paintroid/src/main/java/org/catrobat/paintroid/ui/viewholder/BottomNavigationViewHolder.kt index 3b71859cb0..7c10be5ccc 100644 --- a/Paintroid/src/main/java/org/catrobat/paintroid/ui/viewholder/BottomNavigationViewHolder.kt +++ b/Paintroid/src/main/java/org/catrobat/paintroid/ui/viewholder/BottomNavigationViewHolder.kt @@ -43,13 +43,14 @@ class BottomNavigationViewHolder( layout.findViewById(R.id.pocketpaint_bottom_navigation) private val bottomNavigation: BottomNavigationAppearance private val colorButton: ImageView + private val colorItemView: BottomNavigationItemView init { bottomNavigation = setAppearance(context) val bottomNavigationMenuView = bottomNavigationView.getChildAt(0) as BottomNavigationMenuView - val item = bottomNavigationMenuView.getChildAt(2) as BottomNavigationItemView - colorButton = item.findViewById(R.id.icon) + colorItemView = bottomNavigationMenuView.getChildAt(2) as BottomNavigationItemView + colorButton = colorItemView.findViewById(R.id.icon) initColorButton() } @@ -65,6 +66,10 @@ class BottomNavigationViewHolder( toolType?.let { bottomNavigation.showCurrentTool(it) } } + override fun enableColorItemView(show: Boolean) { + colorItemView.isClickable = show + } + override fun setColorButtonColor(color: Int) { colorButton.setColorFilter(color) }