mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-05-10 17:13:02 -04:00
Make header colour code more consistent (#1363)
- Ensure a header colour is picked for the main screen - Simplify all different header colour code pickers into a single code path
This commit is contained in:
@@ -853,10 +853,9 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity implements
|
||||
}
|
||||
}
|
||||
|
||||
// Generate random header color
|
||||
if (tempLoyaltyCard.headerColor == null) {
|
||||
// Select a random color to start out with.
|
||||
updateTempState(LoyaltyCardField.headerColor, Utils.getRandomHeaderColor(this));
|
||||
// If name is set, pick colour relevant for name. Otherwise pick randomly
|
||||
updateTempState(LoyaltyCardField.headerColor, tempLoyaltyCard.store.isEmpty() ? Utils.getRandomHeaderColor(this) : Utils.getHeaderColor(this, tempLoyaltyCard));
|
||||
}
|
||||
|
||||
// Update from intent
|
||||
@@ -928,7 +927,7 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity implements
|
||||
protected void setColorFromIcon() {
|
||||
Object icon = thumbnail.getTag();
|
||||
if (icon != null && (icon instanceof Bitmap)) {
|
||||
int headerColor = Utils.getHeaderColorFromImage((Bitmap) icon, tempLoyaltyCard.headerColor != null ? tempLoyaltyCard.headerColor : androidx.appcompat.R.attr.colorPrimary);
|
||||
int headerColor = Utils.getHeaderColorFromImage((Bitmap) icon, Utils.getHeaderColor(this, tempLoyaltyCard));
|
||||
|
||||
updateTempState(LoyaltyCardField.headerColor, headerColor);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user