diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 78cc91b..fad963f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -10,93 +10,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -118,29 +35,20 @@
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
-
+
-
-
+
+
@@ -155,28 +63,28 @@
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
@@ -184,26 +92,38 @@
-
-
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
-
+
+
@@ -213,7 +133,8 @@
JSONObject
- JSONObject
+ exportToText
+ equal
@@ -234,25 +155,47 @@
+
+
-
-
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -278,7 +221,69 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -313,7 +318,6 @@
-
@@ -412,13 +416,22 @@
1569382256368
+
+ 1569866572075
+
+
+
+ 1569866572075
+
+
+
-
+
@@ -429,8 +442,8 @@
-
-
+
+
@@ -442,6 +455,10 @@
+
+
+
+
@@ -503,10 +520,6 @@
-
-
-
-
@@ -521,13 +534,6 @@
-
-
-
-
-
-
-
@@ -535,105 +541,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -648,10 +555,88 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -662,17 +647,139 @@
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java b/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java
index 3ee84d6..9e7c689 100644
--- a/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java
+++ b/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java
@@ -54,7 +54,7 @@ public class GTaskASyncTask extends AsyncTask {
.getSystemService(Context.NOTIFICATION_SERVICE);
mTaskManager = GTaskManager.getInstance();
}
-
+ //取消同步
public void cancelSync() {
mTaskManager.cancelSync();
}
@@ -64,7 +64,7 @@ public class GTaskASyncTask extends AsyncTask {
message
});
}
-
+ //展示提示
private void showNotification(int tickerId, String content) {
Notification notification = new Notification(R.drawable.notification, mContext
.getString(tickerId), System.currentTimeMillis());
diff --git a/app/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java b/app/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java
index 8d114e6..c3698de 100644
--- a/app/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java
+++ b/app/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java
@@ -111,7 +111,7 @@ public class GTaskClient {
}
return mInstance;
}
-
+ //登录;注册
public boolean login(Activity activity) {
// we suppose that the cookie would expire after 5 minutes
// then we need to re-login
@@ -166,7 +166,7 @@ public class GTaskClient {
mLoggedin = true;
return true;
}
-
+ //登录Google账户
private String loginGoogleAccount(Activity activity, boolean invalidateToken) {
String authToken;
AccountManager accountManager = AccountManager.get(activity);
@@ -209,7 +209,7 @@ public class GTaskClient {
return authToken;
}
-
+ //尝试登录日程同步
private boolean tryToLoginGtask(Activity activity, String authToken) {
if (!loginGtask(authToken)) {
// maybe the auth token is out of date, now let's invalidate the
@@ -282,18 +282,18 @@ public class GTaskClient {
return true;
}
-
+ //获得动作
private int getActionId() {
return mActionId++;
}
-
+ //建立互联网请求
private HttpPost createHttpPost() {
HttpPost httpPost = new HttpPost(mPostUrl);
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
httpPost.setHeader("AT", "1");
return httpPost;
}
-
+ //获得回复消息
private String getResponseContent(HttpEntity entity) throws IOException {
String contentEncoding = null;
if (entity.getContentEncoding() != null) {
@@ -435,7 +435,7 @@ public class GTaskClient {
}
}
}
-
+ //添加更新节点
public void addUpdateNode(Node node) throws NetworkFailureException {
if (node != null) {
// too many update items may result in an error
@@ -449,7 +449,7 @@ public class GTaskClient {
mUpdateArray.put(node.getUpdateAction(getActionId()));
}
}
-
+ //移动任务
public void moveTask(Task task, TaskList preParent, TaskList curParent)
throws NetworkFailureException {
commitUpdate();
@@ -488,7 +488,7 @@ public class GTaskClient {
throw new ActionFailureException("move task: handing jsonobject failed");
}
}
-
+ //删除结点
public void deleteNode(Node node) throws NetworkFailureException {
commitUpdate();
try {
diff --git a/app/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java b/app/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java
index 3322a0e..91683b3 100644
--- a/app/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java
+++ b/app/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java
@@ -101,7 +101,7 @@ public class GTaskManager {
mGidToNid = new HashMap();
mNidToGid = new HashMap();
}
-
+ //获得实例
public static synchronized GTaskManager getInstance() {
if (mInstance == null) {
mInstance = new GTaskManager();
diff --git a/app/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java b/app/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java
index a188ebf..404a180 100644
--- a/app/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java
+++ b/app/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java
@@ -98,7 +98,7 @@ public class GTaskSyncService extends Service {
public IBinder onBind(Intent intent) {
return null;
}
-
+ //发送广播
public void sendBroadcast(String msg) {
mSyncProgress = msg;
Intent intent = new Intent(GTASK_SERVICE_BROADCAST_NAME);
@@ -106,24 +106,24 @@ public class GTaskSyncService extends Service {
intent.putExtra(GTASK_SERVICE_BROADCAST_PROGRESS_MSG, msg);
sendBroadcast(intent);
}
-
+ //开始同步
public static void startSync(Activity activity) {
GTaskManager.getInstance().setActivityContext(activity);
Intent intent = new Intent(activity, GTaskSyncService.class);
intent.putExtra(GTaskSyncService.ACTION_STRING_NAME, GTaskSyncService.ACTION_START_SYNC);
activity.startService(intent);
}
-
+ //取消同步
public static void cancelSync(Context context) {
Intent intent = new Intent(context, GTaskSyncService.class);
intent.putExtra(GTaskSyncService.ACTION_STRING_NAME, GTaskSyncService.ACTION_CANCEL_SYNC);
context.startService(intent);
}
-
+ //判断同步
public static boolean isSyncing() {
return mSyncTask != null;
}
-
+ //获取进程字符串
public static String getProgressString() {
return mSyncProgress;
}