Skip to content

Commit 6bbb41e

Browse files
committed
fix: show "Loading note…" in single-note widget on boot instead of "Note not found"
Before this change, the placeholder text was always "Note not found", even when the widget was still connecting to its data service on initial phone start. The default layout text now reads "Loading note…" and is only swapped to "Note not found" once onDataSetChanged() has confirmed the note is genuinely absent from the database. Fixes #1611 AI-assisted: Claude Code (Sonnet 4.6) Signed-off-by: Jan C. Borchardt <925062+jancborchardt@users.noreply.github.com>
1 parent a44c508 commit 6bbb41e

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

app/src/main/java/it/niedermann/owncloud/notes/widget/singlenote/SingleNoteWidgetFactory.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ public void onDataSetChanged() {
5555

5656
if (note == null) {
5757
Log.e(TAG, "Error: note not found");
58+
// Switch placeholder from "Loading note…" to "Note not found" now that we've
59+
// confirmed the note is genuinely missing rather than still loading.
60+
final var views = new RemoteViews(context.getPackageName(), R.layout.widget_single_note);
61+
views.setTextViewText(R.id.widget_single_note_placeholder_tv,
62+
context.getString(R.string.widget_single_note_note_not_found));
63+
AppWidgetManager.getInstance(context).partiallyUpdateAppWidget(appWidgetId, views);
5864
}
5965
} else {
6066
Log.w(TAG, "Widget with ID " + appWidgetId + " seems to be not configured yet.");
@@ -110,7 +116,6 @@ public RemoteViews getViewAt(int position) {
110116
}
111117

112118

113-
// TODO Set loading view
114119
@Override
115120
public RemoteViews getLoadingView() {
116121
return null;

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@
241241
<string name="widget_note_list_title">Note list</string>
242242
<string name="widget_note_list_placeholder">No notes</string>
243243
<string name="widget_single_note_title">Single note</string>
244-
<string name="widget_single_note_placeholder_tv">Note not found</string>
244+
<string name="widget_single_note_placeholder_tv">Loading note…</string>
245+
<string name="widget_single_note_note_not_found">Note not found</string>
245246
<string name="widget_not_logged_in">Please login to Notes before using this widget</string>
246247
<string name="widget_entry_fav_contentDescription">Star icon is used to denote an item as a favorite</string>
247248

0 commit comments

Comments
 (0)