various color fixes

band-aid fixes for splash screen and material 3 dynamic color api

change editbutton icon's color in card view based on editbutton background color

make status bar transparent as per material 3, or tainted transparent for api level < 23 + light theme
This commit is contained in:
Katharine Chui
2022-02-02 00:28:27 +08:00
parent 9aa6acccda
commit 329be8abbb
3 changed files with 41 additions and 1 deletions

View File

@@ -50,6 +50,7 @@ import androidx.appcompat.widget.Toolbar;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.Guideline;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.ColorUtils;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.widget.NestedScrollView;
@@ -575,7 +576,16 @@ public class LoyaltyCardViewActivity extends CatimaAppCompatActivity implements
maximizeButton.setColorFilter(textColor);
minimizeButton.setColorFilter(textColor);
bottomSheetButton.setColorFilter(textColor);
editButton.setBackgroundTintList(ColorStateList.valueOf(Utils.getComplementaryColor(darkenedColor)));
int complementaryColor = Utils.getComplementaryColor(darkenedColor);
editButton.setBackgroundTintList(ColorStateList.valueOf(complementaryColor));
Drawable editButtonIcon = editButton.getDrawable();
editButtonIcon.mutate();
if (Utils.needsDarkForeground(complementaryColor)) {
editButtonIcon.setTint(ContextCompat.getColor(this, R.color.md_theme_light_onBackground));
} else {
editButtonIcon.setTint(ContextCompat.getColor(this, R.color.md_theme_dark_onBackground));
}
editButton.setImageDrawable(editButtonIcon);
Bitmap icon = Utils.retrieveCardImage(this, loyaltyCard.id, ImageLocationType.icon);
if (icon != null) {