mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-25 15:32:52 +00:00
Show account folders from widget
This commit is contained in:
parent
ea109fbbe0
commit
801d61a728
3 changed files with 22 additions and 13 deletions
|
@ -112,14 +112,13 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
private boolean searching = false;
|
||||
|
||||
static final int REQUEST_UNIFIED = 1;
|
||||
static final int REQUEST_FOLDER = 2;
|
||||
static final int REQUEST_WHY = 3;
|
||||
static final int REQUEST_ALERT = 4;
|
||||
static final int REQUEST_THREAD = 5;
|
||||
static final int REQUEST_OUTBOX = 6;
|
||||
static final int REQUEST_ERROR = 7;
|
||||
static final int REQUEST_UPDATE = 8;
|
||||
static final int REQUEST_WIDGET = 9;
|
||||
static final int REQUEST_WHY = 2;
|
||||
static final int REQUEST_ALERT = 3;
|
||||
static final int REQUEST_THREAD = 4;
|
||||
static final int REQUEST_OUTBOX = 5;
|
||||
static final int REQUEST_ERROR = 6;
|
||||
static final int REQUEST_UPDATE = 7;
|
||||
static final int REQUEST_WIDGET = 8;
|
||||
|
||||
static final String ACTION_VIEW_FOLDERS = BuildConfig.APPLICATION_ID + ".VIEW_FOLDERS";
|
||||
static final String ACTION_VIEW_MESSAGES = BuildConfig.APPLICATION_ID + ".VIEW_MESSAGES";
|
||||
|
@ -319,6 +318,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
private void init() {
|
||||
Bundle args = new Bundle();
|
||||
|
||||
long account = getIntent().getLongExtra("account", -1);
|
||||
|
||||
FragmentBase fragment;
|
||||
switch (startup) {
|
||||
case "accounts":
|
||||
|
@ -327,10 +328,14 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
break;
|
||||
case "folders":
|
||||
fragment = new FragmentFolders();
|
||||
args.putLong("account", account);
|
||||
break;
|
||||
case "primary":
|
||||
fragment = new FragmentFolders();
|
||||
if (account < 0)
|
||||
args.putBoolean("primary", true);
|
||||
else
|
||||
args.putLong("account", account);
|
||||
break;
|
||||
default:
|
||||
fragment = new FragmentMessages();
|
||||
|
|
|
@ -55,18 +55,22 @@ public class Widget extends AppWidgetProvider {
|
|||
|
||||
EntityFolder folder = db.folder().getFolderByType(account, EntityFolder.INBOX);
|
||||
|
||||
Intent view = new Intent(context, ActivityView.class);
|
||||
PendingIntent pi;
|
||||
if (folder == null) {
|
||||
Intent view = new Intent(context, ActivityView.class);
|
||||
view.setAction("unified");
|
||||
view.putExtra("refresh", true);
|
||||
view.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
pi = PendingIntent.getActivity(context, ActivityView.REQUEST_UNIFIED, view, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
} else {
|
||||
Intent view = new Intent(context, ActivityView.class);
|
||||
view.setAction("folder:" + folder.id);
|
||||
view.putExtra("account", account);
|
||||
view.putExtra("type", folder.type);
|
||||
view.putExtra("refresh", true);
|
||||
}
|
||||
view.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
PendingIntent pi = PendingIntent.getActivity(context, ActivityView.REQUEST_UNIFIED, view, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
pi = PendingIntent.getActivity(context, appWidgetId, view, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
}
|
||||
|
||||
TupleMessageStats stats = db.message().getUnseenWidget(account < 0 ? null : account);
|
||||
Integer unseen = (unseen_ignored ? stats.notifying : stats.unseen);
|
||||
|
|
|
@ -49,7 +49,7 @@ public class WidgetUnified extends AppWidgetProvider {
|
|||
view.putExtra("type", type);
|
||||
view.putExtra("refresh", true);
|
||||
view.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
PendingIntent pi = PendingIntent.getActivity(context, ActivityView.REQUEST_FOLDER, view, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
PendingIntent pi = PendingIntent.getActivity(context, appWidgetId, view, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_unified);
|
||||
|
||||
|
|
Loading…
Reference in a new issue