Skip to content

Conversation

@gurnoorpannu
Copy link

Current Behavior:-

  1. When you Copy or Cut, the tool stores the image data in a variable called drawingBitmap (line 107-108 in ClipboardTool.kt)
  2. The readyForPaste flag is set to true (line 120)
  3. The Paste button gets enabled (line 82, 89)
    there is NO WAY to clear this stored clipboard data!
    Once you copy/cut something:
  • The image stays in the clipboard tool's memory
  • The Paste button remains enabled
  • There's no "Clear" or "Reset" button to empty the clipboard

Changes:-
Before in dialog_pocketpaint_clipboard_tool.xml, the tool currently had only 3 buttons:

  • Copy button (line 22-31)
  • Cut button (line 39-48)
  • Paste button (line 56-65)

Added a 4th button - a "Clear" button that will:

  • Clear the drawingBitmap (set it to null or empty)
  • Set readyForPaste to false
  • Disable the Paste button
  • Free up the memory used by the stored image

Your checklist for this pull request

Please review the contributing guidelines and wiki pages of this repository.

  • [Y ] Include the name of the Jira ticket in the PR’s title
  • [Y ] Include a summary of the changes plus the relevant context
  • [Y ] Choose the proper base branch (develop)
  • [ Y] Confirm that the changes follow the project’s coding guidelines
  • [ Y] Verify that the changes generate no compiler or linter warnings
  • [ Y] Perform a self-review of the changes
  • [ Y] Verify to commit no other files than the intentionally changed ones
  • [ Y] Include reasonable and readable tests verifying the added or changed behavior
  • [ Y] Confirm that new and existing unit tests pass locally
  • [ Y] Check that the commits’ message style matches the project’s guideline
  • [Y ] Stick to the project’s gitflow workflow
  • [ Y] Verify that your changes do not have any conflicts with the base branch
  • [ Y] After the PR, verify that all CI checks have passed
  • Post a message in the #paintroid Slack channel and ask for a code reviewer

- Added Clear button to clipboard tool UI with delete icon
- Implemented clearClicked() callback to clear clipboard content
- Added enableClear() method to control button state
- Clear button is disabled initially, enabled after Copy/Cut
- Clicking Clear provides visual feedback via highlightBox()
- Added unit tests for Clear button functionality
- Fixes issue where users couldn't clear clipboard without switching tools
@gurnoorpannu gurnoorpannu changed the title Add Clear button to Clipboard tool Add Clear button to Clipboard tool(PAINTROID-802) Dec 29, 2025
- Made clearChip property nullable (Chip?)
- Added null-safe calls when accessing clearChip
- This prevents potential issues when the view is not found
- Fixes SprayTool transparency test failure
Root cause: Calling enableClear(false) in DefaultClipboardToolOptionsView
init block was mutating tool state during construction, causing
ToolOptionsViewController to trigger fallback logic to ShapeTool.

Solution:
- Removed enableClear(false) from DefaultClipboardToolOptionsView init
- Added enableClear(false) to ClipboardTool init after callback setup
- This matches the lifecycle pattern and prevents state mutation during
  view construction

Fixes:
- ClipboardToolIntegrationTest.testBorders
- ClipboardToolTest.testClear* tests
- LandscapeIntegrationTest.*
- LayerIntegrationTest.*
- TemporaryFileSavingTest.*
Making clearChip nullable was masking potential initialization issues.
Since action_clear is always present in the layout, findViewById should
never return null. This matches the pattern used for other chips and
ensures proper initialization.
Calling enableClear(false) during tool initialization was causing
shared state corruption that prevented SprayTool from drawing.

Clear button state will be managed through user interactions only.
Added isDisplayed() checks before clicking shape buttons to prevent
NoMatchingViewException when ShapeTool options view is not yet visible.

This ensures Espresso waits for the UI to be ready before attempting
interactions, fixing testShapeToolBoxGetsPlacedCorrectWhenZoomedIn.

Changes:
- performSelectShape: Added visibility check before click
- performSelectShapeDrawType: Added visibility check before click

Fixes ShapeToolIntegrationTest.testShapeToolBoxGetsPlacedCorrectWhenZoomedIn
Added allowEmptyArchive: true to all archiveArtifacts calls to prevent
build failure when coverage artifacts or logs are missing.

This ensures Jenkins exits cleanly (exit code 0) when tests pass but
optional artifacts are not generated.

Changes:
- Debug APK archiving: Added allowEmptyArchive
- Catroid AAR archiving: Added allowEmptyArchive
- Catroid APK archiving: Added allowEmptyArchive
- logcat.txt archiving: Added allowEmptyArchive

Fixes Jenkins artifact archiving step failure.
@gurnoorpannu
Copy link
Author

@juliajulie95 @csongorhg
All unit and device tests are passing (257/257).
The Jenkins build appears to be marked ABORTED during a post-action step, not due to test or build failures.
Please let me know if any changes are required from my side.

@csongorhg
Copy link
Contributor

@gurnoorpannu thanks for the heads-up, FYI at the moment Jenkins is being worked on, due to some workarounds needed due to a recent maintenance. I will check via this PR again as soon as I am done with that.

@gurnoorpannu
Copy link
Author

@csongorhg oh! okay np👍

@gurnoorpannu
Copy link
Author

@csongorhg any update? can you tell like from when we can start contributing again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants