Revert "Always set card background color"

This reverts commit 9ca9a86416.
This commit is contained in:
M66B 2020-01-02 21:27:00 +01:00
parent 9ca9a86416
commit 59bd4ec833
1 changed files with 10 additions and 5 deletions

View File

@ -37,6 +37,7 @@ public class ViewCardOptional extends CardView {
private boolean threading; private boolean threading;
private int margin; private int margin;
private int ident; private int ident;
private Integer color = null;
public ViewCardOptional(@NonNull Context context) { public ViewCardOptional(@NonNull Context context) {
super(context); super(context);
@ -82,12 +83,16 @@ public class ViewCardOptional extends CardView {
@Override @Override
public void setCardBackgroundColor(int color) { public void setCardBackgroundColor(int color) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); if (this.color == null || this.color != color) {
boolean cards = prefs.getBoolean("cards", true); this.color = color;
if (cards && color == Color.TRANSPARENT)
color = Helper.resolveColor(getContext(), R.attr.colorCardBackground);
super.setCardBackgroundColor(color); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean cards = prefs.getBoolean("cards", true);
if (cards && color == Color.TRANSPARENT)
color = Helper.resolveColor(getContext(), R.attr.colorCardBackground);
super.setCardBackgroundColor(color);
}
} }
public void setOutgoing(boolean outgoing) { public void setOutgoing(boolean outgoing) {