diff --git a/api/src/com/todoroo/astrid/data/TagData.java b/api/src/com/todoroo/astrid/data/TagData.java index 481df99f3..9ce7b5de6 100644 --- a/api/src/com/todoroo/astrid/data/TagData.java +++ b/api/src/com/todoroo/astrid/data/TagData.java @@ -110,6 +110,10 @@ public final class TagData extends RemoteModel { public static final IntegerProperty TASK_COUNT = new IntegerProperty( TABLE, "taskCount"); + /** Tag Desription */ + public static final StringProperty TAG_DESCRIPTION = new StringProperty( + TABLE, "tagDescription"); + /** List of all properties for this model */ public static final Property[] PROPERTIES = generateProperties(TagData.class); @@ -146,6 +150,7 @@ public final class TagData extends RemoteModel { defaultValues.put(LAST_ACTIVITY_DATE.name, 0); defaultValues.put(IS_UNREAD.name, 0); defaultValues.put(TASK_COUNT.name, 0); + defaultValues.put(TAG_DESCRIPTION.name, ""); } @Override diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java b/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java index 63d268c81..b03ab6819 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java @@ -61,6 +61,7 @@ public class TagSettingsActivity extends Activity { private PeopleContainer tagMembers; private AsyncImageView picture; private EditText tagName; + private EditText tagDescription; private CheckBox isSilent; boolean isNewTag = false; @@ -111,6 +112,7 @@ public class TagSettingsActivity extends Activity { protected void setUpSettingsPage() { tagMembers = (PeopleContainer) findViewById(R.id.members_container); tagName = (EditText) findViewById(R.id.tag_name); + tagDescription = (EditText) findViewById(R.id.tag_description); picture = (AsyncImageView) findViewById(R.id.picture); isSilent = (CheckBox) findViewById(R.id.tag_silenced); isSilent.setChecked(tagData.getFlag(TagData.FLAGS, TagData.FLAG_SILENT)); @@ -172,6 +174,10 @@ public class TagSettingsActivity extends Activity { } } } + //handles description part + String newDesc = tagDescription.getText().toString(); + + tagData.setValue(TagData.TAG_DESCRIPTION, newDesc); JSONArray members = tagMembers.toJSONArray(); @@ -213,6 +219,8 @@ public class TagSettingsActivity extends Activity { return; } + + refreshSettingsPage(); finish(); } @@ -263,6 +271,9 @@ public class TagSettingsActivity extends Activity { String peopleJson = tagData.getValue(TagData.MEMBERS); updateMembers(peopleJson); + + tagDescription.setText(tagData.getValue(TagData.TAG_DESCRIPTION)); + } @SuppressWarnings("nls") diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java index a048cf77a..7e7b9e1e6 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java @@ -471,6 +471,10 @@ public final class ActFmSyncService { params.add("deleted_at"); params.add(tagData.getValue(TagData.DELETION_DATE)); } + if(values.containsKey(TagData.TAG_DESCRIPTION.name)) { + params.add("description"); params.add(tagData.getValue(TagData.TAG_DESCRIPTION)); + } + if(values.containsKey(TagData.MEMBERS.name)) { params.add("members"); try { @@ -996,6 +1000,9 @@ public final class ActFmSyncService { if(json.has("emergent")) model.setFlag(TagData.FLAGS, TagData.FLAG_EMERGENT,json.getBoolean("emergent")); + if(json.has("description")) + model.setValue(TagData.TAG_DESCRIPTION,json.getString("description")); + if(json.has("members")) { JSONArray members = json.getJSONArray("members"); model.setValue(TagData.MEMBERS, members.toString()); diff --git a/astrid/res/layout/tag_settings_activity.xml b/astrid/res/layout/tag_settings_activity.xml index 5ffd5260b..b7f18a3b5 100644 --- a/astrid/res/layout/tag_settings_activity.xml +++ b/astrid/res/layout/tag_settings_activity.xml @@ -92,8 +92,47 @@ android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" /> - - + + + + + + + + + + + - Silence Notifications + + + List Icon: + + + Description: diff --git a/astrid/src/com/todoroo/astrid/dao/Database.java b/astrid/src/com/todoroo/astrid/dao/Database.java index 3360f817d..921c2f415 100644 --- a/astrid/src/com/todoroo/astrid/dao/Database.java +++ b/astrid/src/com/todoroo/astrid/dao/Database.java @@ -37,7 +37,7 @@ public class Database extends AbstractDatabase { * Database version number. This variable must be updated when database * tables are updated, as it determines whether a database needs updating. */ - public static final int VERSION = 17; + public static final int VERSION = 18; /** * Database name (must be unique) @@ -226,6 +226,12 @@ public class Database extends AbstractDatabase { } catch (SQLiteException e) { Log.e("astrid", "db-upgrade-" + oldVersion + "-" + newVersion, e); } + case 17: try { + database.execSQL("ALTER TABLE " + TagData.TABLE.name + " ADD " + + TagData.TAG_DESCRIPTION.accept(visitor, null)); + } catch (SQLiteException e) { + Log.e("astrid", "db-upgrade-" + oldVersion + "-" + newVersion, e); + } return true; }