qijingxi
pbhqa7wr4 7 months ago
parent 1cc22d810c
commit 2a75f562e9

@ -31,6 +31,9 @@ import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
/**
* TaskNode
*/
public class Task extends Node { public class Task extends Node {
private static final String TAG = Task.class.getSimpleName(); private static final String TAG = Task.class.getSimpleName();
@ -44,7 +47,9 @@ public class Task extends Node {
private Task mPriorSibling; private Task mPriorSibling;
private TaskList mParent; private TaskList mParent;
/**
* Task
*/
public Task() { public Task() {
super(); super();
mCompleted = false; mCompleted = false;
@ -53,7 +58,9 @@ public class Task extends Node {
mParent = null; mParent = null;
mMetaInfo = null; mMetaInfo = null;
} }
/**
* JSON
*/
public JSONObject getCreateAction(int actionId) { public JSONObject getCreateAction(int actionId) {
JSONObject js = new JSONObject(); JSONObject js = new JSONObject();
@ -102,7 +109,9 @@ public class Task extends Node {
return js; return js;
} }
/**
* JSON
*/
public JSONObject getUpdateAction(int actionId) { public JSONObject getUpdateAction(int actionId) {
JSONObject js = new JSONObject(); JSONObject js = new JSONObject();
@ -134,7 +143,9 @@ public class Task extends Node {
return js; return js;
} }
/**
* JSON
*/
public void setContentByRemoteJSON(JSONObject js) { public void setContentByRemoteJSON(JSONObject js) {
if (js != null) { if (js != null) {
try { try {
@ -175,6 +186,9 @@ public class Task extends Node {
} }
} }
/**
* JSON
*/
public void setContentByLocalJSON(JSONObject js) { public void setContentByLocalJSON(JSONObject js) {
if (js == null || !js.has(GTaskStringUtils.META_HEAD_NOTE) if (js == null || !js.has(GTaskStringUtils.META_HEAD_NOTE)
|| !js.has(GTaskStringUtils.META_HEAD_DATA)) { || !js.has(GTaskStringUtils.META_HEAD_DATA)) {
@ -203,7 +217,9 @@ public class Task extends Node {
e.printStackTrace(); e.printStackTrace();
} }
} }
/**
* JSON
*/
public JSONObject getLocalJSONFromContent() { public JSONObject getLocalJSONFromContent() {
String name = getName(); String name = getName();
try { try {
@ -246,7 +262,9 @@ public class Task extends Node {
return null; return null;
} }
} }
/**
*
*/
public void setMetaInfo(MetaData metaData) { public void setMetaInfo(MetaData metaData) {
if (metaData != null && metaData.getNotes() != null) { if (metaData != null && metaData.getNotes() != null) {
try { try {
@ -257,7 +275,9 @@ public class Task extends Node {
} }
} }
} }
/**
*
*/
public int getSyncAction(Cursor c) { public int getSyncAction(Cursor c) {
try { try {
JSONObject noteInfo = null; JSONObject noteInfo = null;
@ -311,6 +331,9 @@ public class Task extends Node {
return SYNC_ACTION_ERROR; return SYNC_ACTION_ERROR;
} }
/**
*
*/
public boolean isWorthSaving() { public boolean isWorthSaving() {
return mMetaInfo != null || (getName() != null && getName().trim().length() > 0) return mMetaInfo != null || (getName() != null && getName().trim().length() > 0)
|| (getNotes() != null && getNotes().trim().length() > 0); || (getNotes() != null && getNotes().trim().length() > 0);

Loading…
Cancel
Save