feat(widget): add interactive notes widget - #3215
Conversation
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Documentation | 22 minor |
| ErrorProne | 1 high |
| Complexity | 3 medium |
🟢 Metrics 106 complexity · 7 duplication
Metric Results Complexity 106 Duplication 7
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.
ce74696 to
dede2b6
Compare
c640e96 to
db9f75d
Compare
|
Hello there, 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.) |
|
Awesome! Just a smal UX thing: @jancborchardt do you have an idea?
|
|
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. |
|
I understand. |
jancborchardt
left a comment
There was a problem hiding this comment.
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)
2e97f93 to
8855ba7
Compare
|
Thank you! I had a little time to make those changes and upgrade the project to the last main commit.
Now I like this menu. Tell me if it's ok. |
8855ba7 to
64dacb9
Compare
| return | ||
| } | ||
|
|
||
| if (!intent.hasExtra(AppWidgetManager.EXTRA_APPWIDGET_ID)) { |
There was a problem hiding this comment.
If we don't have this EXTRA_APPWIDGET_ID we update widget with
awm.getAppWidgetIds(ComponentName(context, InteractiveNoteListWidget::class.java))
Then still update widget with -1.
Why this approach is preferred? Shouldn't we use one of it only instead of both.
There was a problem hiding this comment.
That was a copy of the existing NoteListWidget.kt but I made the fix on my widget. I didn't touch other widgets.
| * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors | ||
| * SPDX-License-Identifier: GPL-3.0-or-later | ||
| */ | ||
| package it.niedermann.owncloud.notes.widget.interactivelist; |
There was a problem hiding this comment.
Can we use Kotlin for new class?
There was a problem hiding this comment.
There were no instruction on new classes when I did the PR and old widgets were in java. As I said, I didn't wanted to make multiple changes on my first PR on this project but I just made the changes.
| import android.content.Intent; | ||
| import android.widget.RemoteViewsService; | ||
|
|
||
| public class InteractiveNoteListWidgetService extends RemoteViewsService { |
There was a problem hiding this comment.
Can we use Kotlin for new class?
| } | ||
| } | ||
|
|
||
| @JvmStatic |
There was a problem hiding this comment.
No need @JvmStatic if we use Kotlin for other new classes.
| private const val CATEGORY_ID_PREFIX = "category:" | ||
| private const val CATEGORY_SEPARATOR = '/' | ||
|
|
||
| @JvmStatic |
There was a problem hiding this comment.
No need @JvmStatic if we use Kotlin for other new classes.
There was a problem hiding this comment.
This preview should be deleted from repo.
There was a problem hiding this comment.
I don't think so because minSdk is 28 and previewLayout is API 31. Android 9, 10 and 11 only read previewImage so without the icon, we would have the app icon as preview. I initially added this screenshot because note_list_widget_preview.webp and single_note_widget.webp were in res/drawable/ and listed in REUSE.toml so I just copied previous widget formats.
If you're sure it must go, I just have to delete it, it's the last change I haven't done yet.
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> AI-assistant: Claude Code 2.1.226 (Claude Opus 5)
64dacb9 to
dcadc52
Compare

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
Implementation notes
NotesListWidgetDatastorage and excerpt generation - no database migration.SharedPreferences; notes are sorted in memory.values/strings.xmlonly (translations are handled by Transifex).Tested
./gradlew assembleDevDebugand./gradlew lintDevDebugpass.assembleDevDebug/lintDevDebugpass🖼️Screenshots
🏁 Checklist
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)