Added comments about colors

This commit is contained in:
Phillip Hsu 2016-09-01 03:53:32 -07:00
parent 331f012190
commit bff06c66f9
2 changed files with 8 additions and 0 deletions

View File

@ -182,7 +182,13 @@ public abstract class BaseAlarmViewHolder extends BaseViewHolder<Alarm> {
int def = colors.getDefaultColor();
// Too light
// int disabled = colors.getColorForState(new int[] {-android.R.attr.state_enabled}, def);
// Material guidelines say text hints and disabled text should have the same color.
int disabled = colorsSource.getCurrentHintTextColor();
// However, digging around in the system's textColorHint for 21+ says its 50% black for our
// light theme. I'd like to follow what the guidelines says, but I want code that is robust
// against theme changes. Alternatively, override the attribute values to what you want
// in both your dark and light themes...
// int disabled = ContextCompat.getColor(getContext(), R.color.text_color_disabled_light);
// We only have two states, so we don't care about losing the other state colors.
mTime.setTextColor(alarm.isEnabled() ? def : disabled);
}

View File

@ -69,6 +69,8 @@ public class ExpandedAlarmViewHolder extends BaseAlarmViewHolder {
/*item 1*/{/*states*/android.R.attr.state_checked},
/*item 2*/{/*states*/}
};
// TODO: Phase out Utils.getColorFromThemeAttr because it doesn't work for text colors.
// WHereas getTextColorFromThemeAttr works for both regular colors and text colors.
int[] colors = {
/*item 1*/Utils.getTextColorFromThemeAttr(getContext(), R.attr.colorAccent),
/*item 2*/Utils.getTextColorFromThemeAttr(getContext(), android.R.attr.textColorHint)