fix(image-occlusion): support updating a note's deck#19607
Merged
mikehardy merged 6 commits intoankidroid:mainfrom Nov 30, 2025
Merged
fix(image-occlusion): support updating a note's deck#19607mikehardy merged 6 commits intoankidroid:mainfrom
mikehardy merged 6 commits intoankidroid:mainfrom
Conversation
a306e55 to
fa05db9
Compare
david-allison
commented
Nov 24, 2025
david-allison
commented
Nov 24, 2025
AnkiDroid/src/main/java/com/ichi2/anki/pages/viewmodel/ImageOcclusionViewModel.kt
Outdated
Show resolved
Hide resolved
6073000 to
decbc8d
Compare
4 tasks
decbc8d to
b372f5a
Compare
fd4bdbb to
a90022f
Compare
Member
Unless I'm missing something this isn't possible on desktop either(we can only modify the masks). If this is the case I don't think we should diverge. We don't quite follow desktop as we don't allow the user to save without any occlusions set but on desktop it just results in an empty card. |
Member
Author
|
We supported editing the deck in 2.22, I'd rather avoid the regression As far as I understand the code, It's the backend rejecting the note with 0 occlusions. |
5 tasks
BrayanDSO
reviewed
Nov 27, 2025
AnkiDroid/src/main/java/com/ichi2/anki/pages/viewmodel/ImageOcclusionViewModel.kt
Outdated
Show resolved
Hide resolved
25467bf to
5009b6d
Compare
* Removes nullable properties
* Strongly types 'id' + 'deckId'
* Properties are only available if the mode ('Add'/'Edit') is checked
For issue 19605, we will want to know whether the page is adding
or editing a note, this will read better if we are not
assuming existence of properties
I want to make the deck selection conditional on 'ADD' mode
fixes: `1` and `1L` in the JSONObject are output to the same string improves: * add JSON syntax highlighting * fix call: no need to call JSONObject( ) at the call site
Once a note had been created, the deck couldn't be updated. Fixed by: * Enable editing the deck in NoteEditorFragment if in edit mode * Disable editing the deck in ImageOcclusion if in edit mode In future, we can handle this in ImageOcclusion, BUT: There are 3 cases: * A user wants to edit a card when studying * A user wants to edit a selection of cards from the same note [Card Browser - CARDS] * A user wants to edit a note [Card Browser - NOTES] * What does it mean to edit the deck of a note, is a user aware of this? And a user can remove the cards they are editing (by removing masks). Since we don't yet have full control over the process of adding an occlusion note, I decided it was a risk to take the time to implement this Fixes 19605
Member
Author
|
Thanks so much for the patch!! |
5009b6d to
afc5248
Compare
BrayanDSO
approved these changes
Nov 27, 2025
mikehardy
approved these changes
Nov 30, 2025
Member
mikehardy
left a comment
There was a problem hiding this comment.
Can't see anything that looks off, let's go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose / Description
From the Reviewer, I could not edit the deck of an image occlusion note
This functionality was not implemented on
ImageOcclusion. Only editing the deck of 'add' was supported, and the 'edit deck' functionality ofNoteEditorFragmentwas hiddenIn future, we can handle this inImageOcclusion, BUT:
There are 3 cases:
And a user can remove the cards they are editing (by removing masks).
Since we don't yet have full control over the process of adding an occlusion note, I decided it was a risk to take the time to implement this, and went for a simple fix
Fixes
Approach
Beforehand, I refactored the Image Occlusion screen:
Then:
How Has This Been Tested?
Pixel 9 API 35 emulator:
Checklist