diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0c8d8c09f..e39c3047e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog
+## Unreleased - 112
+
+- Make the possibility to set a custom header more visible
+
## v2.18.1 - 111
- Arabic language support
diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java b/app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java
index c0e81b80f..d16c55678 100644
--- a/app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java
+++ b/app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java
@@ -117,6 +117,7 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity {
TabLayout tabs;
ImageView thumbnail;
+ ImageView thumbnailEditIcon;
EditText storeFieldEdit;
EditText noteFieldEdit;
ChipGroup groupsChips;
@@ -315,6 +316,7 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity {
tabs = findViewById(R.id.tabs);
thumbnail = findViewById(R.id.thumbnail);
+ thumbnailEditIcon = findViewById(R.id.thumbnailEditIcon);
storeFieldEdit = findViewById(R.id.storeNameEdit);
noteFieldEdit = findViewById(R.id.noteEdit);
groupsChips = findViewById(R.id.groupChips);
@@ -914,13 +916,21 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity {
generateIcon(storeFieldEdit.getText().toString());
+ thumbnailEditIcon.setBackgroundColor(Utils.needsDarkForeground(tempLoyaltyCard.headerColor) ? Color.BLACK : Color.WHITE);
+ thumbnailEditIcon.setColorFilter(Utils.needsDarkForeground(tempLoyaltyCard.headerColor) ? Color.WHITE : Color.BLACK);
+
onResuming = false;
}
protected void setColorFromIcon() {
Object icon = thumbnail.getTag();
if (icon != null && (icon instanceof Bitmap)) {
- updateTempState(LoyaltyCardField.headerColor, Utils.getHeaderColorFromImage((Bitmap) icon, tempLoyaltyCard.headerColor != null ? tempLoyaltyCard.headerColor : R.attr.colorPrimary));
+ int headerColor = Utils.getHeaderColorFromImage((Bitmap) icon, tempLoyaltyCard.headerColor != null ? tempLoyaltyCard.headerColor : R.attr.colorPrimary);
+
+ updateTempState(LoyaltyCardField.headerColor, headerColor);
+
+ thumbnailEditIcon.setBackgroundColor(Utils.needsDarkForeground(headerColor) ? Color.BLACK : Color.WHITE);
+ thumbnailEditIcon.setColorFilter(Utils.needsDarkForeground(headerColor) ? Color.WHITE : Color.BLACK);
} else {
Log.d("setColorFromIcon", "attempting header color change from icon but icon does not exist");
}
@@ -1102,6 +1112,9 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity {
public void onColorSelected(int dialogId, int color) {
updateTempState(LoyaltyCardField.headerColor, color);
+ thumbnailEditIcon.setBackgroundColor(Utils.needsDarkForeground(color) ? Color.BLACK : Color.WHITE);
+ thumbnailEditIcon.setColorFilter(Utils.needsDarkForeground(color) ? Color.WHITE : Color.BLACK);
+
// Unset image if set
thumbnail.setTag(null);
diff --git a/app/src/main/res/layout/loyalty_card_edit_activity.xml b/app/src/main/res/layout/loyalty_card_edit_activity.xml
index 727db1300..fb60d70bc 100644
--- a/app/src/main/res/layout/loyalty_card_edit_activity.xml
+++ b/app/src/main/res/layout/loyalty_card_edit_activity.xml
@@ -82,6 +82,17 @@
android:contentDescription="@string/thumbnailDescription"
android:src="@mipmap/ic_launcher"/>
+
+
46dp
200dp
+ 21dp
8dp
16dp