Lighter default color for tags

pull/437/head
Alex Baker 8 years ago
parent 66e4d4380c
commit 9496a31c94

@ -60,6 +60,7 @@ import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.preferences.Preferences;
import org.tasks.themes.ThemeCache;
import org.tasks.themes.ThemeColor;
import org.tasks.ui.CheckBoxes;
import java.util.HashMap;
@ -556,11 +557,10 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
String tagName = tagData.getName();
tagName = tagName.substring(0, Math.min(tagName.length(), (int) maxLength));
SpannableString string = new SpannableString(SPACE + tagName + SPACE);
int themeIndex = tagData.getColor() >= 0 ? tagData.getColor() : 19;
int backgroundColor = themeCache.getThemeColor(themeIndex).getPrimaryColor();
int foregroundColor = themeCache.getThemeColor(themeIndex).getActionBarTint();
string.setSpan(new BackgroundColorSpan(backgroundColor), 0, string.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
string.setSpan(new ForegroundColorSpan(foregroundColor), 0, string.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
int themeIndex = tagData.getColor();
ThemeColor color = themeIndex >= 0 ? themeCache.getThemeColor(themeIndex) : themeCache.getUntaggedColor();
string.setSpan(new BackgroundColorSpan(color.getPrimaryColor()), 0, string.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
string.setSpan(new ForegroundColorSpan(color.getActionBarTint()), 0, string.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
return string;
}
};

@ -118,11 +118,10 @@ public final class TagsControlSet extends TaskEditControlFragment {
.substring(0, Math.min(tagName.length(), (int) maxLength))
.replace(' ', NO_BREAK_SPACE);
SpannableString string = new SpannableString(NO_BREAK_SPACE + tagName + NO_BREAK_SPACE);
int themeIndex = tagData.getColor() >= 0 ? tagData.getColor() : 19;
int backgroundColor = themeCache.getThemeColor(themeIndex).getPrimaryColor();
int foregroundColor = themeCache.getThemeColor(themeIndex).getActionBarTint();
string.setSpan(new BackgroundColorSpan(backgroundColor), 0, string.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
string.setSpan(new ForegroundColorSpan(foregroundColor), 0, string.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
int themeIndex = tagData.getColor();
ThemeColor color = themeIndex >= 0 ? themeCache.getThemeColor(themeIndex) : themeCache.getUntaggedColor();
string.setSpan(new BackgroundColorSpan(color.getPrimaryColor()), 0, string.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
string.setSpan(new ForegroundColorSpan(color.getActionBarTint()), 0, string.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
return string;
}
};

@ -15,6 +15,7 @@ public class ThemeCache {
private final List<ThemeBase> themes = new ArrayList<>();
private final List<ThemeColor> colors = new ArrayList<>();
private final List<ThemeAccent> accents = new ArrayList<>();
private final ThemeColor untaggedColor;
public ThemeCache(Context context) {
Resources resources = context.getResources();
@ -50,6 +51,7 @@ public class ThemeCache {
i,
resolveAttribute(theme, R.attr.colorAccent)));
}
untaggedColor = new ThemeColor(null, 19, resources.getColor(R.color.tag_color_none_background), 0, resources.getColor(R.color.black_87), false);
}
public ThemeBase getThemeBase(int index) {
@ -64,6 +66,10 @@ public class ThemeCache {
return accents.get(index);
}
public ThemeColor getUntaggedColor() {
return untaggedColor;
}
private static int resolveAttribute(Resources.Theme theme, int attribute) {
TypedValue typedValue = new TypedValue();
theme.resolveAttribute(attribute, typedValue, true);

@ -121,6 +121,7 @@
<color name="snackbar_text_color">#f4b400</color>
<color name="snackbar_background">@color/grey_800</color>
<color name="tag_color_none_background">#e1e1e1</color>
<!-- deprecated -->
<color name="reminder_background">#262626</color>

Loading…
Cancel
Save