|
|
|
@ -42,6 +42,7 @@ public class ChipProvider {
|
|
|
|
private final Inventory inventory;
|
|
|
|
private final Inventory inventory;
|
|
|
|
private final int iconAlpha;
|
|
|
|
private final int iconAlpha;
|
|
|
|
private final ChipListCache lists;
|
|
|
|
private final ChipListCache lists;
|
|
|
|
|
|
|
|
private final Preferences preferences;
|
|
|
|
private final ColorProvider colorProvider;
|
|
|
|
private final ColorProvider colorProvider;
|
|
|
|
private final Locale locale;
|
|
|
|
private final Locale locale;
|
|
|
|
private final Ordering<TagFilter> orderByName =
|
|
|
|
private final Ordering<TagFilter> orderByName =
|
|
|
|
@ -68,6 +69,7 @@ public class ChipProvider {
|
|
|
|
iconAlpha =
|
|
|
|
iconAlpha =
|
|
|
|
(int) (255 * ResourcesCompat.getFloat(activity.getResources(), R.dimen.alpha_secondary));
|
|
|
|
(int) (255 * ResourcesCompat.getFloat(activity.getResources(), R.dimen.alpha_secondary));
|
|
|
|
this.lists = lists;
|
|
|
|
this.lists = lists;
|
|
|
|
|
|
|
|
this.preferences = preferences;
|
|
|
|
this.colorProvider = colorProvider;
|
|
|
|
this.colorProvider = colorProvider;
|
|
|
|
this.locale = locale;
|
|
|
|
this.locale = locale;
|
|
|
|
|
|
|
|
|
|
|
|
@ -109,31 +111,33 @@ public class ChipProvider {
|
|
|
|
if (task.hasChildren()) {
|
|
|
|
if (task.hasChildren()) {
|
|
|
|
chips.add(newSubtaskChip(task, !showText));
|
|
|
|
chips.add(newSubtaskChip(task, !showText));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (task.hasLocation() && !(filter instanceof PlaceFilter)) {
|
|
|
|
if (preferences.getBoolean(R.string.p_show_list_indicators, true)) {
|
|
|
|
Location location = task.getLocation();
|
|
|
|
if (task.hasLocation() && !(filter instanceof PlaceFilter)) {
|
|
|
|
chips.add(newChip(new PlaceFilter(location.getPlace()), R.drawable.ic_outline_place_24px));
|
|
|
|
Location location = task.getLocation();
|
|
|
|
}
|
|
|
|
chips.add(newChip(new PlaceFilter(location.getPlace()), R.drawable.ic_outline_place_24px));
|
|
|
|
if (!isSubtask) {
|
|
|
|
|
|
|
|
if (!Strings.isNullOrEmpty(task.getGoogleTaskList()) && !(filter instanceof GtasksFilter)) {
|
|
|
|
|
|
|
|
chips.add(
|
|
|
|
|
|
|
|
newChip(
|
|
|
|
|
|
|
|
lists.getGoogleTaskList(task.getGoogleTaskList()),
|
|
|
|
|
|
|
|
R.drawable.ic_outline_cloud_24px));
|
|
|
|
|
|
|
|
} else if (!Strings.isNullOrEmpty(task.getCaldav()) && !(filter instanceof CaldavFilter)) {
|
|
|
|
|
|
|
|
chips.add(
|
|
|
|
|
|
|
|
newChip(lists.getCaldavList(task.getCaldav()), R.drawable.ic_outline_cloud_24px));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!isSubtask) {
|
|
|
|
String tagString = task.getTagsString();
|
|
|
|
if (!Strings.isNullOrEmpty(task.getGoogleTaskList()) && !(filter instanceof GtasksFilter)) {
|
|
|
|
if (!Strings.isNullOrEmpty(tagString)) {
|
|
|
|
chips.add(
|
|
|
|
Set<String> tags = newHashSet(tagString.split(","));
|
|
|
|
newChip(
|
|
|
|
if (filter instanceof TagFilter) {
|
|
|
|
lists.getGoogleTaskList(task.getGoogleTaskList()),
|
|
|
|
tags.remove(((TagFilter) filter).getUuid());
|
|
|
|
R.drawable.ic_outline_cloud_24px));
|
|
|
|
|
|
|
|
} else if (!Strings.isNullOrEmpty(task.getCaldav()) && !(filter instanceof CaldavFilter)) {
|
|
|
|
|
|
|
|
chips.add(
|
|
|
|
|
|
|
|
newChip(lists.getCaldavList(task.getCaldav()), R.drawable.ic_outline_cloud_24px));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String tagString = task.getTagsString();
|
|
|
|
|
|
|
|
if (!Strings.isNullOrEmpty(tagString)) {
|
|
|
|
|
|
|
|
Set<String> tags = newHashSet(tagString.split(","));
|
|
|
|
|
|
|
|
if (filter instanceof TagFilter) {
|
|
|
|
|
|
|
|
tags.remove(((TagFilter) filter).getUuid());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
chips.addAll(
|
|
|
|
|
|
|
|
transform(
|
|
|
|
|
|
|
|
orderByName.sortedCopy(filter(transform(tags, lists::getTag), Predicates.notNull())),
|
|
|
|
|
|
|
|
tag -> newChip(tag, R.drawable.ic_outline_label_24px)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
chips.addAll(
|
|
|
|
|
|
|
|
transform(
|
|
|
|
|
|
|
|
orderByName.sortedCopy(filter(transform(tags, lists::getTag), Predicates.notNull())),
|
|
|
|
|
|
|
|
tag -> newChip(tag, R.drawable.ic_outline_label_24px)));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
removeIf(chips, Predicates.isNull());
|
|
|
|
removeIf(chips, Predicates.isNull());
|
|
|
|
|