Skip to content

fix: show "Loading note…" in single-note widget on boot instead of "Note not found"#3198

Open
jancborchardt wants to merge 1 commit into
mainfrom
worktree-fix+widget-loading-state-1611
Open

fix: show "Loading note…" in single-note widget on boot instead of "Note not found"#3198
jancborchardt wants to merge 1 commit into
mainfrom
worktree-fix+widget-loading-state-1611

Conversation

@jancborchardt
Copy link
Copy Markdown
Member

@jancborchardt jancborchardt commented May 22, 2026

Summary

  • Fixes the single-note widget briefly (or permanently on cold boot) showing "Note not found" before it has had a chance to load
  • Default placeholder text is now "Loading note…" -- this is what shows while the RemoteViewsAdapter is connecting to the widget service
  • Once onDataSetChanged() runs and confirms the note is genuinely absent from the database, partiallyUpdateAppWidget() switches the placeholder to "Note not found"
  • Removes stale // TODO Set loading view comment that was tracking this gap

How it works

The widget uses a ListView with setEmptyView pointing to a placeholder TextView. That placeholder is visible any time getCount() returns 0 -- including during the brief window on phone boot before the RemoteViewsService has connected and populated data. By defaulting to "Loading note…" in the layout and only updating to "Note not found" when the note is confirmed missing, we avoid the false negative.

Test plan

  • Restart device, check widget shows "Loading note…" briefly then the note content
  • Configure widget for a note, then delete the note from the server and sync -- widget should show "Note not found"
  • Normal operation: widget shows note content as expected

Fixes #1611

🤖 Generated with Claude Code

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 22, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

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.

@jancborchardt jancborchardt force-pushed the worktree-fix+widget-loading-state-1611 branch from cbd86fb to 6bbb41e Compare May 22, 2026 21:23
@jancborchardt jancborchardt moved this to 🏗️ At engineering in 🖍 Design team May 22, 2026
@jancborchardt jancborchardt added the papercut Annoying recurring UX issue with possibly simple fix. label May 22, 2026
@github-actions

This comment was marked as outdated.

@jancborchardt jancborchardt self-assigned this May 22, 2026
@jancborchardt jancborchardt force-pushed the worktree-fix+widget-loading-state-1611 branch from 6bbb41e to 58705b1 Compare May 22, 2026 21:52
@github-actions

This comment was marked as outdated.

Three distinct states are now handled correctly:

- Startup / system update: the widget shows "Loading note…" while the
  RemoteViewsAdapter connects. updateAppWidget() sets the placeholder
  visible with that text on every full reset (ACTION_APPWIDGET_UPDATE).

- Note refresh (edit or sync): updateSingleNoteWidgets() now sends a
  custom ACTION_DATA_CHANGED instead of ACTION_APPWIDGET_UPDATE. onReceive()
  handles this with notifyAppWidgetViewDataChanged() only, leaving the
  existing RemoteViews intact so the note content updates in place with
  no blank gap or flash.

- Note missing: once onDataSetChanged() confirms getNoteById() returns null,
  partiallyUpdateAppWidget() sets the placeholder visible with "Note not found".
  When the note is found the placeholder is hidden via the same mechanism.

Fixes #1611

AI-assisted: Claude Code (Sonnet 4.6)
Signed-off-by: Jan C. Borchardt <925062+jancborchardt@users.noreply.github.com>
@jancborchardt jancborchardt force-pushed the worktree-fix+widget-loading-state-1611 branch from 58705b1 to e5a4dab Compare May 22, 2026 22:35
@github-actions
Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/notes-android/actions/runs/26315257316/artifacts/7171529308
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

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

Labels

bug papercut Annoying recurring UX issue with possibly simple fix.

Projects

Status: 🏗️ At engineering

Development

Successfully merging this pull request may close these issues.

On initial phone start, says "Note not found" instead of "Loading note …"

1 participant