Warning color for insecure accounts/identities

This commit is contained in:
M66B 2023-04-30 09:22:14 +02:00
parent cadc97d77e
commit 3042e0d65b
2 changed files with 16 additions and 2 deletions

View File

@ -88,6 +88,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
private int colorWarning;
private int colorUnread;
private int textColorSecondary;
private int textColorTertiary;
private boolean debug;
private List<TupleAccountEx> items = new ArrayList<>();
@ -250,7 +251,11 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
}
ivState.setVisibility(account.synchronize || account.state != null ? View.VISIBLE : View.INVISIBLE);
tvHost.setText(String.format("%s:%d", account.host, account.port));
tvHost.setText(String.format("%s:%d/%s",
account.host,
account.port,
EmailService.getEncryptionName(account.encryption)));
tvHost.setTextColor(account.insecure ? colorWarning : textColorTertiary);
tvCreated.setVisibility(debug ? View.VISIBLE : View.GONE);
tvCreated.setText(context.getString(R.string.title_created_at,
account.created == null ? null : DTF.format(account.created)));
@ -727,6 +732,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
int colorHighlight = prefs.getInt("highlight_color", Helper.resolveColor(context, R.attr.colorUnreadHighlight));
this.colorUnread = (highlight_unread ? colorHighlight : Helper.resolveColor(context, R.attr.colorUnread));
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
this.textColorTertiary = Helper.resolveColor(context, android.R.attr.textColorTertiary);
this.debug = prefs.getBoolean("debug", false);
this.DTF = Helper.getDateTimeInstance(context, DateFormat.SHORT, DateFormat.MEDIUM);

View File

@ -69,6 +69,8 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
private LayoutInflater inflater;
private int colorStripeWidth;
private int colorWarning;
private int textColorTertiary;
private boolean debug;
private List<TupleIdentityEx> items = new ArrayList<>();
@ -162,7 +164,11 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
}
ivState.setVisibility(identity.synchronize ? View.VISIBLE : View.INVISIBLE);
tvHost.setText(String.format("%s:%d", identity.host, identity.port));
tvHost.setText(String.format("%s:%d/%s",
identity.host,
identity.port,
EmailService.getEncryptionName(identity.encryption)));
tvHost.setTextColor(identity.insecure ? colorWarning : textColorTertiary);
tvAccount.setText(identity.accountName);
StringBuilder sb = new StringBuilder();
@ -429,6 +435,8 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean color_stripe_wide = prefs.getBoolean("color_stripe_wide", false);
this.colorStripeWidth = Helper.dp2pixels(context, color_stripe_wide ? 12 : 6);
this.colorWarning = Helper.resolveColor(context, R.attr.colorWarning);
this.textColorTertiary = Helper.resolveColor(context, android.R.attr.textColorTertiary);
this.debug = prefs.getBoolean("debug", false);
this.DTF = Helper.getDateTimeInstance(context, DateFormat.SHORT, DateFormat.SHORT);