Skip to content

Conversation

@Haz3-jolt
Copy link
Member

@Haz3-jolt Haz3-jolt commented Jun 30, 2025

Purpose / Description

  • Rename NoteEditor to NoteEditorFragment
  • Introduce NoteEditor Activity which launches NoteEditorFragment into a FragmentContainerView
  • Fold the intent in NoteEditorLauncher to use NoteEditor (Activity) instead of a single fragment activity
  • Add previewer into a FragmentContainerView of NoteEditor with a 1 second refresh delay
  • Introduce a tab layout to switch between cards generated
  • Refresh Previewer when text changed, notetype changed, and note saved
  • Use ResizablePaneManager to make the layout resizable

Fixes

  • For GSoC 2025: Tablet & Chromebook UI

Approach

  • NoteEditor is now a activity which uses NoteEditorFragment,and PreviewerFrgment in X-Large Screens
  • Add previewer into a FragmentContainerView with a 1 second refresh delay
  • Introduce a tab layout to switch between cards generated
  • Refresh Previewer when text changed, notetype changed, and note saved
  • Use ResizablePaneManager to make the layout resizable

How Has This Been Tested?

Tested on the following Android Emulators:
Pixel Tablet API 36
Large Desktop API 34

Screenshots of affected screen in different themes:

  1. Black Theme:
    NEblack

  2. Plain Theme:
    NEplain

  3. Default Light Theme:
    NElight

  4. Default Dark Theme:
    NEdark

Emulator Video:
t4.webm

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 added UI Note Editor Addition, editing & note type changes Tablet ChromeOS Needs Review GSoC Pull requests authored by a Google Summer of Code participant [Candidate/Selected], for GSoC mentors labels Jun 30, 2025
@Arthur-Milchior
Copy link
Member

I don't have time to do a code review now, but I really like the look of it!

@Haz3-jolt Haz3-jolt marked this pull request as draft July 2, 2025 20:11
@Haz3-jolt
Copy link
Member Author

I don't have time to do a code review now, but I really like the look of it!

Thanks! But david gave some feedback and it was decided that some re architecting is required!
So this might take a while to get merged!

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.

Is there any way this can be split into a separate commit (or probably in a separate Pull Request), there's a lot to review here, and I worry this will slow things down getting anything moving

@Haz3-jolt
Copy link
Member Author

Is there any way this can be split into a separate commit (or probably in a separate Pull Request), there's a lot to review here, and I worry this will slow things down getting anything moving

I'll do a separate PR.

@Haz3-jolt Haz3-jolt force-pushed the GSoC-NoteEditor branch 2 times, most recently from f95706f to 442acc4 Compare July 9, 2025 20:03
@Haz3-jolt
Copy link
Member Author

One of the tests might still fail, I'll try to fix by tomorrow

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.

I can understand the logical structure now. Great progress!

As commented, this feels like it should be 3 PRs (borderline feasible for this PR to consist of the 3 commits, no concern with trying that if you want)

The main blocker is the hard dependency on NoteEditor, which will need to be removed, I feel the rest will be nitpicks.

@david-allison
Copy link
Member

PS: I'd recommend adding a GitHub issue, and moving most of the labels which are currently applied to this PR there

Copy link
Member

@Arthur-Milchior Arthur-Milchior left a comment

Choose a reason for hiding this comment

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

I really like what I'm seeing when I execute the code. But I agree with David wholeheartedly about the fact that this should be multiple PR and that the architecture is too coupled.

If it's not clear what we mean here, please don't hesitate to ask question or discord, or event let us know if you want a call to discuss it, so that you can ask all questiuons that may be relevant and help you understand why we want it

refreshPreviewerFragmentRunnable?.let { refreshPreviewerFragmentHandler.removeCallbacks(it) }
val updateRunnable =
Runnable {
loadNoteEditorPreviewer()
Copy link
Member

Choose a reason for hiding this comment

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

Screen_recording_20250710_030629.webm

I admit that I'm not very fan of having to reload the fragment and the webview. Because it means the webview is always at the top after reloading.

This video recording is admittedly absurd. But I can easily imagine that I've a big image, or a complex mathjax formula at the top of the note, and that I want to edit the text/formula below, and that it'll become frustrating to always scroll back at the bottom.

I'd prefer either:

  • that we keep the same webview and change its content, if the scroll position is not changed with this or
  • that we recall where the scroll was and put it back at the same absolute location

I must note that on anki, the template previewer has the behavior I want. As there is no editor previewer, I can't really compare

Copy link
Member Author

@Haz3-jolt Haz3-jolt Jul 19, 2025

Choose a reason for hiding this comment

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

that we keep the same webview and change its content, if the scroll position is not changed with this

Isn't really possible since we need to update the tab layout properly.

that we recall where the scroll was and put it back at the same absolute location

I think I'll work on this, but I will prolly push this out a bit since I am working on toggle-able hints rn

@Haz3-jolt Haz3-jolt removed UI Note Editor Addition, editing & note type changes Tablet ChromeOS labels Jul 10, 2025
@sanjaysargam
Copy link
Member

@Haz3-jolt on edit note mode, previewer icon is showing
image

@sanjaysargam
Copy link
Member

I am not able to resize layout. @Haz3-jolt Will you check from your side once ?
resize.webm

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.

One question on the de-conflict, the rest looks great!

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Dec 20, 2025
@Haz3-jolt Haz3-jolt removed the Needs Author Reply Waiting for a reply from the original author label Dec 20, 2025
Copy link
Member

@sanjaysargam sanjaysargam left a comment

Choose a reason for hiding this comment

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

Add option to disable/enable split-pane on xlarge devices.
Settings -> Developer Options

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.

Looks awesome, cheers! 🥳🥳🥳🥳

One request, but treat this as 'pending merge' after it's addressed

@david-allison david-allison added Needs Author Reply Waiting for a reply from the original author Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge Next version Changes to be merged in the next version, to keep the current release stable. labels Dec 22, 2025
@Haz3-jolt Haz3-jolt removed the Needs Author Reply Waiting for a reply from the original author label Dec 22, 2025
…d tags

The TemplatePreviewerArguments is a data class that only stores the data
- it doesn't need to mutate the lists
- Introduce two-pane NoteEditor layout (editor + previewer) for xlarge screens
- Add NoteEditorFragmentDelegate to notify host activity of editor events
  (ready, text changes, save, type change) so preview can stay in sync
- Implement previewer loading in NoteEditorActivity using TemplatePreviewerFragment
  with tab navigation for multiple card templates
- Retains tab position on text change
- Rename allowSaveAndPreview():
  - allowSaveAction() – controls when note can be saved
  - allowPreviewAction() – controls when preview menu item is shown
  (disabled in split mode since previewer is always visible)
- Added method to update existing card being previewer updateContent() without full fragment reloading and while retaining currently selected card
- Added method to get safe ord for Cloze card refresh
@Haz3-jolt Haz3-jolt added the Next version Changes to be merged in the next version, to keep the current release stable. label Dec 27, 2025
@david-allison david-allison added this pull request to the merge queue Dec 28, 2025
@david-allison david-allison removed the Next version Changes to be merged in the next version, to keep the current release stable. label Dec 28, 2025
@david-allison
Copy link
Member

THANK YOU SO MUCH!!!!!

Merged via the queue into ankidroid:main with commit 0f4f87e Dec 28, 2025
15 checks passed
@github-actions github-actions bot added this to the 2.24 release milestone Dec 28, 2025
@github-actions github-actions bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GSoC Pull requests authored by a Google Summer of Code participant [Candidate/Selected], for GSoC mentors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants