mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-11 03:24:52 +02:00
Added color stripe to unified inbox widget
This commit is contained in:
@@ -460,12 +460,14 @@ public interface DaoMessage {
|
||||
|
||||
@Query("SELECT message.*" +
|
||||
", account.name AS accountName" +
|
||||
", COALESCE(identity.color, folder.color, account.color) AS accountColor" +
|
||||
", SUM(1 - message.ui_seen) AS unseen" +
|
||||
", COUNT(message.id) - SUM(message.ui_flagged) AS unflagged" +
|
||||
", MAX(message.received) AS dummy" +
|
||||
" FROM message" +
|
||||
" JOIN account_view AS account ON account.id = message.account" +
|
||||
" JOIN folder_view AS folder ON folder.id = message.folder" +
|
||||
" LEFT JOIN identity ON identity.id = message.identity" +
|
||||
" WHERE account.`synchronize`" +
|
||||
" AND (:account IS NULL OR account.id = :account)" +
|
||||
" AND ((:folder IS NULL AND folder.unified) OR folder.id = :folder)" +
|
||||
|
||||
@@ -312,6 +312,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("color_stripe", checked).apply();
|
||||
WidgetUnified.updateData(getContext());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ package eu.faircode.email;
|
||||
|
||||
public class TupleMessageWidget extends EntityMessage {
|
||||
public String accountName;
|
||||
public Integer accountColor;
|
||||
public int unseen;
|
||||
public int unflagged;
|
||||
}
|
||||
|
||||
@@ -45,12 +45,14 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
||||
private boolean threading;
|
||||
private boolean subject_top;
|
||||
private boolean subject_italic;
|
||||
private boolean color_stripe;
|
||||
private long folder;
|
||||
private long account;
|
||||
private boolean unseen;
|
||||
private boolean flagged;
|
||||
private int colorWidgetForeground;
|
||||
private int colorWidgetRead;
|
||||
private int colorSeparator;
|
||||
private boolean pro;
|
||||
private List<TupleMessageWidget> messages = new ArrayList<>();
|
||||
|
||||
@@ -74,12 +76,14 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
||||
threading = prefs.getBoolean("threading", true);
|
||||
subject_top = prefs.getBoolean("subject_top", false);
|
||||
subject_italic = prefs.getBoolean("subject_italic", true);
|
||||
color_stripe = prefs.getBoolean("color_stripe", true);
|
||||
account = prefs.getLong("widget." + appWidgetId + ".account", -1L);
|
||||
folder = prefs.getLong("widget." + appWidgetId + ".folder", -1L);
|
||||
unseen = prefs.getBoolean("widget." + appWidgetId + ".unseen", false);
|
||||
flagged = prefs.getBoolean("widget." + appWidgetId + ".flagged", false);
|
||||
colorWidgetForeground = ContextCompat.getColor(context, R.color.colorWidgetForeground);
|
||||
colorWidgetRead = ContextCompat.getColor(context, R.color.colorWidgetRead);
|
||||
colorSeparator = ContextCompat.getColor(context, R.color.lightColorSeparator);
|
||||
|
||||
pro = ActivityBilling.isPro(context);
|
||||
|
||||
@@ -128,6 +132,13 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
||||
thread.putExtra("id", message.id);
|
||||
views.setOnClickFillInIntent(R.id.llMessage, thread);
|
||||
|
||||
int colorBackground =
|
||||
(message.accountColor == null || !ActivityBilling.isPro(context)
|
||||
? colorSeparator : message.accountColor);
|
||||
|
||||
views.setInt(R.id.stripe, "setBackgroundColor", colorBackground);
|
||||
views.setViewVisibility(R.id.stripe, account < 0 && color_stripe ? View.VISIBLE : View.GONE);
|
||||
|
||||
SpannableString ssFrom = new SpannableString(pro
|
||||
? MessageHelper.formatAddressesShort(message.from)
|
||||
: context.getString(R.string.title_pro_feature));
|
||||
|
||||
Reference in New Issue
Block a user