mirror of https://github.com/M66B/FairEmail.git
Fillin widget from address
This commit is contained in:
parent
333454e9c2
commit
89571b7287
|
@ -42,6 +42,8 @@ import androidx.preference.PreferenceManager;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.mail.Address;
|
||||||
|
|
||||||
public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactory {
|
public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactory {
|
||||||
private Context context;
|
private Context context;
|
||||||
private int appWidgetId;
|
private int appWidgetId;
|
||||||
|
@ -58,6 +60,8 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
||||||
private int background;
|
private int background;
|
||||||
private int font;
|
private int font;
|
||||||
private int padding;
|
private int padding;
|
||||||
|
private boolean prefer_contact;
|
||||||
|
private boolean only_contact;
|
||||||
private int colorStripeWidth;
|
private int colorStripeWidth;
|
||||||
private int colorWidgetForeground;
|
private int colorWidgetForeground;
|
||||||
private int colorWidgetRead;
|
private int colorWidgetRead;
|
||||||
|
@ -95,8 +99,12 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
||||||
background = prefs.getInt("widget." + appWidgetId + ".background", Color.TRANSPARENT);
|
background = prefs.getInt("widget." + appWidgetId + ".background", Color.TRANSPARENT);
|
||||||
font = prefs.getInt("widget." + appWidgetId + ".font", 0);
|
font = prefs.getInt("widget." + appWidgetId + ".font", 0);
|
||||||
padding = prefs.getInt("widget." + appWidgetId + ".padding", 0);
|
padding = prefs.getInt("widget." + appWidgetId + ".padding", 0);
|
||||||
|
prefer_contact = prefs.getBoolean("prefer_contact", false);
|
||||||
|
only_contact = prefs.getBoolean("only_contact", false);
|
||||||
|
|
||||||
boolean color_stripe_wide = prefs.getBoolean("color_stripe_wide", false);
|
boolean color_stripe_wide = prefs.getBoolean("color_stripe_wide", false);
|
||||||
this.colorStripeWidth = Helper.dp2pixels(context, color_stripe_wide ? 12 : 6);
|
this.colorStripeWidth = Helper.dp2pixels(context, color_stripe_wide ? 12 : 6);
|
||||||
|
|
||||||
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);
|
colorSeparator = ContextCompat.getColor(context, R.color.lightColorSeparator);
|
||||||
|
@ -183,8 +191,10 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
||||||
views.setInt(R.id.stripe, "setBackgroundColor", colorBackground);
|
views.setInt(R.id.stripe, "setBackgroundColor", colorBackground);
|
||||||
views.setViewVisibility(R.id.stripe, hasColor && color_stripe ? View.VISIBLE : View.GONE);
|
views.setViewVisibility(R.id.stripe, hasColor && color_stripe ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
|
Address[] recipients = ContactInfo.fillIn(message.from, prefer_contact, only_contact);
|
||||||
|
|
||||||
SpannableString ssFrom = new SpannableString(pro
|
SpannableString ssFrom = new SpannableString(pro
|
||||||
? MessageHelper.formatAddressesShort(message.from)
|
? MessageHelper.formatAddressesShort(recipients)
|
||||||
: context.getString(R.string.title_pro_feature));
|
: context.getString(R.string.title_pro_feature));
|
||||||
SpannableString ssTime = new SpannableString(
|
SpannableString ssTime = new SpannableString(
|
||||||
Helper.getRelativeTimeSpanString(context, message.received));
|
Helper.getRelativeTimeSpanString(context, message.received));
|
||||||
|
|
Loading…
Reference in New Issue