Don't show emergent tags in row, fixed not in any list filter to not count emergent tags

pull/14/head
Sam Bosley 12 years ago
parent 54e9b707ac
commit a7986cd029

@ -175,7 +175,7 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE
R.string.tag_FEx_untagged_w_astrid : R.string.tag_FEx_untagged;
Filter untagged = new Filter(r.getString(untaggedLabel),
r.getString(R.string.tag_FEx_untagged),
TagService.untaggedTemplate(),
TagService.getInstance().untaggedTemplate(),
null);
untagged.listingIcon = ((BitmapDrawable)r.getDrawable(
ThemeService.getDrawable(R.drawable.gl_lists, themeFlags))).getBitmap();

@ -184,9 +184,11 @@ public final class TagService {
additionalCriterion);
}
public static QueryTemplate untaggedTemplate() {
public QueryTemplate untaggedTemplate() {
String[] emergentTags = getEmergentTags();
return new QueryTemplate().where(Criterion.and(
Criterion.not(Task.ID.in(Query.select(Metadata.TASK).from(Metadata.TABLE).where(MetadataCriteria.withKey(KEY)))),
Criterion.not(Task.ID.in(Query.select(Metadata.TASK).from(Metadata.TABLE).where(Criterion.and(MetadataCriteria.withKey(KEY), Criterion.not(TAG.in(emergentTags)))))),
TaskCriteria.isActive(),
TaskApiDao.TaskCriteria.ownedByMe(),
TaskCriteria.isVisible()));
@ -222,7 +224,7 @@ public final class TagService {
}
}
private String[] getEmergentTags() {
public String[] getEmergentTags() {
TodorooCursor<TagData> emergent = tagDataService.query(Query.select(TagData.NAME)
.where(Functions.bitwiseAnd(TagData.FLAGS, TagData.FLAG_EMERGENT).gt(0)));
try {

@ -54,6 +54,7 @@ import android.widget.TextView;
import com.timsu.astrid.R;
import com.todoroo.andlib.data.Property;
import com.todoroo.andlib.data.Property.StringProperty;
import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.ContextManager;
@ -906,8 +907,13 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
if (getActiveTagData() != null)
tagName = getActiveTagData().getValue(TagData.NAME);
Criterion tagsJoinCriterion = Criterion.and(Field.field(TAGS_METADATA_JOIN + "." + Metadata.KEY.name).eq(TagService.KEY), //$NON-NLS-1$
Task.ID.eq(Field.field(TAGS_METADATA_JOIN + "." + Metadata.TASK.name)));
String[] emergentTags = TagService.getInstance().getEmergentTags();
StringProperty tagProperty = new StringProperty(null, TAGS_METADATA_JOIN + "." + TagService.TAG.name);
Criterion tagsJoinCriterion = Criterion.and(
Field.field(TAGS_METADATA_JOIN + "." + Metadata.KEY.name).eq(TagService.KEY), //$NON-NLS-1$
Task.ID.eq(Field.field(TAGS_METADATA_JOIN + "." + Metadata.TASK.name)),
Criterion.not(tagProperty.in(emergentTags)));
if (tagName != null)
tagsJoinCriterion = Criterion.and(tagsJoinCriterion, Field.field(TAGS_METADATA_JOIN + "." + TagService.TAG.name).neq(tagName));

Loading…
Cancel
Save