Skip to content

feat(widget): add interactive notes widget - #3215

Open
loloakira wants to merge 1 commit into
nextcloud:mainfrom
loloakira:feature/widget-evolution
Open

feat(widget): add interactive notes widget#3215
loloakira wants to merge 1 commit into
nextcloud:mainfrom
loloakira:feature/widget-evolution

Conversation

@loloakira

@loloakira loloakira commented Jun 4, 2026

Copy link
Copy Markdown

Description

This PR adds a new home-screen widget called Interactive notes — a third widget alongside the existing single-note and note-list widgets, which are left unchanged.

What it does

  • Shows notes as a scrollable single column of rounded cards.
  • Each card shows the note title and a multi-line content excerpt (the whole note when it is short).
  • Tapping a card opens that specific note; a floating "+" button in the bottom-right creates a new note in the widget's configured category/account.
  • The favorite star is shown as a non-clickable indicator.
  • Reconfigurable via long-press on Android 12+, with a live previewLayout in the widget picker.

Implementation notes

  • Reuses the existing NotesListWidgetData storage and excerpt generation - no database migration.
  • Sort options are stored in per-widget SharedPreferences; notes are sorted in memory.
  • One shared change: WidgetNotesListDao.createOrUpdateNoteListWidgetData now uses @insert(onConflict = OnConflictStrategy.REPLACE) instead of a plain insert that aborted on the existing primary key, so reconfiguration can persist updated settings. This is transparent to the two existing widgets, which are not reconfigurable and never hit the conflict. A DAO test covers the upsert.
  • New source strings were added to values/strings.xml only (translations are handled by Transifex).
  • The two existing widgets and the shared data layer are untouched.
  • Added the explicit "Add widget" button so that saving is no longer triggered by tapping a category.
  • Added section headings and preselected "All notes".

Tested

  • ./gradlew assembleDevDebug and ./gradlew lintDevDebug pass.
  • test DAO + assembleDevDebug/lintDevDebug pass
  • Manually verified on a device (Android 16): open note, create note, sort options, reconfiguration, light/dark mode.

🖼️Screenshots

🏚 Before 🏡 After
No equivalent widget interactive_note_list_widget_preview

🏁 Checklist

  • 🧪 Tests written - WidgetNotesListDaoTest covers the DAO upsert; the UI was verified manually.

Developed with AI assistance (Claude Code 2.1.219, Claude Opus 4.8 for the initial implementation and Claude Opus 5 for the review changes)

@codacy-production

codacy-production Bot commented Jun 4, 2026

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 1 medium · 14 minor

Alerts:
⚠ 15 issues (≤ 0 issues of at least minor severity)

Results:
15 new issues

Category Results
Documentation 14 minor
Complexity 1 medium

View in Codacy

🟢 Metrics 98 complexity · 7 duplication

Metric Results
Complexity 98
Duplication 7

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@loloakira
loloakira force-pushed the feature/widget-evolution branch from ce74696 to dede2b6 Compare June 6, 2026 13:49
@loloakira
loloakira marked this pull request as draft June 6, 2026 14:19
@loloakira
loloakira force-pushed the feature/widget-evolution branch 2 times, most recently from c640e96 to db9f75d Compare June 6, 2026 16:24
@loloakira
loloakira marked this pull request as ready for review June 6, 2026 16:24
@github-actions

Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@tobiasKaminsky

Copy link
Copy Markdown
Member

Awesome!

Just a smal UX thing:
When I first set it up, I was unsure how to "save".
I had to click on "all notes" (or Favorites).
I am a bit unsure how to make this more understandable?
Maybe via a radio button and a real "save/add" button?

@jancborchardt do you have an idea?

image

@loloakira

Copy link
Copy Markdown
Author

Thanks!

I don't like it either but as it was my first PR for this project I didn't want to change too much things. I reused the interface of the previous widget that wasn't editable but where the saving was done on selecting the category.

@tobiasKaminsky

Copy link
Copy Markdown
Member

I understand.
Let's see if @jancborchardt has a good idea, which does not require too many changes.

@jancborchardt jancborchardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks very nice, and useful! :)

Regarding the settings, some details:

  • Settings regarding favorites on top and sorting could just follow in-app preferences. Either they can be used as a preset here, or we don't need to show them at all here
  • "All notes" could be preselected, and yes I would say a specific FAB in the bottom right saying "Add widget" would be nice (needs to be ("Edit widget" when editing of course)

@loloakira
loloakira force-pushed the feature/widget-evolution branch from db9f75d to 2e97f93 Compare July 26, 2026 22:42
Add a third home-screen widget, "Interactive notes", that shows notes as a scrollable single column of rounded cards. Each card shows the note title and a multi-line content excerpt (the whole note when it is short). Tapping a card opens that specific note; a floating button in the bottom-right creates a new note in the widget's configured category/account. The favorite star is a non-clickable indicator.

The configuration screen groups its controls under headings and separates selecting from saving: tapping an entry only selects it, and an "Add widget" button in the bottom-right commits the configuration. "All notes" is selected by default. When an existing widget is reconfigured the button reads "Edit widget" and the stored selection is restored. Sort options are a "favorites on top" toggle and a newest-first / oldest-first order. The widget is reconfigurable via long-press on Android 12+ and provides a live previewLayout for the widget picker.

Reuses the existing NotesListWidgetData storage (no database migration) and the existing excerpt generation; sort options are kept in per-widget SharedPreferences. The two existing widgets are left unchanged.

So reconfiguration can persist updated settings, the shared createOrUpdateNoteListWidgetData DAO now uses an upsert (REPLACE) conflict strategy instead of a plain insert that aborted on the existing primary key; this is transparent to the non-reconfigurable widgets, which never hit the conflict. A DAO test covers the upsert.

Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: loloakira <6253351+loloakira@users.noreply.github.com>
@loloakira
loloakira force-pushed the feature/widget-evolution branch from 2e97f93 to 8855ba7 Compare July 26, 2026 23:01
@loloakira

Copy link
Copy Markdown
Author

Thank you!

I had a little time to make those changes and upgrade the project to the last main commit.

  • I fixed the minSdk part in my widget and modified the saving menu.
  • I added a FAB.
  • I added titles to understand the different parts and made "All notes" selected by default. It's now a selection before saving the widget with the FAB and not a saving on selecting the category.
  • I checked the default configuration parts but found no place where the the newest/oldest and favorites on top are so I just let favorites on by default like the rest of the app.
  • I used the US form and not UK form for "Favorites" instead of "Favourites".

Now I like this menu. Tell me if it's ok.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants