diff --git a/app/src/main/java/eu/faircode/email/FragmentAccount.java b/app/src/main/java/eu/faircode/email/FragmentAccount.java index 138945c8ac..17edb44612 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccount.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccount.java @@ -320,7 +320,7 @@ public class FragmentAccount extends FragmentBase { } }); - vwColor.setBackgroundColor(color); + setColor(color); btnColor.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -1379,7 +1379,7 @@ public class FragmentAccount extends FragmentBase { } private void setColor(int color) { - FragmentAccount.this.color = color; + this.color = color; GradientDrawable border = new GradientDrawable(); border.setColor(color); diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentity.java b/app/src/main/java/eu/faircode/email/FragmentIdentity.java index 46edfc3898..6d49c3f271 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentity.java @@ -273,7 +273,7 @@ public class FragmentIdentity extends FragmentBase { } }); - vwColor.setBackgroundColor(color); + setColor(color); btnColor.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -991,7 +991,7 @@ public class FragmentIdentity extends FragmentBase { } private void setColor(int color) { - FragmentIdentity.this.color = color; + this.color = color; GradientDrawable border = new GradientDrawable(); border.setColor(color); diff --git a/app/src/main/java/eu/faircode/email/FragmentRule.java b/app/src/main/java/eu/faircode/email/FragmentRule.java index 116547c3f7..735cd1211a 100644 --- a/app/src/main/java/eu/faircode/email/FragmentRule.java +++ b/app/src/main/java/eu/faircode/email/FragmentRule.java @@ -131,7 +131,7 @@ public class FragmentRule extends FragmentBase { private long id = -1; private long account = -1; private long folder = -1; - private Integer color = null; + private int color = Color.TRANSPARENT; private final static int MAX_CHECK = 10; @@ -289,12 +289,10 @@ public class FragmentRule extends FragmentBase { tvActionRemark.setVisibility(View.GONE); - vwColor.setBackgroundColor(color == null ? Color.TRANSPARENT : color); - + setColor(color); btnColor.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - int color = (FragmentRule.this.color == null ? Color.TRANSPARENT : FragmentRule.this.color); int[] colors = getContext().getResources().getIntArray(R.array.colorPicker); ColorPickerDialog colorPickerDialog = new ColorPickerDialog(); colorPickerDialog.initialize(R.string.title_flag_color, colors, color, 4, colors.length); @@ -311,7 +309,7 @@ public class FragmentRule extends FragmentBase { ibColorDefault.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - setColor(null); + setColor(Color.TRANSPARENT); } }); @@ -501,7 +499,7 @@ public class FragmentRule extends FragmentBase { break; case EntityRule.TYPE_FLAG: - setColor(jaction.isNull("color") ? null : jaction.getInt("color")); + setColor(jaction.isNull("color") ? Color.TRANSPARENT : jaction.getInt("color")); break; case EntityRule.TYPE_MOVE: @@ -796,12 +794,9 @@ public class FragmentRule extends FragmentBase { grpAutomation.setVisibility(type == EntityRule.TYPE_AUTOMATION ? View.VISIBLE : View.GONE); } - private void setColor(Integer color) { + private void setColor(int color) { this.color = color; - if (color == null) - color = Color.TRANSPARENT; - GradientDrawable border = new GradientDrawable(); border.setColor(color); border.setStroke(1, Helper.resolveColor(getContext(), R.attr.colorSeparator));