mirror of https://github.com/M66B/FairEmail.git
Added color stripe to unified inbox widget
This commit is contained in:
parent
2aa012a12d
commit
2b8d531d2c
2
FAQ.md
2
FAQ.md
|
@ -2483,7 +2483,7 @@ Checking *Remove tracking parameters* will remove all [UTM parameters](https://e
|
||||||
The widget is designed to look good on most home/launcher screens by making it monochrome and by using a half transparent background.
|
The widget is designed to look good on most home/launcher screens by making it monochrome and by using a half transparent background.
|
||||||
This way the widget will nicely blend in, while still being properly readable.
|
This way the widget will nicely blend in, while still being properly readable.
|
||||||
|
|
||||||
Adding (account) colors will cause problems with some backgrounds and will cause readability problems, which is why this won't be added.
|
Adding colors will cause problems with some backgrounds and will cause readability problems, which is why this won't be added.
|
||||||
|
|
||||||
Due to Android limitations it is not possible to dynamically set the opacity of the background and to have rounded corners at the same time.
|
Due to Android limitations it is not possible to dynamically set the opacity of the background and to have rounded corners at the same time.
|
||||||
|
|
||||||
|
|
|
@ -460,12 +460,14 @@ public interface DaoMessage {
|
||||||
|
|
||||||
@Query("SELECT message.*" +
|
@Query("SELECT message.*" +
|
||||||
", account.name AS accountName" +
|
", account.name AS accountName" +
|
||||||
|
", COALESCE(identity.color, folder.color, account.color) AS accountColor" +
|
||||||
", SUM(1 - message.ui_seen) AS unseen" +
|
", SUM(1 - message.ui_seen) AS unseen" +
|
||||||
", COUNT(message.id) - SUM(message.ui_flagged) AS unflagged" +
|
", COUNT(message.id) - SUM(message.ui_flagged) AS unflagged" +
|
||||||
", MAX(message.received) AS dummy" +
|
", MAX(message.received) AS dummy" +
|
||||||
" FROM message" +
|
" FROM message" +
|
||||||
" JOIN account_view AS account ON account.id = message.account" +
|
" JOIN account_view AS account ON account.id = message.account" +
|
||||||
" JOIN folder_view AS folder ON folder.id = message.folder" +
|
" JOIN folder_view AS folder ON folder.id = message.folder" +
|
||||||
|
" LEFT JOIN identity ON identity.id = message.identity" +
|
||||||
" WHERE account.`synchronize`" +
|
" WHERE account.`synchronize`" +
|
||||||
" AND (:account IS NULL OR account.id = :account)" +
|
" AND (:account IS NULL OR account.id = :account)" +
|
||||||
" AND ((:folder IS NULL AND folder.unified) OR folder.id = :folder)" +
|
" AND ((:folder IS NULL AND folder.unified) OR folder.id = :folder)" +
|
||||||
|
|
|
@ -312,6 +312,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||||
prefs.edit().putBoolean("color_stripe", checked).apply();
|
prefs.edit().putBoolean("color_stripe", checked).apply();
|
||||||
|
WidgetUnified.updateData(getContext());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ package eu.faircode.email;
|
||||||
|
|
||||||
public class TupleMessageWidget extends EntityMessage {
|
public class TupleMessageWidget extends EntityMessage {
|
||||||
public String accountName;
|
public String accountName;
|
||||||
|
public Integer accountColor;
|
||||||
public int unseen;
|
public int unseen;
|
||||||
public int unflagged;
|
public int unflagged;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,12 +45,14 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
||||||
private boolean threading;
|
private boolean threading;
|
||||||
private boolean subject_top;
|
private boolean subject_top;
|
||||||
private boolean subject_italic;
|
private boolean subject_italic;
|
||||||
|
private boolean color_stripe;
|
||||||
private long folder;
|
private long folder;
|
||||||
private long account;
|
private long account;
|
||||||
private boolean unseen;
|
private boolean unseen;
|
||||||
private boolean flagged;
|
private boolean flagged;
|
||||||
private int colorWidgetForeground;
|
private int colorWidgetForeground;
|
||||||
private int colorWidgetRead;
|
private int colorWidgetRead;
|
||||||
|
private int colorSeparator;
|
||||||
private boolean pro;
|
private boolean pro;
|
||||||
private List<TupleMessageWidget> messages = new ArrayList<>();
|
private List<TupleMessageWidget> messages = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -74,12 +76,14 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
||||||
threading = prefs.getBoolean("threading", true);
|
threading = prefs.getBoolean("threading", true);
|
||||||
subject_top = prefs.getBoolean("subject_top", false);
|
subject_top = prefs.getBoolean("subject_top", false);
|
||||||
subject_italic = prefs.getBoolean("subject_italic", true);
|
subject_italic = prefs.getBoolean("subject_italic", true);
|
||||||
|
color_stripe = prefs.getBoolean("color_stripe", true);
|
||||||
account = prefs.getLong("widget." + appWidgetId + ".account", -1L);
|
account = prefs.getLong("widget." + appWidgetId + ".account", -1L);
|
||||||
folder = prefs.getLong("widget." + appWidgetId + ".folder", -1L);
|
folder = prefs.getLong("widget." + appWidgetId + ".folder", -1L);
|
||||||
unseen = prefs.getBoolean("widget." + appWidgetId + ".unseen", false);
|
unseen = prefs.getBoolean("widget." + appWidgetId + ".unseen", false);
|
||||||
flagged = prefs.getBoolean("widget." + appWidgetId + ".flagged", false);
|
flagged = prefs.getBoolean("widget." + appWidgetId + ".flagged", false);
|
||||||
colorWidgetForeground = ContextCompat.getColor(context, R.color.colorWidgetForeground);
|
colorWidgetForeground = ContextCompat.getColor(context, R.color.colorWidgetForeground);
|
||||||
colorWidgetRead = ContextCompat.getColor(context, R.color.colorWidgetRead);
|
colorWidgetRead = ContextCompat.getColor(context, R.color.colorWidgetRead);
|
||||||
|
colorSeparator = ContextCompat.getColor(context, R.color.lightColorSeparator);
|
||||||
|
|
||||||
pro = ActivityBilling.isPro(context);
|
pro = ActivityBilling.isPro(context);
|
||||||
|
|
||||||
|
@ -128,6 +132,13 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
||||||
thread.putExtra("id", message.id);
|
thread.putExtra("id", message.id);
|
||||||
views.setOnClickFillInIntent(R.id.llMessage, thread);
|
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
|
SpannableString ssFrom = new SpannableString(pro
|
||||||
? MessageHelper.formatAddressesShort(message.from)
|
? MessageHelper.formatAddressesShort(message.from)
|
||||||
: context.getString(R.string.title_pro_feature));
|
: context.getString(R.string.title_pro_feature));
|
||||||
|
|
|
@ -2,62 +2,75 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/llMessage"
|
android:id="@+id/llMessage"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="horizontal">
|
||||||
android:paddingTop="6dp"
|
|
||||||
android:paddingBottom="6dp">
|
<FrameLayout
|
||||||
|
android:id="@+id/stripe"
|
||||||
|
android:layout_width="3dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@android:color/darker_gray" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:layout_marginStart="3dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="6dp"
|
||||||
|
android:paddingBottom="6dp">
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/tvFrom"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:orientation="horizontal">
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:text="From"
|
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
|
||||||
android:textColor="@color/colorWidgetForeground" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvTime"
|
android:id="@+id/tvFrom"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="From"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||||
|
android:textColor="@color/colorWidgetForeground" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvTime"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="6dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="12:34"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||||
|
android:textColor="@color/colorWidgetForeground" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="6dp"
|
android:orientation="horizontal">
|
||||||
android:maxLines="1"
|
|
||||||
android:text="12:34"
|
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
|
||||||
android:textColor="@color/colorWidgetForeground" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/tvSubject"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:orientation="horizontal">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="Subject"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||||
|
android:textColor="@color/colorWidgetForeground" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvSubject"
|
android:id="@+id/tvAccount"
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_marginStart="6dp"
|
||||||
android:ellipsize="end"
|
android:maxLines="1"
|
||||||
android:maxLines="1"
|
android:text="Account"
|
||||||
android:text="Subject"
|
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
android:textColor="@color/colorWidgetForeground" />
|
||||||
android:textColor="@color/colorWidgetForeground" />
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvAccount"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="6dp"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:text="Account"
|
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
|
||||||
android:textColor="@color/colorWidgetForeground" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
Loading…
Reference in New Issue