Added the is_folder flag to tagdata, don't show those in main tag list

pull/14/head
Sam Bosley 13 years ago
parent 886ed18319
commit 781658a514

@ -109,6 +109,10 @@ public final class TagData extends RemoteModel {
public static final IntegerProperty IS_UNREAD = new IntegerProperty( public static final IntegerProperty IS_UNREAD = new IntegerProperty(
TABLE, "isUnread"); TABLE, "isUnread");
/** Whether tag is a folder */
public static final IntegerProperty IS_FOLDER = new IntegerProperty(
TABLE, "isFolder", Property.PROP_FLAG_BOOLEAN);
/** Task count */ /** Task count */
public static final IntegerProperty TASK_COUNT = new IntegerProperty( public static final IntegerProperty TASK_COUNT = new IntegerProperty(
TABLE, "taskCount"); TABLE, "taskCount");
@ -196,6 +200,7 @@ public final class TagData extends RemoteModel {
defaultValues.put(METADATA_PUSHED_AT.name, 0L); defaultValues.put(METADATA_PUSHED_AT.name, 0L);
defaultValues.put(USER_ACTIVITIES_PUSHED_AT.name, 0L); defaultValues.put(USER_ACTIVITIES_PUSHED_AT.name, 0L);
defaultValues.put(TAG_ORDERING.name, "[]"); defaultValues.put(TAG_ORDERING.name, "[]");
defaultValues.put(IS_FOLDER.name, 0);
} }
@Override @Override

@ -183,6 +183,7 @@ public class NameMaps {
putTagPropertyToServerName(TagData.TASK_COUNT, "task_count", false); putTagPropertyToServerName(TagData.TASK_COUNT, "task_count", false);
putTagPropertyToServerName(TagData.TAG_DESCRIPTION, "description", true); putTagPropertyToServerName(TagData.TAG_DESCRIPTION, "description", true);
putTagPropertyToServerName(TagData.PICTURE, "picture", true); putTagPropertyToServerName(TagData.PICTURE, "picture", true);
putTagPropertyToServerName(TagData.IS_FOLDER, "is_folder", false);
// Reverse the mapping to construct the server to local map // Reverse the mapping to construct the server to local map
TAG_DATA_PROPERTIES_SERVER_TO_LOCAL = AndroidUtilities.reverseMap(TAG_DATA_PROPERTIES_LOCAL_TO_SERVER); TAG_DATA_PROPERTIES_SERVER_TO_LOCAL = AndroidUtilities.reverseMap(TAG_DATA_PROPERTIES_LOCAL_TO_SERVER);

@ -397,15 +397,15 @@ public final class TagService {
*/ */
public ArrayList<Tag> getTagList() { public ArrayList<Tag> getTagList() {
ArrayList<Tag> tagList = new ArrayList<Tag>(); ArrayList<Tag> tagList = new ArrayList<Tag>();
TodorooCursor<TagData> cursor = tagDataService.query(Query.select(TagData.PROPERTIES).where(Criterion.and(TagData.DELETION_DATE.eq(0), TagData.NAME.isNotNull())).orderBy(Order.asc(Functions.upper(TagData.NAME)))); TodorooCursor<TagData> cursor = tagDataService.query(Query.select(TagData.PROPERTIES).where(Criterion.and(TagData.DELETION_DATE.eq(0), TagData.IS_FOLDER.neq(1), TagData.NAME.isNotNull())).orderBy(Order.asc(Functions.upper(TagData.NAME))));
try { try {
TagData tagData = new TagData(); TagData tagData = new TagData();
for(cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { for(cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
tagData.readFromCursor(cursor); tagData.readFromCursor(cursor);
Tag tag = new Tag(tagData);
if(tagData.getFlag(TagData.FLAGS, TagData.FLAG_FEATURED)) { if(tagData.getFlag(TagData.FLAGS, TagData.FLAG_FEATURED)) {
continue; continue;
} }
Tag tag = new Tag(tagData);
if(TextUtils.isEmpty(tag.tag)) if(TextUtils.isEmpty(tag.tag))
continue; continue;
tagList.add(tag); tagList.add(tag);

@ -53,7 +53,7 @@ public class Database extends AbstractDatabase {
* Database version number. This variable must be updated when database * Database version number. This variable must be updated when database
* tables are updated, as it determines whether a database needs updating. * tables are updated, as it determines whether a database needs updating.
*/ */
public static final int VERSION = 34; public static final int VERSION = 35;
/** /**
* Database name (must be unique) * Database name (must be unique)
@ -399,6 +399,9 @@ public class Database extends AbstractDatabase {
tryExecSQL(addColumnSql(TagData.TABLE, TagData.LAST_AUTOSYNC, visitor, null)); tryExecSQL(addColumnSql(TagData.TABLE, TagData.LAST_AUTOSYNC, visitor, null));
tryExecSQL(addColumnSql(User.TABLE, User.LAST_AUTOSYNC, visitor, null)); tryExecSQL(addColumnSql(User.TABLE, User.LAST_AUTOSYNC, visitor, null));
case 34:
tryExecSQL(addColumnSql(TagData.TABLE, TagData.IS_FOLDER, visitor, null));
return true; return true;
} }

Loading…
Cancel
Save