mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-04-13 20:07:36 -04:00
Support selecting exactly which details to view in main view
This commit is contained in:
@@ -560,16 +560,6 @@ public class Utils {
|
||||
activity.findViewById(android.R.id.content).setBackgroundColor(typedValue.data);
|
||||
}
|
||||
|
||||
public static void updateMenuCardDetailsButtonState(MenuItem item, boolean currentlyExpanded) {
|
||||
if (currentlyExpanded) {
|
||||
item.setIcon(R.drawable.ic_baseline_unfold_less_24);
|
||||
item.setTitle(R.string.action_hide_details);
|
||||
} else {
|
||||
item.setIcon(R.drawable.ic_baseline_unfold_more_24);
|
||||
item.setTitle(R.string.action_show_details);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getHeaderColorFromImage(Bitmap image, int fallback) {
|
||||
if (image == null) {
|
||||
return fallback;
|
||||
@@ -603,23 +593,25 @@ public class Utils {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static void setIconOrTextWithBackground(Context context, LoyaltyCard loyaltyCard, ImageView backgroundOrIcon, TextView textWhenNoImage) {
|
||||
public static void setIconOrTextWithBackground(Context context, LoyaltyCard loyaltyCard, ImageView backgroundOrIcon, TextView textWhenNoImage, boolean alwaysShowTextView) {
|
||||
Bitmap icon = Utils.retrieveCardImage(context, loyaltyCard.id, ImageLocationType.icon);
|
||||
int headerColor = loyaltyCard.headerColor != null ? loyaltyCard.headerColor : LetterBitmap.getDefaultColor(context, loyaltyCard.store);
|
||||
|
||||
if (icon != null) {
|
||||
Log.d("onResume", "setting icon image");
|
||||
textWhenNoImage.setVisibility(View.GONE);
|
||||
|
||||
backgroundOrIcon.setImageBitmap(icon);
|
||||
backgroundOrIcon.setBackgroundColor(Color.TRANSPARENT);
|
||||
} else {
|
||||
textWhenNoImage.setVisibility(View.VISIBLE);
|
||||
|
||||
int headerColor = loyaltyCard.headerColor != null ? loyaltyCard.headerColor : LetterBitmap.getDefaultColor(context, loyaltyCard.store);
|
||||
|
||||
backgroundOrIcon.setImageBitmap(null);
|
||||
backgroundOrIcon.setBackgroundColor(headerColor);
|
||||
}
|
||||
|
||||
if (icon == null || alwaysShowTextView) {
|
||||
textWhenNoImage.setVisibility(View.VISIBLE);
|
||||
textWhenNoImage.setText(loyaltyCard.store);
|
||||
textWhenNoImage.setTextColor(Utils.needsDarkForeground(headerColor) ? Color.BLACK : Color.WHITE);
|
||||
} else {
|
||||
textWhenNoImage.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user