Skip to content

Commit e6345bc

Browse files
Make thumbnails in edit view consistent with card view
Commit 88c1dd1 changed the behaviour of the background colour of the thumbnails, but the edit view still used the old behaviour. This creates more consistency.
1 parent 208b1a2 commit e6345bc

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,33 +1005,25 @@ protected void onResume() {
10051005
}
10061006
}
10071007

1008-
protected void setColorFromIcon() {
1009-
Object icon = thumbnail.getTag();
1010-
if (icon != null && (icon instanceof Bitmap)) {
1011-
int headerColor = Utils.getHeaderColorFromImage((Bitmap) icon, Utils.getHeaderColor(this, tempLoyaltyCard));
1008+
protected void setThumbnailImage(@Nullable Bitmap bitmap) {
1009+
setCardImage(thumbnail, bitmap, false);
1010+
1011+
if (bitmap != null) {
1012+
int headerColor = Utils.getHeaderColorFromImage(bitmap, Utils.getHeaderColor(this, tempLoyaltyCard));
10121013

10131014
setLoyaltyCardHeaderColor(headerColor);
10141015

1016+
thumbnail.setBackgroundColor(Utils.needsDarkForeground(headerColor) ? Color.BLACK : Color.WHITE);
1017+
10151018
thumbnailEditIcon.setBackgroundColor(Utils.needsDarkForeground(headerColor) ? Color.BLACK : Color.WHITE);
10161019
thumbnailEditIcon.setColorFilter(Utils.needsDarkForeground(headerColor) ? Color.WHITE : Color.BLACK);
10171020
} else {
1018-
Log.d("setColorFromIcon", "attempting header color change from icon but icon does not exist");
1019-
}
1020-
}
1021-
1022-
protected void setThumbnailImage(@Nullable Bitmap bitmap) {
1023-
setCardImage(thumbnail, bitmap, false);
1024-
1025-
if (bitmap == null) {
10261021
generateIcon(storeFieldEdit.getText().toString().trim());
1027-
} else {
1028-
thumbnail.setBackgroundColor(Color.TRANSPARENT);
1029-
setColorFromIcon();
1030-
}
10311022

1032-
if (tempLoyaltyCard.headerColor != null) {
1033-
thumbnailEditIcon.setBackgroundColor(Utils.needsDarkForeground(tempLoyaltyCard.headerColor) ? Color.BLACK : Color.WHITE);
1034-
thumbnailEditIcon.setColorFilter(Utils.needsDarkForeground(tempLoyaltyCard.headerColor) ? Color.WHITE : Color.BLACK);
1023+
if (tempLoyaltyCard.headerColor != null) {
1024+
thumbnailEditIcon.setBackgroundColor(Utils.needsDarkForeground(tempLoyaltyCard.headerColor) ? Color.BLACK : Color.WHITE);
1025+
thumbnailEditIcon.setColorFilter(Utils.needsDarkForeground(tempLoyaltyCard.headerColor) ? Color.WHITE : Color.BLACK);
1026+
}
10351027
}
10361028
}
10371029

0 commit comments

Comments
 (0)