From 5d963bc44149b8bf4ad6e3daca41449437f4c2b5 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Fri, 22 Feb 2013 18:34:24 -0800 Subject: [PATCH] New history types --- api/src/com/todoroo/astrid/data/History.java | 4 ++++ astrid/res/values/strings-updates.xml | 3 +++ astrid/src/com/todoroo/astrid/adapter/UpdateAdapter.java | 9 +++++++++ 3 files changed, 16 insertions(+) diff --git a/api/src/com/todoroo/astrid/data/History.java b/api/src/com/todoroo/astrid/data/History.java index 766a992bb..1431dbc38 100644 --- a/api/src/com/todoroo/astrid/data/History.java +++ b/api/src/com/todoroo/astrid/data/History.java @@ -131,5 +131,9 @@ public class History extends AbstractModel { public static final String COL_IS_SILENT = "is_silent"; public static final String COL_IS_FAVORITE = "is_favorite"; public static final String COL_USER_ID = "user_id"; + public static final String COL_ATTACHMENT_ADDED = "attachment_added"; + public static final String COL_ATTACHMENT_REMOVED = "attachment_removed"; + public static final String COL_ACKNOWLEDGED = "acknowledged"; + } diff --git a/astrid/res/values/strings-updates.xml b/astrid/res/values/strings-updates.xml index 64bc66580..e664bd34f 100644 --- a/astrid/res/values/strings-updates.xml +++ b/astrid/res/values/strings-updates.xml @@ -25,6 +25,8 @@ this task added %1$s to %2$s removed %1$s from %2$s + attached %1$s to %2$s + removed %1$s from %2$s left %s deleted %s undeleted %s @@ -68,6 +70,7 @@ every %s on %s after completion + viewed %s changed %1$s to %2$s diff --git a/astrid/src/com/todoroo/astrid/adapter/UpdateAdapter.java b/astrid/src/com/todoroo/astrid/adapter/UpdateAdapter.java index 45bb87235..9a446b037 100644 --- a/astrid/src/com/todoroo/astrid/adapter/UpdateAdapter.java +++ b/astrid/src/com/todoroo/astrid/adapter/UpdateAdapter.java @@ -467,6 +467,15 @@ public class UpdateAdapter extends CursorAdapter { else result = context.getString(R.string.history_tag_removed, item, tagName); + } else if (History.COL_ATTACHMENT_ADDED.equals(column) || History.COL_ATTACHMENT_REMOVED.equals(column)) { + JSONArray attachmentArray = new JSONArray(newValue); + String attachmentName = attachmentArray.getString(1); + if (History.COL_ATTACHMENT_ADDED.equals(column)) + result = context.getString(R.string.history_attach_added, item, attachmentName); + else + result = context.getString(R.string.history_attach_removed, item, attachmentName); + } else if (History.COL_ACKNOWLEDGED.equals(column)) { + result = context.getString(R.string.history_acknowledged, item); } else if (History.COL_SHARED_WITH.equals(column) || History.COL_UNSHARED_WITH.equals(column)) { JSONArray members = new JSONArray(newValue); String userId = history.getValue(History.USER_UUID);