From cb2ccaa97a8e04d4a376dab0f4cc9d1269296fa6 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 9 Nov 2023 13:44:17 +0100 Subject: [PATCH] Fixed widget folder type --- app/src/main/java/eu/faircode/email/Widget.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Widget.java b/app/src/main/java/eu/faircode/email/Widget.java index 325ba4973b..323bca2b48 100644 --- a/app/src/main/java/eu/faircode/email/Widget.java +++ b/app/src/main/java/eu/faircode/email/Widget.java @@ -38,6 +38,7 @@ import androidx.preference.PreferenceManager; import java.text.NumberFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.concurrent.ExecutorService; @@ -72,14 +73,21 @@ public class Widget extends AppWidgetProvider { if (version <= 1550) semi = true; // Legacy - List folders = db.folder().getNotifyingFolders(account); + List folders = null; + if (folder < 0) + folders = db.folder().getNotifyingFolders(account); + else { + EntityFolder f = db.folder().getFolder(folder); + if (f != null) + folders = Arrays.asList(f); + } if (folders == null) folders = new ArrayList<>(); PendingIntent pi; - if (folders.size() == 1 || folder >= 0) { + if (folders.size() == 1) { Intent view = new Intent(context, ActivityView.class); - view.setAction("folder:" + (folder < 0 ? folders.get(0).id : folder)); + view.setAction("folder:" + folders.get(0).id); view.putExtra("account", account); view.putExtra("type", folders.get(0).type); view.putExtra("refresh", true);