mirror of
https://github.com/M66B/FairEmail.git
synced 2026-05-19 13:34:00 +02:00
Added showing stars in unified widget
This commit is contained in:
@@ -63,6 +63,7 @@ public class ActivityWidgetUnified extends ActivityBase {
|
||||
private CheckBox cbUnseen;
|
||||
private CheckBox cbShowUnseen;
|
||||
private CheckBox cbFlagged;
|
||||
private CheckBox cbShowFlagged;
|
||||
private CheckBox cbDayNight;
|
||||
private CheckBox cbHighlight;
|
||||
private ViewButtonColor btnHighlight;
|
||||
@@ -110,6 +111,7 @@ public class ActivityWidgetUnified extends ActivityBase {
|
||||
boolean unseen = prefs.getBoolean("widget." + appWidgetId + ".unseen", false);
|
||||
boolean show_unseen = prefs.getBoolean("widget." + appWidgetId + ".show_unseen", true);
|
||||
boolean flagged = prefs.getBoolean("widget." + appWidgetId + ".flagged", false);
|
||||
boolean show_flagged = prefs.getBoolean("widget." + appWidgetId + ".show_flagged", false);
|
||||
boolean daynight = prefs.getBoolean("widget." + appWidgetId + ".daynight", false);
|
||||
boolean highlight = prefs.getBoolean("widget." + appWidgetId + ".highlight", false);
|
||||
int highlight_color = prefs.getInt("widget." + appWidgetId + ".highlight_color", Color.TRANSPARENT);
|
||||
@@ -139,6 +141,7 @@ public class ActivityWidgetUnified extends ActivityBase {
|
||||
cbUnseen = findViewById(R.id.cbUnseen);
|
||||
cbShowUnseen = findViewById(R.id.cbShowUnseen);
|
||||
cbFlagged = findViewById(R.id.cbFlagged);
|
||||
cbShowFlagged = findViewById(R.id.cbShowFlagged);
|
||||
cbDayNight = findViewById(R.id.cbDayNight);
|
||||
cbHighlight = findViewById(R.id.cbHighlight);
|
||||
btnHighlight = findViewById(R.id.btnHighlight);
|
||||
@@ -170,6 +173,15 @@ public class ActivityWidgetUnified extends ActivityBase {
|
||||
}
|
||||
});
|
||||
|
||||
cbFlagged.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
cbShowFlagged.setEnabled(!isChecked);
|
||||
}
|
||||
});
|
||||
|
||||
cbShowFlagged.setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.S ? View.GONE : View.VISIBLE);
|
||||
|
||||
cbDayNight.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
@@ -306,6 +318,7 @@ public class ActivityWidgetUnified extends ActivityBase {
|
||||
editor.putBoolean("widget." + appWidgetId + ".show_unseen", cbShowUnseen.isChecked());
|
||||
editor.putBoolean("widget." + appWidgetId + ".daynight", cbDayNight.isChecked());
|
||||
editor.putBoolean("widget." + appWidgetId + ".flagged", cbFlagged.isChecked());
|
||||
editor.putBoolean("widget." + appWidgetId + ".show_flagged", cbShowFlagged.isChecked());
|
||||
editor.putBoolean("widget." + appWidgetId + ".highlight", cbHighlight.isChecked());
|
||||
editor.putInt("widget." + appWidgetId + ".highlight_color", btnHighlight.getColor());
|
||||
editor.putBoolean("widget." + appWidgetId + ".semi", cbSemiTransparent.isChecked());
|
||||
@@ -436,6 +449,8 @@ public class ActivityWidgetUnified extends ActivityBase {
|
||||
cbShowUnseen.setChecked(show_unseen);
|
||||
cbShowUnseen.setEnabled(cbUnseen.isChecked());
|
||||
cbFlagged.setChecked(flagged);
|
||||
cbShowFlagged.setChecked(show_flagged);
|
||||
cbShowFlagged.setEnabled(!flagged);
|
||||
cbDayNight.setChecked(daynight);
|
||||
cbDayNight.setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.S ? View.GONE : View.VISIBLE);
|
||||
cbHighlight.setChecked(highlight);
|
||||
|
||||
@@ -59,6 +59,7 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
||||
private boolean unseen;
|
||||
private boolean show_unseen;
|
||||
private boolean flagged;
|
||||
private boolean show_flagged;
|
||||
private boolean daynight;
|
||||
private boolean highlight;
|
||||
private int highlight_color;
|
||||
@@ -77,6 +78,7 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
||||
private int colorWidgetForeground;
|
||||
private int colorWidgetUnread;
|
||||
private int colorWidgetRead;
|
||||
private int colorFlagged;
|
||||
private int colorSeparator;
|
||||
private boolean pro;
|
||||
private boolean hasColor;
|
||||
@@ -112,6 +114,7 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
||||
unseen = prefs.getBoolean("widget." + appWidgetId + ".unseen", false);
|
||||
show_unseen = prefs.getBoolean("widget." + appWidgetId + ".show_unseen", true);
|
||||
flagged = prefs.getBoolean("widget." + appWidgetId + ".flagged", false);
|
||||
show_flagged = prefs.getBoolean("widget." + appWidgetId + ".show_flagged", false);
|
||||
daynight = prefs.getBoolean("widget." + appWidgetId + ".daynight", false);
|
||||
highlight = prefs.getBoolean("widget." + appWidgetId + ".highlight", false);
|
||||
highlight_color = prefs.getInt("widget." + appWidgetId + ".highlight_color", Color.TRANSPARENT);
|
||||
@@ -149,6 +152,8 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
||||
} else
|
||||
colorWidgetUnread = colorWidgetForeground;
|
||||
|
||||
colorFlagged = ContextCompat.getColor(context, lum > 0.7f ? R.color.lightYellowAccent : R.color.darkYellowAccent);
|
||||
|
||||
pro = ActivityBilling.isPro(context);
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
@@ -325,6 +330,14 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
||||
views.setTextColor(R.id.tvNotes, message.notes_color == null ? colorWidgetRead : message.notes_color);
|
||||
views.setViewVisibility(R.id.tvNotes, message.notes == null ? View.GONE : View.VISIBLE);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
views.setImageViewResource(R.id.ivFlagged, message.ui_flagged ? R.drawable.baseline_star_24 : R.drawable.twotone_star_border_24);
|
||||
views.setColorStateList(R.id.ivFlagged, "setImageTintList",
|
||||
ColorStateList.valueOf(message.ui_flagged ? colorFlagged : colorSeparator));
|
||||
views.setViewVisibility(R.id.ivFlagged, !flagged && show_flagged ? View.VISIBLE : View.GONE);
|
||||
} else
|
||||
views.setViewVisibility(R.id.ivFlagged, View.GONE);
|
||||
|
||||
views.setViewVisibility(R.id.separator, separators ? View.VISIBLE : View.GONE);
|
||||
|
||||
views.setViewVisibility(idAccount, account < 0 && !allColors && account_name ? View.VISIBLE : View.GONE);
|
||||
|
||||
Reference in New Issue
Block a user