Skip to content

Refactor NoteEditor to use changeNoteType dialog#20377

Open
Haz3-jolt wants to merge 3 commits intoankidroid:mainfrom
Haz3-jolt:nEditor
Open

Refactor NoteEditor to use changeNoteType dialog#20377
Haz3-jolt wants to merge 3 commits intoankidroid:mainfrom
Haz3-jolt:nEditor

Conversation

@Haz3-jolt
Copy link
Member

Purpose / Description

Refactors the noteEditor to use changeNoteTypeDialog and deprecates the old implementation

Fixes

Approach

  • This PR consists of three commits:
  1. Refactoring NoteEditor to use changeNoteType dialog
  2. Removing the old implementation code
  3. Minor warning fixups

How Has This Been Tested?

Pixel Tablet (API 36)
Before:
Screen_recording_20260303_140341.webm

After
Screen_recording_20260303_140105.webm

image

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@Haz3-jolt Haz3-jolt changed the title N editor Refactor NoteEditor to use changeNoteType dialog Mar 3, 2026
@Haz3-jolt Haz3-jolt modified the milestone: 2.24 release Mar 3, 2026
@ZornHadNoChoice

This comment was marked as resolved.

@Haz3-jolt
Copy link
Member Author

Does the note editor need to be closed when changing the note type? Would that mean that we can no longer change the note type in the "Add" screen?

Nope! This is only when the noteEditor is opened in edit mode :)

Screen_recording_20260303_142948.webm

@Haz3-jolt
Copy link
Member Author

@david-allison can you restart the lint job I ran ./gradlew ktlintCheck and ./gradlew ktlintFormat locally and couldn't find anything. The job is talking about three resources being unused, but they are actually being used

@Haz3-jolt Haz3-jolt requested a review from david-allison March 3, 2026 11:54
@david-allison
Copy link
Member

See: https://github.com/ankidroid/Anki-Android/tree/main/.github/workflows#quality-checks

gh pr checkout --force 20377
./gradlew lintPlayDebug :api:lintDebug :libanki:lintDebug ktLintCheck lintVitalFullRelease lint-rules:test --daemon
  /Users/davidallison/StudioProjects/Anki-Android/AnkiDroid/src/main/res/values/01-core.xml:131: Error: The resource R.string.nothing appears to be unused [UnusedResources]
      <string name="nothing">Nothing</string>
              ~~~~~~~~~~~~~~
  /Users/davidallison/StudioProjects/Anki-Android/AnkiDroid/src/main/res/values/02-strings.xml:111: Error: The resource R.string.confirm_map_cards_to_nothing appears to be unused [UnusedResources]
      <string name="confirm_map_cards_to_nothing">Any cards mapped to nothing will be deleted. If a note has no remaining cards, it will be lost. Are you sure you want to continue?</string>
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Users/davidallison/StudioProjects/Anki-Android/AnkiDroid/src/main/res/drawable/ic_import_export.xml:1: Error: The resource R.drawable.ic_import_export appears to be unused [UnusedResources]
  <vector xmlns:android="http://schemas.android.com/apk/res/android"

@david-allison david-allison added Needs Author Reply Waiting for a reply from the original author and removed Needs Review labels Mar 3, 2026
- Refactors NoteEditor to use ChangeNoteTypeDialog instead of old implementation
- Since we have migrated to using changeNoteType Dialog in noteEditor we can safely remove a lot of the old code
- Unused String and drawable resources will be removed
- Remove unused variable
- Remove redundant qualifier name
- Explicit type arguments can be inferred
@Haz3-jolt Haz3-jolt added Needs Review and removed Needs Author Reply Waiting for a reply from the original author labels Mar 4, 2026
@Haz3-jolt
Copy link
Member Author

@david-allison flaky windows run?

Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful! LGTM

@david-allison david-allison added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Mar 4, 2026
@david-allison david-allison added this to the 2.24 release milestone Mar 4, 2026
kevs-mist added a commit to kevs-mist/Anki-Android that referenced this pull request Mar 5, 2026
- Add an explicit 5-minute timeout to all runTest calls to prevent
  UncompletedCoroutinesError on slow Windows runners, where startReviewer()
  and advanceRobolectricLooper() consume most of the default 1-minute budget
- Fix ankiJsUiTest silently not running due to @OverRide instead of @test

Fixes ankidroid#20377."
kevs-mist added a commit to kevs-mist/Anki-Android that referenced this pull request Mar 5, 2026
- Add explicit 5-minute timeout to all runTest calls
- Fix ankiJsUiTest silently not running due to @OverRide instead of @test

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

Labels

Needs Second Approval Has one approval, one more approval to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor NoteEditor to use Change Note Type Dialog

3 participants