Compare commits

..

16 Commits

@ -1 +0,0 @@
-“đŤ<C491>ó0" not providedBAYczA7mil3hmLEGh5dOa

@ -1 +0,0 @@
:AYctaK4aibojJVNiyQeUAYctaK4aibojJVNiyQeU"main*BRANCH

File diff suppressed because one or more lines are too long

@ -1,2 +0,0 @@
L
not providedAYczA7mil3hmLEGh5dOa"Version8“ð<E2809C>˜ó0BAYczA8Qfl3hmLEGh5eMa

File diff suppressed because it is too large Load Diff

@ -1,2 +0,0 @@
gruopAYctaK4aibojJVNiyQeU 9.9.0.65466 ˛·ž<C2B7>ó0

@ -1,8 +0,0 @@
linesLinesncloc Lines of Code;ncloc_language_distributionLines of Code Per LanguageclassesClasses2filesFiles functions Functions
statements
Statements  comment_lines Comment Lines'comment_lines_density Comments (%)%+
complexityCyclomatic Complexity&(file_complexityComplexity / File.cognitive_complexityCognitive ComplexitycoverageCoverage"lines_to_coverLines to Cover$uncovered_linesUncovered Lines line_coverage Line Coverage&'duplicated_linesDuplicated Lines(duplicated_blocksDuplicated Blocks&duplicated_filesDuplicated Files2!duplicated_lines_densityDuplicated Lines (%)*8duplications_dataDuplication Details
violationsIssues&%blocker_violationsBlocker Issues( critical_violationsCritical Issues"major_violations Major Issues" minor_violations Minor Issues info_violations Info Issues0 false_positive_issuesFalse Positive Issues%"wont_fix_issuesWon't Fix Issues. open_issues Open Issues$1reopened_issuesReopened Issues&&confirmed_issuesConfirmed Issues code_smells Code SmellsbugsBugs$ vulnerabilitiesVulnerabilities(security_hotspotsSecurity Hotspots  sqale_indexTechnical Debt( sqale_ratingMaintainability Rating&development_costDevelopment Cost**sqale_debt_ratioTechnical Debt RatioV(effort_to_reach_maintainability_rating_a(Effort to Reach Maintainability Rating ABreliability_remediation_effortReliability Remediation Effort*reliability_ratingReliability Rating</security_remediation_effortSecurity Remediation Effort$,security_ratingSecurity Rating2$security_review_ratingSecurity Review RatingB5new_security_review_rating"Security Review Rating on New Code:#security_hotspots_reviewedSecurity Hotspots ReviewedF3!security_hotspots_reviewed_statusSecurity Review Reviewed StatusH4"security_hotspots_to_review_status Security Review To Review Status6
ncloc_data
ncloc_data07executable_lines_dataexecutable_lines_data%) alert_statusQuality Gate Status.0quality_gate_detailsQuality Gate Details-quality_profilesProfiles)last_commit_dateDate of Last Commit<
analysis_from_sonarqube_9_4Analysis From SonarQube 9.4

@ -1,24 +0,0 @@
7
vbnet VB.NET Code Quality and Security 8.51.0.590601
textText Code Quality and Security 2.0.1.611O
javascript3JavaScript/TypeScript/CSS Code Quality and Security 9.13.0.20537/
goGo Code Quality and Security 1.11.0.39057
kotlin Kotlin Code Quality and Security 2.12.0.1956
jacocoJaCoCo
1.3.0.1538:
sonarscalaScala Code Quality and Security 1.11.0.39051
webHTML Code Quality and Security
3.7.1.3306J
config5Configuration detection fot Code Quality and Security 1.2.0.2678
python Python Code Quality and Security 3.24.0.107844
csharpC# Code Quality and Security 8.51.0.590600
xmlXML Code Quality and Security
2.7.0.38201
phpPHP Code Quality and Security 3.27.1.93523
rubyRuby Code Quality and Security 1.11.0.39051
iacIaC Code Quality and Security 1.11.0.28474
javaJava Code Quality and Security 7.16.0.309012
flexFlex Code Quality and Security
2.8.0.3166

@ -1 +0,0 @@
#S2140java"AYasa1ymRX81SdRisMBi"S108java"AYasa1twRX81SdRisLv3#S1168java"AYasa1yhRX81SdRisL91#S1172java"AYasa1ymRX81SdRisMBf#S1192java"AYasa1toRX81SdRisLtk#S1301java"AYasa1xgRX81SdRisL76#S3626java"AYasa1wGRX81SdRisL2S#S1481java"AYasa1zeRX81SdRisMCq#S2245java"AYasa1yhRX81SdRisL-9"S5604xml"AYasa19jRX81SdRisMqr#S1126java"AYasa1zlRX81SdRisMEQ#S1104java"AYasa1wQRX81SdRisL43#S2696java"AYasa1zkRX81SdRisMDs#S1124java"AYasa1zkRX81SdRisMDm#S2259java"AYasa1yhRX81SdRisL-B#S1854java"AYasa1u2RX81SdRisLzz"S5322xml"AYasa19kRX81SdRisMrG"S116java"AYasa1toRX81SdRisLvB"S899java"AYasa1sRRX81SdRisLo-#S1604java"AYasa1u2RX81SdRisLyc#S1214java"AYasa1xbRX81SdRisL6X#S3008java"AYasa1ymRX81SdRisL_2#S2130java"AYasa1xkRX81SdRisL8t"S100java"AYasa1sgRX81SdRisLsZ"S5594xml"AYasa19lRX81SdRisMrh#S3923java"AYasa1u2RX81SdRisLzY#S3398java"AYasa1u2RX81SdRisLxm#S2864java"AYasa1xjRX81SdRisL8V#S1153java"AYasa1yhRX81SdRisL-f#S5411java"AYasa1ymRX81SdRisMB0#S1135java"AYasa10oRX81SdRisMJF#S1155java"AYasa1yhRX81SdRisL-r#S5993java"AYasa1yhRX81SdRisL-l#S2093java"AYasa1sRRX81SdRisLo7"S6358xml"AYasa19jRX81SdRisMq0#S1125java"AYasa1zkRX81SdRisMD1#S3516java"AYasa1wTRX81SdRisL5S"S101java"AYasa1sgRX81SdRisLsu#S2095java"AYasa1sWRX81SdRisLpQ#S1905java"AYasa1vARX81SdRisL1B"S5332xml"AYasa19mRX81SdRisMsd#S2184java"AYasa1twRX81SdRisLwt#S1450java"AYasa1wTRX81SdRisL5h#S1066java"AYasa1ymRX81SdRisMAp#S2147java"AYasa1zeRX81SdRisMCM#S4507java"AYasa1znRX81SdRisMEo#S1319java"AYasa1wGRX81SdRisL3R"S4507xml"AYasa19lRX81SdRisMr2#S1116java"AYasa1zmRX81SdRisMEW#S1118java"AYasa1zoRX81SdRisMFA#S4144java"AYasa1sbRX81SdRisLq_#S2386java"AYasa1zeRX81SdRisMCJ#S2293java"AYasa1seRX81SdRisLr7"S125java"AYasa1u2RX81SdRisLy9#S3776java"AYasa10fRX81SdRisMGR#S1659java"AYasa1xiRX81SdRisL8D#S2589java"AYasa10oRX81SdRisMJR

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@ -0,0 +1,88 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.micode.notes.gtask.data;
import android.database.Cursor;
import android.util.Log;
import net.micode.notes.tool.GTaskStringUtils;
import org.json.JSONException;
import org.json.JSONObject;
//创建继承自Task的类
public class MetaData extends Task {
private final static String TAG = MetaData.class.getSimpleName();//调用getSimpleName()函数
private String mRelatedGid = null;//初始化mRelatedGid为null
//函数设置meta,用put方法将gid传给GTaskStringUtils.META_HEAD_GTASK_ID用catch来在出现错误时报错
public void setMeta(String gid, JSONObject metaInfo) {
try {
metaInfo.put(GTaskStringUtils.META_HEAD_GTASK_ID, gid);
} catch (JSONException e) {
Log.e(TAG, "failed to put related gid");//catch异常处理
}
setNotes(metaInfo.toString());
setName(GTaskStringUtils.META_NOTE_NAME);
}
//获取相关的gid
public String getRelatedGid() {
return mRelatedGid;
}
//函数判断getNotes是否为空并返回
@Override
public boolean isWorthSaving() {
return getNotes() != null;
}
//调用父类Task中的setContentByRemoteJSON ()函数使用远程json数据对象设置元数据内容
@Override
public void setContentByRemoteJSON(JSONObject js) {
super.setContentByRemoteJSON(js);
if (getNotes() != null) {
try {
JSONObject metaInfo = new JSONObject(getNotes().trim());
mRelatedGid = metaInfo.getString(GTaskStringUtils.META_HEAD_GTASK_ID);
} catch (JSONException e) {
Log.w(TAG, "failed to get related gid");
mRelatedGid = null;
}
}
}
//函数:函数覆盖,将错误抛出
@Override
public void setContentByLocalJSON(JSONObject js) {
// this function should not be called
throw new IllegalAccessError("MetaData:setContentByLocalJSON should not be called");
}
//函数从元数据库中获得本地JSON对象并抛出错误
@Override
public JSONObject getLocalJSONFromContent() {
throw new IllegalAccessError("MetaData:getLocalJSONFromContent should not be called");
}
//函数:获取同步动作状态,并抛出错误
@Override
public int getSyncAction(Cursor c) {
throw new IllegalAccessError("MetaData:getSyncAction should not be called");
}
}

@ -0,0 +1,104 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.micode.notes.gtask.data; //包名,依赖关系
import android.database.Cursor; //引用cursor此公用接口提供对数据库查询返回的结果集的随机读写访问。
import org.json.JSONObject;//引用 JSONObject一组可修改的名称/值映射集。
public abstract class Node {
public static final int SYNC_ACTION_NONE = 0;
public static final int SYNC_ACTION_ADD_REMOTE = 1;//需要在远程云端增加内容
public static final int SYNC_ACTION_ADD_LOCAL = 2;//需要在本地增加内容
public static final int SYNC_ACTION_DEL_REMOTE = 3; //需要在远程云端删除内容
public static final int SYNC_ACTION_DEL_LOCAL = 4;//需要在本地删除内容
public static final int SYNC_ACTION_UPDATE_REMOTE = 5;//需要将本地内容更新到远程云端
public static final int SYNC_ACTION_UPDATE_LOCAL = 6;//需要将远程云端内容更新到本地
public static final int SYNC_ACTION_UPDATE_CONFLICT = 7; //同步出现冲突
public static final int SYNC_ACTION_ERROR = 8;//同步出现错误
private String mGid; //记录最后一次修改时间
private String mName;//bool类型表明表征是否被删除
private long mLastModified;//记录最后一次修改时间
private boolean mDeleted;//判断 表征是否被删除
//构造函数进行初始化界面没有名字为空最后一次修改时间为0没有修改表征是否删除。
public Node() {
mGid = null;
mName = "";
mLastModified = 0;
mDeleted = false;
}
// 创建JSONObject对象创建操作和更新操作形参是操作号
public abstract JSONObject getCreateAction(int actionId);
public abstract JSONObject getUpdateAction(int actionId);//获取需要更新活动的ID
public abstract void setContentByRemoteJSON(JSONObject js);//都是JSONObject和Curson中的一些操作主要是创建相应的对象进行远端和本地同步操作
public abstract void setContentByLocalJSON(JSONObject js);//声明JSONObject对象抽象类从本地JSON中同步设置目录
public abstract JSONObject getLocalJSONFromContent();//声明JSONObject对象抽象类从目录中获取本地JSON
public abstract int getSyncAction(Cursor c);//声明int抽象类获取同步行为代号
public void setGid(String gid) {
this.mGid = gid;
} //对构造函数中的对象进行赋值或者获取对象的具体内容将gid赋给mGid以下均为Node函数参数的输入与赋值
public void setName(String name) {
this.mName = name;
} //设置名字
public void setLastModified(long lastModified) {
this.mLastModified = lastModified;
}//时间标识
public void setDeleted(boolean deleted) {
this.mDeleted = deleted;
}//删除标识
public String getGid() {
return this.mGid;
}//返回git
public String getName() {
return this.mName;
}//返回mname
public long getLastModified() {
return this.mLastModified;
}//获取时间标识
public boolean getDeleted() {
return this.mDeleted;
}//获取删除标识
}

@ -0,0 +1,198 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.micode.notes.gtask.data;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.util.Log;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.DataColumns;
import net.micode.notes.data.Notes.DataConstants;
import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.data.NotesDatabaseHelper.TABLE;
import net.micode.notes.gtask.exception.ActionFailureException;
import org.json.JSONException;
import org.json.JSONObject;
public class SqlData {
//得到类的简写名称存入字符串TAG中
private static final String TAG = SqlData.class.getSimpleName();//调用getSimpleName ()函数
private static final int INVALID_ID = -99999;//为mDataId置初始值-99999
//来自Notes类中定义的DataColumn中的一些常量
// 集合了interface DataColumns中所有SF常量
public static final String[] PROJECTION_DATA = new String[] {
DataColumns.ID, DataColumns.MIME_TYPE, DataColumns.CONTENT, DataColumns.DATA1,
DataColumns.DATA3
};
//以下五个变量作为sql表中5列的编号
public static final int DATA_ID_COLUMN = 0;
public static final int DATA_MIME_TYPE_COLUMN = 1;
public static final int DATA_CONTENT_COLUMN = 2;
public static final int DATA_CONTENT_DATA_1_COLUMN = 3;
public static final int DATA_CONTENT_DATA_3_COLUMN = 4;
private ContentResolver mContentResolver;
//判断是否直接用Content生成是为true否则为false
private boolean mIsCreate;
private long mDataId;
private String mDataMimeType;
private String mDataContent;
private long mDataContentData1;
private String mDataContentData3;
private ContentValues mDiffDataValues;
public SqlData(Context context) {
mContentResolver = context.getContentResolver();//mContentResolver用于获取ContentProvider提供的数据
mIsCreate = true;
mDataId = INVALID_ID;
mDataMimeType = DataConstants.NOTE;
mDataContent = "";
mDataContentData1 = 0;
mDataContentData3 = "";
mDiffDataValues = new ContentValues();
}
/*
*
* mContentResolverContentProvider
* mIsCreate
*/
public SqlData(Context context, Cursor c) {
mContentResolver = context.getContentResolver();
mIsCreate = false;
loadFromCursor(c);
mDiffDataValues = new ContentValues();
}
//从光标处加载数据
private void loadFromCursor(Cursor c) {
mDataId = c.getLong(DATA_ID_COLUMN);
mDataMimeType = c.getString(DATA_MIME_TYPE_COLUMN);
mDataContent = c.getString(DATA_CONTENT_COLUMN);
mDataContentData1 = c.getLong(DATA_CONTENT_DATA_1_COLUMN);
mDataContentData3 = c.getString(DATA_CONTENT_DATA_3_COLUMN);
}
//功能描述:设置用于共享的数据,并提供异常抛出与处理机制
public void setContent(JSONObject js) throws JSONException {
//JSONObject对象中有DataColumns.ID这一项则设置否则设为INVALID_ID
long dataId = js.has(DataColumns.ID) ? js.getLong(DataColumns.ID) : INVALID_ID;
if (mIsCreate || mDataId != dataId) {
mDiffDataValues.put(DataColumns.ID, dataId);
}
mDataId = dataId;
String dataMimeType = js.has(DataColumns.MIME_TYPE) ? js.getString(DataColumns.MIME_TYPE)
: DataConstants.NOTE;
if (mIsCreate || !mDataMimeType.equals(dataMimeType)) {
mDiffDataValues.put(DataColumns.MIME_TYPE, dataMimeType);
}
mDataMimeType = dataMimeType;
String dataContent = js.has(DataColumns.CONTENT) ? js.getString(DataColumns.CONTENT) : "";
if (mIsCreate || !mDataContent.equals(dataContent)) {
mDiffDataValues.put(DataColumns.CONTENT, dataContent);
}
mDataContent = dataContent;
long dataContentData1 = js.has(DataColumns.DATA1) ? js.getLong(DataColumns.DATA1) : 0;
if (mIsCreate || mDataContentData1 != dataContentData1) {
mDiffDataValues.put(DataColumns.DATA1, dataContentData1);
}
mDataContentData1 = dataContentData1;
String dataContentData3 = js.has(DataColumns.DATA3) ? js.getString(DataColumns.DATA3) : "";
if (mIsCreate || !mDataContentData3.equals(dataContentData3)) {
mDiffDataValues.put(DataColumns.DATA3, dataContentData3);
}
mDataContentData3 = dataContentData3;
}
//功能描述:获取共享的数据内容,并提供异常抛出与处理机制
public JSONObject getContent() throws JSONException {
if (mIsCreate) {
Log.e(TAG, "it seems that we haven't created this in database yet");
return null;
}
//创建JSONObject对象。并将相关数据放入其中并返回
JSONObject js = new JSONObject();
js.put(DataColumns.ID, mDataId);
js.put(DataColumns.MIME_TYPE, mDataMimeType);
js.put(DataColumns.CONTENT, mDataContent);
js.put(DataColumns.DATA1, mDataContentData1);
js.put(DataColumns.DATA3, mDataContentData3);
return js;
}
//commit函数用于把当前造作所做的修改保存到数据库
public void commit(long noteId, boolean validateVersion, long version) {
if (mIsCreate) {
if (mDataId == INVALID_ID && mDiffDataValues.containsKey(DataColumns.ID)) {
mDiffDataValues.remove(DataColumns.ID);
}
mDiffDataValues.put(DataColumns.NOTE_ID, noteId);
Uri uri = mContentResolver.insert(Notes.CONTENT_DATA_URI, mDiffDataValues);
try {
mDataId = Long.valueOf(uri.getPathSegments().get(1));
} catch (NumberFormatException e) {
Log.e(TAG, "Get note id error :" + e.toString());
throw new ActionFailureException("create note failed");
}
} else {
if (mDiffDataValues.size() > 0) {
int result = 0;
if (!validateVersion) {
result = mContentResolver.update(ContentUris.withAppendedId(
Notes.CONTENT_DATA_URI, mDataId), mDiffDataValues, null, null);
} else {
result = mContentResolver.update(ContentUris.withAppendedId(
Notes.CONTENT_DATA_URI, mDataId), mDiffDataValues,
" ? in (SELECT " + NoteColumns.ID + " FROM " + TABLE.NOTE
+ " WHERE " + NoteColumns.VERSION + "=?)", new String[] {
String.valueOf(noteId), String.valueOf(version)
});
}
if (result == 0) {
Log.w(TAG, "there is no update. maybe user updates note when syncing");
}
}
}
mDiffDataValues.clear();
mIsCreate = false;
}
//获取当前id
public long getId() {
return mDataId;
}
}

@ -0,0 +1,527 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.micode.notes.gtask.data;
import android.appwidget.AppWidgetManager;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.util.Log;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.DataColumns;
import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.gtask.exception.ActionFailureException;
import net.micode.notes.tool.GTaskStringUtils;
import net.micode.notes.tool.ResourceParser;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
public class SqlNote {
//调用getSimpleName(),类名简称存入TAG
private static final String TAG = SqlNote.class.getSimpleName();
private static final int INVALID_ID = -99999;
public static final String[] PROJECTION_NOTE = new String[] {
NoteColumns.ID, NoteColumns.ALERTED_DATE, NoteColumns.BG_COLOR_ID,
NoteColumns.CREATED_DATE, NoteColumns.HAS_ATTACHMENT, NoteColumns.MODIFIED_DATE,
NoteColumns.NOTES_COUNT, NoteColumns.PARENT_ID, NoteColumns.SNIPPET, NoteColumns.TYPE,
NoteColumns.WIDGET_ID, NoteColumns.WIDGET_TYPE, NoteColumns.SYNC_ID,
NoteColumns.LOCAL_MODIFIED, NoteColumns.ORIGIN_PARENT_ID, NoteColumns.GTASK_ID,
NoteColumns.VERSION
};
public static final int ID_COLUMN = 0;
public static final int ALERTED_DATE_COLUMN = 1;
public static final int BG_COLOR_ID_COLUMN = 2;
public static final int CREATED_DATE_COLUMN = 3;
public static final int HAS_ATTACHMENT_COLUMN = 4;
public static final int MODIFIED_DATE_COLUMN = 5;
public static final int NOTES_COUNT_COLUMN = 6;
public static final int PARENT_ID_COLUMN = 7;
public static final int SNIPPET_COLUMN = 8;
public static final int TYPE_COLUMN = 9;
public static final int WIDGET_ID_COLUMN = 10;
public static final int WIDGET_TYPE_COLUMN = 11;
public static final int SYNC_ID_COLUMN = 12;
public static final int LOCAL_MODIFIED_COLUMN = 13;
public static final int ORIGIN_PARENT_ID_COLUMN = 14;
public static final int GTASK_ID_COLUMN = 15;
public static final int VERSION_COLUMN = 16;
private Context mContext;
private ContentResolver mContentResolver;
private boolean mIsCreate;
private long mId;
private long mAlertDate;
private int mBgColorId;
private long mCreatedDate;
private int mHasAttachment;
private long mModifiedDate;
private long mParentId;
private String mSnippet;
private int mType;
private int mWidgetId;
private int mWidgetType;
private long mOriginParent;
private long mVersion;
private ContentValues mDiffNoteValues;
private ArrayList<SqlData> mDataList;
//构造函数只有context对所有的变量进行初始化
public SqlNote(Context context) {
mContext = context;
mContentResolver = context.getContentResolver();
mIsCreate = true;
mId = INVALID_ID;
mAlertDate = 0;
mBgColorId = ResourceParser.getDefaultBgId(context);
mCreatedDate = System.currentTimeMillis();//调用系统函数获得创建时间
mHasAttachment = 0;
mModifiedDate = System.currentTimeMillis();//最后一次修改时间初始化为创建时间
mParentId = 0;
mSnippet = "";
mType = Notes.TYPE_NOTE;
mWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
mWidgetType = Notes.TYPE_WIDGET_INVALIDE;
mOriginParent = 0;
mVersion = 0;
mDiffNoteValues = new ContentValues();
mDataList = new ArrayList<SqlData>();
}
//构造函数有context和一个数据库的cursor多数变量通过cursor指向的一条记录直接进行初始化
public SqlNote(Context context, Cursor c) {
mContext = context;
mContentResolver = context.getContentResolver();
mIsCreate = false;
loadFromCursor(c);
mDataList = new ArrayList<SqlData>();
//
if (mType == Notes.TYPE_NOTE)
loadDataContent();
mDiffNoteValues = new ContentValues();
}
// mIsCreate用于标示构造方式
public SqlNote(Context context, long id) {
mContext = context;
mContentResolver = context.getContentResolver();
mIsCreate = false;
loadFromCursor(id);
mDataList = new ArrayList<SqlData>();
if (mType == Notes.TYPE_NOTE)
loadDataContent();
mDiffNoteValues = new ContentValues();
}
//功能描述通过id从光标处加载数据
private void loadFromCursor(long id) {
Cursor c = null;
try {
c = mContentResolver.query(Notes.CONTENT_NOTE_URI, PROJECTION_NOTE, "(_id=?)",
new String[] {
String.valueOf(id)
}, null);//通过id获得对应的ContentResolver中的cursor
if (c != null) {
c.moveToNext();
loadFromCursor(c);//然后加载数据进行初始化,这样函数
//SqlNote(Context context, long id)与SqlNote(Context context, long id)的实现方式基本相同
} else {
Log.w(TAG, "loadFromCursor: cursor = null");
}
} finally {
if (c != null)
c.close();
}
}
// 功能描述:通过游标从光标处加载数据
private void loadFromCursor(Cursor c) {
//直接从一条记录中的获得以下变量的初始值
mId = c.getLong(ID_COLUMN);
mAlertDate = c.getLong(ALERTED_DATE_COLUMN);
mBgColorId = c.getInt(BG_COLOR_ID_COLUMN);
mCreatedDate = c.getLong(CREATED_DATE_COLUMN);
mHasAttachment = c.getInt(HAS_ATTACHMENT_COLUMN);
mModifiedDate = c.getLong(MODIFIED_DATE_COLUMN);
mParentId = c.getLong(PARENT_ID_COLUMN);
mSnippet = c.getString(SNIPPET_COLUMN);
mType = c.getInt(TYPE_COLUMN);
mWidgetId = c.getInt(WIDGET_ID_COLUMN);
mWidgetType = c.getInt(WIDGET_TYPE_COLUMN);
mVersion = c.getLong(VERSION_COLUMN);
}
// 功能描述通过content机制获取共享数据并加载到数据库当前游标
private void loadDataContent() {
Cursor c = null;
mDataList.clear();
try {
c = mContentResolver.query(Notes.CONTENT_DATA_URI, SqlData.PROJECTION_DATA,
"(note_id=?)", new String[] {
String.valueOf(mId)
}, null);
if (c != null) {
if (c.getCount() == 0) {
Log.w(TAG, "it seems that the note has not data");
return;
}
while (c.moveToNext()) {
SqlData data = new SqlData(mContext, c);
mDataList.add(data);
}
} else {
Log.w(TAG, "loadDataContent: cursor = null");
}
} finally {
if (c != null)
c.close();
}
}
// 功能描述设置通过content机制用于共享的数据信息
public boolean setContent(JSONObject js) {
try {
JSONObject note = js.getJSONObject(GTaskStringUtils.META_HEAD_NOTE);
if (note.getInt(NoteColumns.TYPE) == Notes.TYPE_SYSTEM) {
Log.w(TAG, "cannot set system folder");
} else if (note.getInt(NoteColumns.TYPE) == Notes.TYPE_FOLDER) {
// for folder we can only update the snnipet and type
String snippet = note.has(NoteColumns.SNIPPET) ? note
.getString(NoteColumns.SNIPPET) : "";
if (mIsCreate || !mSnippet.equals(snippet)) {
mDiffNoteValues.put(NoteColumns.SNIPPET, snippet);
}
mSnippet = snippet;
int type = note.has(NoteColumns.TYPE) ? note.getInt(NoteColumns.TYPE)
: Notes.TYPE_NOTE;
if (mIsCreate || mType != type) {
mDiffNoteValues.put(NoteColumns.TYPE, type);
}
mType = type;
} else if (note.getInt(NoteColumns.TYPE) == Notes.TYPE_NOTE) {
JSONArray dataArray = js.getJSONArray(GTaskStringUtils.META_HEAD_DATA);
long id = note.has(NoteColumns.ID) ? note.getLong(NoteColumns.ID) : INVALID_ID;
if (mIsCreate || mId != id) {
mDiffNoteValues.put(NoteColumns.ID, id);
}
mId = id;
long alertDate = note.has(NoteColumns.ALERTED_DATE) ? note
.getLong(NoteColumns.ALERTED_DATE) : 0;
if (mIsCreate || mAlertDate != alertDate) {
mDiffNoteValues.put(NoteColumns.ALERTED_DATE, alertDate);
}
mAlertDate = alertDate;
int bgColorId = note.has(NoteColumns.BG_COLOR_ID) ? note
.getInt(NoteColumns.BG_COLOR_ID) : ResourceParser.getDefaultBgId(mContext);
if (mIsCreate || mBgColorId != bgColorId) {
mDiffNoteValues.put(NoteColumns.BG_COLOR_ID, bgColorId);
}
mBgColorId = bgColorId;
long createDate = note.has(NoteColumns.CREATED_DATE) ? note
.getLong(NoteColumns.CREATED_DATE) : System.currentTimeMillis();
if (mIsCreate || mCreatedDate != createDate) {
mDiffNoteValues.put(NoteColumns.CREATED_DATE, createDate);
}
mCreatedDate = createDate;
int hasAttachment = note.has(NoteColumns.HAS_ATTACHMENT) ? note
.getInt(NoteColumns.HAS_ATTACHMENT) : 0;
if (mIsCreate || mHasAttachment != hasAttachment) {
mDiffNoteValues.put(NoteColumns.HAS_ATTACHMENT, hasAttachment);
}
mHasAttachment = hasAttachment;
long modifiedDate = note.has(NoteColumns.MODIFIED_DATE) ? note
.getLong(NoteColumns.MODIFIED_DATE) : System.currentTimeMillis();
if (mIsCreate || mModifiedDate != modifiedDate) {
mDiffNoteValues.put(NoteColumns.MODIFIED_DATE, modifiedDate);
}
mModifiedDate = modifiedDate;
long parentId = note.has(NoteColumns.PARENT_ID) ? note
.getLong(NoteColumns.PARENT_ID) : 0;
if (mIsCreate || mParentId != parentId) {
mDiffNoteValues.put(NoteColumns.PARENT_ID, parentId);
}
mParentId = parentId;
String snippet = note.has(NoteColumns.SNIPPET) ? note
.getString(NoteColumns.SNIPPET) : "";
if (mIsCreate || !mSnippet.equals(snippet)) {
mDiffNoteValues.put(NoteColumns.SNIPPET, snippet);
}
mSnippet = snippet;
int type = note.has(NoteColumns.TYPE) ? note.getInt(NoteColumns.TYPE)
: Notes.TYPE_NOTE;
if (mIsCreate || mType != type) {
mDiffNoteValues.put(NoteColumns.TYPE, type);
}
mType = type;
int widgetId = note.has(NoteColumns.WIDGET_ID) ? note.getInt(NoteColumns.WIDGET_ID)
: AppWidgetManager.INVALID_APPWIDGET_ID;
if (mIsCreate || mWidgetId != widgetId) {
mDiffNoteValues.put(NoteColumns.WIDGET_ID, widgetId);
}
mWidgetId = widgetId;
int widgetType = note.has(NoteColumns.WIDGET_TYPE) ? note
.getInt(NoteColumns.WIDGET_TYPE) : Notes.TYPE_WIDGET_INVALIDE;
if (mIsCreate || mWidgetType != widgetType) {
mDiffNoteValues.put(NoteColumns.WIDGET_TYPE, widgetType);
}
mWidgetType = widgetType;
long originParent = note.has(NoteColumns.ORIGIN_PARENT_ID) ? note
.getLong(NoteColumns.ORIGIN_PARENT_ID) : 0;
if (mIsCreate || mOriginParent != originParent) {
mDiffNoteValues.put(NoteColumns.ORIGIN_PARENT_ID, originParent);
}
mOriginParent = originParent;
for (int i = 0; i < dataArray.length(); i++) {
JSONObject data = dataArray.getJSONObject(i);
SqlData sqlData = null;
if (data.has(DataColumns.ID)) {
long dataId = data.getLong(DataColumns.ID);
for (SqlData temp : mDataList) {
if (dataId == temp.getId()) {
sqlData = temp;
}
}
}
if (sqlData == null) {
sqlData = new SqlData(mContext);
mDataList.add(sqlData);
}
sqlData.setContent(data);
}
}
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
return false;
}
return true;
}
// 功能描述获取content机制提供的数据并加载到note中
public JSONObject getContent() {
try {
JSONObject js = new JSONObject();
if (mIsCreate) {
Log.e(TAG, "it seems that we haven't created this in database yet");
return null;
}
JSONObject note = new JSONObject();
if (mType == Notes.TYPE_NOTE) {//类型为note时
note.put(NoteColumns.ID, mId);
note.put(NoteColumns.ALERTED_DATE, mAlertDate);
note.put(NoteColumns.BG_COLOR_ID, mBgColorId);
note.put(NoteColumns.CREATED_DATE, mCreatedDate);
note.put(NoteColumns.HAS_ATTACHMENT, mHasAttachment);
note.put(NoteColumns.MODIFIED_DATE, mModifiedDate);
note.put(NoteColumns.PARENT_ID, mParentId);
note.put(NoteColumns.SNIPPET, mSnippet);
note.put(NoteColumns.TYPE, mType);
note.put(NoteColumns.WIDGET_ID, mWidgetId);
note.put(NoteColumns.WIDGET_TYPE, mWidgetType);
note.put(NoteColumns.ORIGIN_PARENT_ID, mOriginParent);
js.put(GTaskStringUtils.META_HEAD_NOTE, note);
JSONArray dataArray = new JSONArray();
for (SqlData sqlData : mDataList) {
JSONObject data = sqlData.getContent();
if (data != null) {
dataArray.put(data);
}
}
js.put(GTaskStringUtils.META_HEAD_DATA, dataArray);
} else if (mType == Notes.TYPE_FOLDER || mType == Notes.TYPE_SYSTEM) {//类型为文件夹或者
note.put(NoteColumns.ID, mId);
note.put(NoteColumns.TYPE, mType);
note.put(NoteColumns.SNIPPET, mSnippet);
js.put(GTaskStringUtils.META_HEAD_NOTE, note);
}
return js;
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
}
return null;
}
// 功能描述给当前id设置父id
public void setParentId(long id) {
mParentId = id;
mDiffNoteValues.put(NoteColumns.PARENT_ID, id);
}
//功能描述给当前id设置Gtaskid
public void setGtaskId(String gid) {
mDiffNoteValues.put(NoteColumns.GTASK_ID, gid);
}
// 功能描述给当前id设置同步id
public void setSyncId(long syncId) {
mDiffNoteValues.put(NoteColumns.SYNC_ID, syncId);
}
// 功能描述:初始化本地修改,即撤销所有当前修改
public void resetLocalModified() {
mDiffNoteValues.put(NoteColumns.LOCAL_MODIFIED, 0);
}
// 功能描述获得当前id
public long getId() {
return mId;
}
//获得当前id的父id
public long getParentId() {
return mParentId;
}
//获取小片段即用于显示的部分便签内容
public String getSnippet() {
return mSnippet;
}
//判断是否为便签类型
public boolean isNoteType() {
return mType == Notes.TYPE_NOTE;
}
//commit函数用于把当前造作所做的修改保存到数据库
public void commit(boolean validateVersion) {
if (mIsCreate) {
if (mId == INVALID_ID && mDiffNoteValues.containsKey(NoteColumns.ID)) {
mDiffNoteValues.remove(NoteColumns.ID);
}
Uri uri = mContentResolver.insert(Notes.CONTENT_NOTE_URI, mDiffNoteValues);
try {
mId = Long.valueOf(uri.getPathSegments().get(1));
} catch (NumberFormatException e) {
Log.e(TAG, "Get note id error :" + e.toString());
throw new ActionFailureException("create note failed");
}
if (mId == 0) {
throw new IllegalStateException("Create thread id failed");
}
if (mType == Notes.TYPE_NOTE) {
for (SqlData sqlData : mDataList) {//直接使用sqldata中的实现
sqlData.commit(mId, false, -1);
}
}
} else {
if (mId <= 0 && mId != Notes.ID_ROOT_FOLDER && mId != Notes.ID_CALL_RECORD_FOLDER) {
Log.e(TAG, "No such note");
throw new IllegalStateException("Try to update note with invalid id");
}
if (mDiffNoteValues.size() > 0) {
mVersion ++;
int result = 0;
if (!validateVersion) { //构造字符串
result = mContentResolver.update(Notes.CONTENT_NOTE_URI, mDiffNoteValues, "("
+ NoteColumns.ID + "=?)", new String[] {
String.valueOf(mId)
});
} else {
result = mContentResolver.update(Notes.CONTENT_NOTE_URI, mDiffNoteValues, "("
+ NoteColumns.ID + "=?) AND (" + NoteColumns.VERSION + "<=?)",
new String[] {
String.valueOf(mId), String.valueOf(mVersion)
});
}
if (result == 0) {
Log.w(TAG, "there is no update. maybe user updates note when syncing");
}
}
if (mType == Notes.TYPE_NOTE) {
for (SqlData sqlData : mDataList) {
sqlData.commit(mId, validateVersion, mVersion);
}
}
}
// refresh local info
loadFromCursor(mId);
if (mType == Notes.TYPE_NOTE)
loadDataContent();
mDiffNoteValues.clear();
mIsCreate = false;
}
}

@ -0,0 +1,361 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.micode.notes.gtask.data;
import android.database.Cursor;
import android.text.TextUtils;
import android.util.Log;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.DataColumns;
import net.micode.notes.data.Notes.DataConstants;
import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.gtask.exception.ActionFailureException;
import net.micode.notes.tool.GTaskStringUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class Task extends Node {
private static final String TAG = Task.class.getSimpleName();
// 任务是否已完成
private boolean mCompleted;
// 与任务关联的备注
private String mNotes;
// 与任务关联的元信息
private JSONObject mMetaInfo;
// 在列表中位于该任务前面的任务
private Task mPriorSibling;
// 该任务所属的父任务列表
private TaskList mParent;
//创建一个新的空任务的构造函数
public Task() {
super();
mCompleted = false;
mNotes = null;
mPriorSibling = null;
mParent = null;
mMetaInfo = null;
}
//从JSON对象创建任务的构造函数
//如果JSON对象不符合预期的格式则抛出异常。
public Task(JSONObject jsonObject) throws JSONException {
super(jsonObject);
mCompleted = jsonObject.getBoolean(GTaskStringUtils.STATUS);
mNotes = jsonObject.optString(GTaskStringUtils.NOTES);
mMetaInfo = jsonObject.optJSONObject(GTaskStringUtils.META_DATA);
}
public JSONObject getCreateAction(int actionId) {
JSONObject js = new JSONObject();
try {
// action_id 操作ID
js.put(GTaskStringUtils.GTASK_JSON_ACTION_ID, actionId);
// index 任务在父任务列表中的位置
js.put(GTaskStringUtils.GTASK_JSON_INDEX, mParent.getChildTaskIndex(this));
// entity_delta 任务实体信息
JSONObject entity = new JSONObject();
entity.put(GTaskStringUtils.GTASK_JSON_NAME, getName()); // 任务名称
entity.put(GTaskStringUtils.GTASK_JSON_CREATOR_ID, "null"); // 创建者ID
entity.put(GTaskStringUtils.GTASK_JSON_ENTITY_TYPE,
GTaskStringUtils.GTASK_JSON_TYPE_TASK); // 实体类型为任务
if (getNotes() != null) {
entity.put(GTaskStringUtils.GTASK_JSON_NOTES, getNotes()); // 关联的备注信息
}
js.put(GTaskStringUtils.GTASK_JSON_ENTITY_DELTA, entity);
// parent_id 父任务列表ID
js.put(GTaskStringUtils.GTASK_JSON_PARENT_ID, mParent.getGid());
// dest_parent_type 目标父实体类型
js.put(GTaskStringUtils.GTASK_JSON_DEST_PARENT_TYPE,
GTaskStringUtils.GTASK_JSON_TYPE_GROUP);
// list_id 任务列表ID
js.put(GTaskStringUtils.GTASK_JSON_LIST_ID, mParent.getGid());
// prior_sibling_id 前置任务ID
if (mPriorSibling != null) {
js.put(GTaskStringUtils.GTASK_JSON_PRIOR_SIBLING_ID, mPriorSibling.getGid());
}
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new ActionFailureException("fail to generate task-create jsonobject");
}
return js;
}
public JSONObject getUpdateAction(int actionId) {
JSONObject js = new JSONObject();
try {
// action_id 操作ID
js.put(GTaskStringUtils.GTASK_JSON_ACTION_ID, actionId);
// id 任务ID
js.put(GTaskStringUtils.GTASK_JSON_ID, getGid());
// entity_delta 任务实体信息
JSONObject entity = new JSONObject();
entity.put(GTaskStringUtils.GTASK_JSON_NAME, getName()); // 任务名称
if (getNotes() != null) {
entity.put(GTaskStringUtils.GTASK_JSON_NOTES, getNotes()); // 关联的备注信息
}
entity.put(GTaskStringUtils.GTASK_JSON_DELETED, getDeleted()); // 是否被删除
js.put(GTaskStringUtils.GTASK_JSON_ENTITY_DELTA, entity);
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new ActionFailureException("fail to generate task-update jsonobject");
}
return js;
}
public void setContentByRemoteJSON(JSONObject js) {
if (js != null) {
try {
// id
if (js.has(GTaskStringUtils.GTASK_JSON_ID)) {
setGid(js.getString(GTaskStringUtils.GTASK_JSON_ID));
}
// last_modified 最近修改时间
if (js.has(GTaskStringUtils.GTASK_JSON_LAST_MODIFIED)) {
setLastModified(js.getLong(GTaskStringUtils.GTASK_JSON_LAST_MODIFIED));
}
// name 任务名称
if (js.has(GTaskStringUtils.GTASK_JSON_NAME)) {
setName(js.getString(GTaskStringUtils.GTASK_JSON_NAME));
}
// notes 关联的备注信息
if (js.has(GTaskStringUtils.GTASK_JSON_NOTES)) {
setNotes(js.getString(GTaskStringUtils.GTASK_JSON_NOTES));
}
// deleted 是否被删除
if (js.has(GTaskStringUtils.GTASK_JSON_DELETED)) {
setDeleted(js.getBoolean(GTaskStringUtils.GTASK_JSON_DELETED));
}
// completed 是否已完成
if (js.has(GTaskStringUtils.GTASK_JSON_COMPLETED)) {
setCompleted(js.getBoolean(GTaskStringUtils.GTASK_JSON_COMPLETED));
}
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new ActionFailureException("fail to get task content from jsonobject");
}
}
}
//将本地存储的JSON对象中的内容设置到任务对象中。
public void setContentByLocalJSON(JSONObject js) {
if (js == null || !js.has(GTaskStringUtils.META_HEAD_NOTE)
|| !js.has(GTaskStringUtils.META_HEAD_DATA)) {
Log.w(TAG, "setContentByLocalJSON: nothing is avaiable");
}
try {
JSONObject note = js.getJSONObject(GTaskStringUtils.META_HEAD_NOTE);
JSONArray dataArray = js.getJSONArray(GTaskStringUtils.META_HEAD_DATA);
if (note.getInt(NoteColumns.TYPE) != Notes.TYPE_NOTE) {
Log.e(TAG, "invalid type");
return;
}
for (int i = 0; i < dataArray.length(); i++) {
JSONObject data = dataArray.getJSONObject(i);
if (TextUtils.equals(data.getString(DataColumns.MIME_TYPE), DataConstants.NOTE)) {
setName(data.getString(DataColumns.CONTENT)); // 设置任务名称为备注内容
break;
}
}
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
}
}
//从任务对象中获取本地存储的JSON对象。
public JSONObject getLocalJSONFromContent() {
String name = getName();
try {
if (mMetaInfo == null) {
// 从Web创建的新任务
if (name == null) {
Log.w(TAG, "the note seems to be an empty one");
return null;
}
JSONObject js = new JSONObject();
JSONObject note = new JSONObject();
JSONArray dataArray = new JSONArray();
JSONObject data = new JSONObject();
data.put(DataColumns.CONTENT, name);
dataArray.put(data);
js.put(GTaskStringUtils.META_HEAD_DATA, dataArray);
note.put(NoteColumns.TYPE, Notes.TYPE_NOTE);
js.put(GTaskStringUtils.META_HEAD_NOTE, note);
return js;
} else {
// 已同步的任务
JSONObject note = mMetaInfo.getJSONObject(GTaskStringUtils.META_HEAD_NOTE);
JSONArray dataArray = mMetaInfo.getJSONArray(GTaskStringUtils.META_HEAD_DATA);
for (int i = 0; i < dataArray.length(); i++) {
JSONObject data = dataArray.getJSONObject(i);
if (TextUtils.equals(data.getString(DataColumns.MIME_TYPE), DataConstants.NOTE)) {
data.put(DataColumns.CONTENT, getName()); // 更新备注内容为任务名称
break;
}
}
note.put(NoteColumns.TYPE, Notes.TYPE_NOTE);
return mMetaInfo;
}
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
return null;
}
}
public void setMetaInfo(MetaData metaData) {
if (metaData != null && metaData.getNotes() != null) {
try {
mMetaInfo = new JSONObject(metaData.getNotes());
} catch (JSONException e) {
Log.w(TAG, e.toString());
mMetaInfo = null;
}
}
}
//根据传入的Cursor对象获取同步任务的操作类型。
public int getSyncAction(Cursor c) {
try {
JSONObject noteInfo = null;
if (mMetaInfo != null && mMetaInfo.has(GTaskStringUtils.META_HEAD_NOTE)) {
noteInfo = mMetaInfo.getJSONObject(GTaskStringUtils.META_HEAD_NOTE);
}
if (noteInfo == null) {
Log.w(TAG, "it seems that note meta has been deleted");
return SYNC_ACTION_UPDATE_REMOTE;
}
if (!noteInfo.has(NoteColumns.ID)) {
Log.w(TAG, "remote note id seems to be deleted");
return SYNC_ACTION_UPDATE_LOCAL;
}
// 验证笔记ID是否匹配
if (c.getLong(SqlNote.ID_COLUMN) != noteInfo.getLong(NoteColumns.ID)) {
Log.w(TAG, "note id doesn't match");
return SYNC_ACTION_UPDATE_LOCAL;
}
if (c.getInt(SqlNote.LOCAL_MODIFIED_COLUMN) == 0) {
// 本地没有更新
if (c.getLong(SqlNote.SYNC_ID_COLUMN) == getLastModified()) {
// 双方都没有更新
return SYNC_ACTION_NONE;
} else {
// 应用远程更新到本地
return SYNC_ACTION_UPDATE_LOCAL;
}
} else {
// 验证gtask id是否匹配
if (!c.getString(SqlNote.GTASK_ID_COLUMN).equals(getGid())) {
Log.e(TAG, "gtask id doesn't match");
return SYNC_ACTION_ERROR;
}
if (c.getLong(SqlNote.SYNC_ID_COLUMN) == getLastModified()) {
// 仅有本地修改
return SYNC_ACTION_UPDATE_REMOTE;
} else {
// 本地和远程都有修改
return SYNC_ACTION_UPDATE_CONFLICT;
}
}
} catch (Exception e) {
Log.e(TAG, e.toString());
e.printStackTrace();
}
return SYNC_ACTION_ERROR;
}
//判断是否值得保存。
// 如果有元数据、名称或笔记内容则返回true否则返回false
public boolean isWorthSaving() {
return mMetaInfo != null || (getName() != null && getName().trim().length() > 0)
|| (getNotes() != null && getNotes().trim().length() > 0);
}
//设置任务是否已完成
public void setCompleted(boolean completed) {
this.mCompleted = completed;
}
//设置笔记内容
public void setNotes(String notes) {
this.mNotes = notes;
}
//设置前一个同级任务。
public void setPriorSibling(Task priorSibling) {
this.mPriorSibling = priorSibling;
}
//设置所属任务列表
public void setParent(TaskList parent) {
this.mParent = parent;
}
// 获取任务是否已完成
public boolean getCompleted() {
return this.mCompleted;
}
//获取笔记内容
public String getNotes() {
return this.mNotes;
}
//获取前一个同级任务。
public Task getPriorSibling() {
return this.mPriorSibling;
}
//获取所属任务列表
public TaskList getParent() {
return this.mParent;
}
}

@ -0,0 +1,357 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.micode.notes.gtask.data;
import android.database.Cursor;
import android.util.Log;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.gtask.exception.ActionFailureException;
import net.micode.notes.tool.GTaskStringUtils;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
public class TaskList extends Node {
private static final String TAG = TaskList.class.getSimpleName();//tag标记
private int mIndex;//当前TaskList的指针
private ArrayList<Task> mChildren;//类中主要的保存数据的单元用来实现一个以Task为元素的ArrayList
public TaskList() {
super();
mChildren = new ArrayList<Task>();
mIndex = 1;
}
// 生成并返回一个包含了一定数据的JSONObject实体
public JSONObject getCreateAction(int actionId) {
JSONObject js = new JSONObject();
try {
// action_type
js.put(GTaskStringUtils.GTASK_JSON_ACTION_TYPE,
GTaskStringUtils.GTASK_JSON_ACTION_TYPE_CREATE);
// action_id
js.put(GTaskStringUtils.GTASK_JSON_ACTION_ID, actionId);
// index
js.put(GTaskStringUtils.GTASK_JSON_INDEX, mIndex);
// entity_delta
JSONObject entity = new JSONObject();//entity实体
entity.put(GTaskStringUtils.GTASK_JSON_NAME, getName());
entity.put(GTaskStringUtils.GTASK_JSON_CREATOR_ID, "null");
entity.put(GTaskStringUtils.GTASK_JSON_ENTITY_TYPE,
GTaskStringUtils.GTASK_JSON_TYPE_GROUP);
js.put(GTaskStringUtils.GTASK_JSON_ENTITY_DELTA, entity);
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new ActionFailureException("fail to generate tasklist-create jsonobject");
}
return js;
}
//生成并返回一个包含了一定数据的JSONObject实体
public JSONObject getUpdateAction(int actionId) {
JSONObject js = new JSONObject();
try {
// action_type
js.put(GTaskStringUtils.GTASK_JSON_ACTION_TYPE,
GTaskStringUtils.GTASK_JSON_ACTION_TYPE_UPDATE);
// action_id
js.put(GTaskStringUtils.GTASK_JSON_ACTION_ID, actionId);
// id
js.put(GTaskStringUtils.GTASK_JSON_ID, getGid());
// entity_delta
JSONObject entity = new JSONObject();
entity.put(GTaskStringUtils.GTASK_JSON_NAME, getName());
entity.put(GTaskStringUtils.GTASK_JSON_DELETED, getDeleted());
js.put(GTaskStringUtils.GTASK_JSON_ENTITY_DELTA, entity);
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new ActionFailureException("fail to generate tasklist-update jsonobject");
}
return js;
}
public void setContentByRemoteJSON(JSONObject js) {
if (js != null) {
try {
// id
if (js.has(GTaskStringUtils.GTASK_JSON_ID)) {
setGid(js.getString(GTaskStringUtils.GTASK_JSON_ID));
}
// last_modified
if (js.has(GTaskStringUtils.GTASK_JSON_LAST_MODIFIED)) {
setLastModified(js.getLong(GTaskStringUtils.GTASK_JSON_LAST_MODIFIED));
}
// name
if (js.has(GTaskStringUtils.GTASK_JSON_NAME)) {
setName(js.getString(GTaskStringUtils.GTASK_JSON_NAME));
}
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new ActionFailureException("fail to get tasklist content from jsonobject");
}
}
}
public void setContentByLocalJSON(JSONObject js) {
if (js == null || !js.has(GTaskStringUtils.META_HEAD_NOTE)) {
Log.w(TAG, "setContentByLocalJSON: nothing is avaiable");
}
try {
JSONObject folder = js.getJSONObject(GTaskStringUtils.META_HEAD_NOTE);
if (folder.getInt(NoteColumns.TYPE) == Notes.TYPE_FOLDER) {
String name = folder.getString(NoteColumns.SNIPPET);
setName(GTaskStringUtils.MIUI_FOLDER_PREFFIX + name);
} else if (folder.getInt(NoteColumns.TYPE) == Notes.TYPE_SYSTEM) {
if (folder.getLong(NoteColumns.ID) == Notes.ID_ROOT_FOLDER)
setName(GTaskStringUtils.MIUI_FOLDER_PREFFIX + GTaskStringUtils.FOLDER_DEFAULT);
else if (folder.getLong(NoteColumns.ID) == Notes.ID_CALL_RECORD_FOLDER)
setName(GTaskStringUtils.MIUI_FOLDER_PREFFIX
+ GTaskStringUtils.FOLDER_CALL_NOTE);
else
Log.e(TAG, "invalid system folder");
} else {
Log.e(TAG, "error type");
}
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
}
}
public JSONObject getLocalJSONFromContent() {
try {
JSONObject js = new JSONObject();
JSONObject folder = new JSONObject();
String folderName = getName();
if (getName().startsWith(GTaskStringUtils.MIUI_FOLDER_PREFFIX))
folderName = folderName.substring(GTaskStringUtils.MIUI_FOLDER_PREFFIX.length(),
folderName.length());
folder.put(NoteColumns.SNIPPET, folderName);
if (folderName.equals(GTaskStringUtils.FOLDER_DEFAULT)
|| folderName.equals(GTaskStringUtils.FOLDER_CALL_NOTE))
folder.put(NoteColumns.TYPE, Notes.TYPE_SYSTEM);
else
folder.put(NoteColumns.TYPE, Notes.TYPE_FOLDER);
js.put(GTaskStringUtils.META_HEAD_NOTE, folder);
return js;
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
return null;
}
}
public int getSyncAction(Cursor c) {
try {
if (c.getInt(SqlNote.LOCAL_MODIFIED_COLUMN) == 0) {
// there is no local update
if (c.getLong(SqlNote.SYNC_ID_COLUMN) == getLastModified()) {
// no update both side
return SYNC_ACTION_NONE;
} else {
// apply remote to local
return SYNC_ACTION_UPDATE_LOCAL;
}
} else {
// validate gtask id
if (!c.getString(SqlNote.GTASK_ID_COLUMN).equals(getGid())) {
Log.e(TAG, "gtask id doesn't match");
return SYNC_ACTION_ERROR;
}
if (c.getLong(SqlNote.SYNC_ID_COLUMN) == getLastModified()) {
// local modification only
return SYNC_ACTION_UPDATE_REMOTE;
} else {
// for folder conflicts, just apply local modification
return SYNC_ACTION_UPDATE_REMOTE;
}
}
} catch (Exception e) {
Log.e(TAG, e.toString());
e.printStackTrace();
}
return SYNC_ACTION_ERROR;
}
//获得TaskList的大小即mChildren的大小
public int getChildTaskCount() {
return mChildren.size();
}
//在当前任务表末尾添加新的任务
public boolean addChildTask(Task task) {
boolean ret = false;
if (task != null && !mChildren.contains(task)) {
ret = mChildren.add(task);
if (ret) {
// need to set prior sibling and parent
task.setPriorSibling(mChildren.isEmpty() ? null : mChildren
.get(mChildren.size() - 1));
task.setParent(this);
//每一次ArrayList的变化都要紧跟相关Task中PriorSibling
}
}
return ret;
}
//在当前任务表的指定位置添加新的任务
public boolean addChildTask(Task task, int index) {
if (index < 0 || index > mChildren.size()) {
Log.e(TAG, "add child task: invalid index");
return false;
}
int pos = mChildren.indexOf(task);
if (task != null && pos == -1) {
mChildren.add(index, task);
// update the task list
Task preTask = null;
Task afterTask = null;
if (index != 0)
preTask = mChildren.get(index - 1);
if (index != mChildren.size() - 1)
afterTask = mChildren.get(index + 1);
task.setPriorSibling(preTask);
if (afterTask != null)
afterTask.setPriorSibling(task);
}
return true;
}
//删除TaskList中的一个Task
public boolean removeChildTask(Task task) {
boolean ret = false;
int index = mChildren.indexOf(task);
if (index != -1) {
ret = mChildren.remove(task);
if (ret) {
// reset prior sibling and parent
task.setPriorSibling(null);
task.setParent(null);
// update the task list
if (index != mChildren.size()) {
mChildren.get(index).setPriorSibling(
index == 0 ? null : mChildren.get(index - 1));
}
}
}
return ret;
}
//将当前TaskList中含有的某个Task移到index位置
public boolean moveChildTask(Task task, int index) {
if (index < 0 || index >= mChildren.size()) {
Log.e(TAG, "move child task: invalid index");
return false;
}
int pos = mChildren.indexOf(task);
if (pos == -1) {
Log.e(TAG, "move child task: the task should in the list");
return false;
}
if (pos == index)
return true;
return (removeChildTask(task) && addChildTask(task, index));
//利用已实现好的功能完成当下功能;
}
//功能按gid寻找Task
public Task findChildTaskByGid(String gid) {
for (int i = 0; i < mChildren.size(); i++) {
Task t = mChildren.get(i);
if (t.getGid().equals(gid)) {
return t;
}
}
return null;
}
//返回指定Task的index
public int getChildTaskIndex(Task task) {
return mChildren.indexOf(task);
}
//返回指定index的Task
public Task getChildTaskByIndex(int index) {
if (index < 0 || index >= mChildren.size()) {
Log.e(TAG, "getTaskByIndex: invalid index");
return null;
}
return mChildren.get(index);
}
//返回指定gid的Task
public Task getChilTaskByGid(String gid) {
for (Task task : mChildren) {//一种常见的ArrayList的遍历方法四种见精读笔记
if (task.getGid().equals(gid))
return task;
}
return null;
}
public ArrayList<Task> getChildTaskList() {
return this.mChildren;
}
public void setIndex(int index) {
this.mIndex = index;
}
public int getIndex() {
return this.mIndex;
}
}

@ -0,0 +1,123 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.micode.notes.gtask.remote;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import net.micode.notes.R;//引入android自动生成的R类
import net.micode.notes.ui.NotesListActivity;
import net.micode.notes.ui.NotesPreferenceActivity;
//类扩展于AysyncTask类是用来处理GTask的异步任务的类
public class GTaskASyncTask extends AsyncTask<Void, String, Integer> {
private static int GTASK_SYNC_NOTIFICATION_ID = 5234235;
public interface OnCompleteListener {//通过interface实现多个接口接口为OnCompleteListener用来初始化异步的功能
void onComplete();
}
private Context mContext;
private NotificationManager mNotifiManager;
private GTaskManager mTaskManager;
//函数: GTaskASyncTask类的构造函数
private OnCompleteListener mOnCompleteListener;
public GTaskASyncTask(Context context, OnCompleteListener listener) {
mContext = context;
mOnCompleteListener = listener;
mNotifiManager = (NotificationManager) mContext
.getSystemService(Context.NOTIFICATION_SERVICE);
mTaskManager = GTaskManager.getInstance();
}
//方法:中断同步操作
public void cancelSync() {
mTaskManager.cancelSync();
}
//方法: 提交后台进度并调用onProgressUpdate方法来更新进度条
public void publishProgess(String message) {
publishProgress(new String[] {
message
});
}
//方法:显示通知消息,在这里主要用于向用户通知同步的进程
private void showNotification(int tickerId, String content) {
Notification notification = new Notification(R.drawable.notification, mContext
.getString(tickerId), System.currentTimeMillis());
notification.defaults = Notification.DEFAULT_LIGHTS;
notification.flags = Notification.FLAG_AUTO_CANCEL;
PendingIntent pendingIntent;
if (tickerId != R.string.ticker_success) {
pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext,
NotesPreferenceActivity.class), 0);
} else {
pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext,
NotesListActivity.class), 0);
}
/*notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content,
pendingIntent);*/
mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification);
}
//方法:异步执行后台线程将要完成的任务
@Override
protected Integer doInBackground(Void... unused) {
publishProgess(mContext.getString(R.string.sync_progress_login, NotesPreferenceActivity
.getSyncAccountName(mContext)));
return mTaskManager.sync(mContext, this);
}
//方法在调用publishProgress时该方法被执行并将进度信息更新到UI组件中
@Override
protected void onProgressUpdate(String... progress) {
showNotification(R.string.ticker_syncing, progress[0]);
if (mContext instanceof GTaskSyncService) {
((GTaskSyncService) mContext).sendBroadcast(progress[0]);
}
}
//方法: 在dolnBackground执行完成后该方法会被UI线程调用将后台的计算结果传递到UI进程并在界面上展示出来
@Override
protected void onPostExecute(Integer result) {
if (result == GTaskManager.STATE_SUCCESS) {
showNotification(R.string.ticker_success, mContext.getString(
R.string.success_sync_account, mTaskManager.getSyncAccount()));
NotesPreferenceActivity.setLastSyncTime(mContext, System.currentTimeMillis());
} else if (result == GTaskManager.STATE_NETWORK_ERROR) {
showNotification(R.string.ticker_fail, mContext.getString(R.string.error_sync_network));
} else if (result == GTaskManager.STATE_INTERNAL_ERROR) {
showNotification(R.string.ticker_fail, mContext.getString(R.string.error_sync_internal));
} else if (result == GTaskManager.STATE_SYNC_CANCELLED) {
showNotification(R.string.ticker_cancel, mContext
.getString(R.string.error_sync_cancelled));
}
if (mOnCompleteListener != null) {
new Thread(new Runnable() {
public void run() {
mOnCompleteListener.onComplete();
}
}).start();
}
}
}

@ -0,0 +1,662 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.micode.notes.gtask.remote;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AccountManagerFuture;
import android.app.Activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import net.micode.notes.gtask.data.Node;
import net.micode.notes.gtask.data.Task;
import net.micode.notes.gtask.data.TaskList;
import net.micode.notes.gtask.exception.ActionFailureException;
import net.micode.notes.gtask.exception.NetworkFailureException;
import net.micode.notes.tool.GTaskStringUtils;
import net.micode.notes.ui.NotesPreferenceActivity;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.cookie.Cookie;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParams;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.List;
import java.util.zip.GZIPInputStream;
import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream;
public class GTaskClient {
private static final String TAG = GTaskClient.class.getSimpleName();
private static final String GTASK_URL = "https://mail.google.com/tasks/";
private static final String GTASK_GET_URL = "https://mail.google.com/tasks/ig";
private static final String GTASK_POST_URL = "https://mail.google.com/tasks/r/ig";
private static GTaskClient mInstance = null;
private DefaultHttpClient mHttpClient;
private String mGetUrl;
private String mPostUrl;
private long mClientVersion;
private boolean mLoggedin;
private long mLastLoginTime;
private int mActionId;
private Account mAccount;
private JSONArray mUpdateArray;
private GTaskClient() {
mHttpClient = null;
mGetUrl = GTASK_GET_URL;
mPostUrl = GTASK_POST_URL;
mClientVersion = -1;
mLoggedin = false;
mLastLoginTime = 0;
mActionId = 1;
mAccount = null;
mUpdateArray = null;
}
/*
* 使 getInstance()
* mInstance
*/
public static synchronized GTaskClient getInstance() {
if (mInstance == null) {
mInstance = new GTaskClient();
}
return mInstance;
}
//用来实现登录操作的函数传入Activity
public boolean login(Activity activity) {
// we suppose that the cookie would expire after 5 minutes
// then we need to re-login
//判断距离最后一次登录操作是否超过5分钟
final long interval = 1000 * 60 * 5;
if (mLastLoginTime + interval < System.currentTimeMillis()) {
mLoggedin = false;
}
// need to re-login after account switch 重新登录操作
if (mLoggedin
&& !TextUtils.equals(getSyncAccount().name, NotesPreferenceActivity
.getSyncAccountName(activity))) {
mLoggedin = false;
}
//如果没超过时间,则不需要重新登录
if (mLoggedin) {
Log.d(TAG, "already logged in");
return true;
}
mLastLoginTime = System.currentTimeMillis();//更新最后登录时间,改为系统当前的时间
String authToken = loginGoogleAccount(activity, false);//判断是否登录到谷歌账户
if (authToken == null) {
Log.e(TAG, "login google account failed");
return false;
}
// login with custom domain if necessary
//尝试使用用户自己的域名登录
if (!(mAccount.name.toLowerCase().endsWith("gmail.com") || mAccount.name.toLowerCase() //将用户账号名改为统一格式(小写)后判断是否为一个谷歌账号地址
.endsWith("googlemail.com"))) {
StringBuilder url = new StringBuilder(GTASK_URL).append("a/");
int index = mAccount.name.indexOf('@') + 1;
String suffix = mAccount.name.substring(index);
url.append(suffix + "/");
mGetUrl = url.toString() + "ig"; //设置用户对应的getUrl
mPostUrl = url.toString() + "r/ig"; //设置用户对应的postUrl
if (tryToLoginGtask(activity, authToken)) {
mLoggedin = true;
}
}
// try to login with google official url
//如果用户账户无法登录则使用谷歌官方的URI进行登录
if (!mLoggedin) {
mGetUrl = GTASK_GET_URL;
mPostUrl = GTASK_POST_URL;
if (!tryToLoginGtask(activity, authToken)) {
return false;
}
}
mLoggedin = true;
return true;
}
//具体实现登录谷歌账户
private String loginGoogleAccount(Activity activity, boolean invalidateToken) {
String authToken; //令牌,是登录操作保证安全性的一个方法
AccountManager accountManager = AccountManager.get(activity);//AccountManager这个类给用户提供了集中注册账号的接口
Account[] accounts = accountManager.getAccountsByType("com.google");//获取全部以com.google结尾的account
if (accounts.length == 0) {
Log.e(TAG, "there is no available google account");
return null;
}
String accountName = NotesPreferenceActivity.getSyncAccountName(activity);
Account account = null;
//遍历获得的accounts信息寻找已经记录过的账户信息
for (Account a : accounts) {
if (a.name.equals(accountName)) {
account = a;
break;
}
}
if (account != null) {
mAccount = account;
} else {
Log.e(TAG, "unable to get an account with the same name in the settings");
return null;
}
// get the token now
//获取选中账号的令牌
AccountManagerFuture<Bundle> accountManagerFuture = accountManager.getAuthToken(account,
"goanna_mobile", null, activity, null, null);
try {
Bundle authTokenBundle = accountManagerFuture.getResult();
authToken = authTokenBundle.getString(AccountManager.KEY_AUTHTOKEN);
//如果是invalidateToken那么需要调用invalidateAuthToken(String, String)方法废除这个无效token
if (invalidateToken) {
accountManager.invalidateAuthToken("com.google", authToken);
loginGoogleAccount(activity, false);
}
} catch (Exception e) {
Log.e(TAG, "get auth token failed");
authToken = null;
}
return authToken;
}
//尝试登陆Gtask这只是一个预先判断令牌是否是有效以及是否能登上GTask的方法,而不是具体实现登陆的方法
private boolean tryToLoginGtask(Activity activity, String authToken) {
if (!loginGtask(authToken)) {
// maybe the auth token is out of authTokedate, now let's invalidate the
// token and try again
//删除过一个无效的authToken申请一个新的后再次尝试登陆
authToken = loginGoogleAccount(activity, true);
if (authToken == null) {
Log.e(TAG, "login google account failed");
return false;
}
if (!loginGtask(authToken)) {
Log.e(TAG, "login gtask failed");
return false;
}
}
return true;
}
//实现登录GTask的具体操作
private boolean loginGtask(String authToken) {
int timeoutConnection = 10000;
int timeoutSocket = 15000; //socket是一种通信连接实现数据的交换的端口
HttpParams httpParameters = new BasicHttpParams(); //实例化一个新的HTTP参数类
HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);//设置连接超时时间
HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);//设置设置端口超时时间
mHttpClient = new DefaultHttpClient(httpParameters);
BasicCookieStore localBasicCookieStore = new BasicCookieStore(); //设置本地cookie
mHttpClient.setCookieStore(localBasicCookieStore);
HttpProtocolParams.setUseExpectContinue(mHttpClient.getParams(), false);
// login gtask
try {
String loginUrl = mGetUrl + "?auth=" + authToken; //设置登录的url
HttpGet httpGet = new HttpGet(loginUrl); //通过登录的uri实例化网页上资源的查找
HttpResponse response = null;
response = mHttpClient.execute(httpGet);
// get the cookie now
//获取CookieStore里存放的cookie,看如果存有“GTL(不知道什么意思)”则说明有验证成功的有效的cookie
List<Cookie> cookies = mHttpClient.getCookieStore().getCookies();
boolean hasAuthCookie = false;
for (Cookie cookie : cookies) {
if (cookie.getName().contains("GTL")) {
hasAuthCookie = true;
}
}
if (!hasAuthCookie) {
Log.w(TAG, "it seems that there is no auth cookie");
}
// get the client version
//获取client的内容具体操作是在返回的Content中截取从_setup(开始到)}</script>中间的字符串内容也就是gtask_url的内容
String resString = getResponseContent(response.getEntity());
String jsBegin = "_setup(";
String jsEnd = ")}</script>";
int begin = resString.indexOf(jsBegin);
int end = resString.lastIndexOf(jsEnd);
String jsString = null;
if (begin != -1 && end != -1 && begin < end) {
jsString = resString.substring(begin + jsBegin.length(), end);
}
JSONObject js = new JSONObject(jsString);
mClientVersion = js.getLong("v");
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
return false;
} catch (Exception e) {
// simply catch all exceptions
Log.e(TAG, "httpget gtask_url failed");
return false;
}
return true;
}
private int getActionId() {
return mActionId++;
}
/*
* 使HttpPost
* httpPost
*/
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;
}
/*URL
* 使getContentEncoding()
*
*/
private String getResponseContent(HttpEntity entity) throws IOException {
String contentEncoding = null;
if (entity.getContentEncoding() != null) {//通过URL得到HttpEntity对象如果不为空则使用getContent方法创建一个流将数据从网络都过来
contentEncoding = entity.getContentEncoding().getValue();
Log.d(TAG, "encoding: " + contentEncoding);
}
InputStream input = entity.getContent();
if (contentEncoding != null && contentEncoding.equalsIgnoreCase("gzip")) {//GZIP是使用DEFLATE进行压缩数据的另一个压缩库
input = new GZIPInputStream(entity.getContent());
} else if (contentEncoding != null && contentEncoding.equalsIgnoreCase("deflate")) {//DEFLATE是一个无专利的压缩算法它可以实现无损数据压缩
Inflater inflater = new Inflater(true);
input = new InflaterInputStream(entity.getContent(), inflater);
}
try {
InputStreamReader isr = new InputStreamReader(input);
BufferedReader br = new BufferedReader(isr);//是一个包装类,它可以包装字符流,将字符流放入缓存里,先把字符读到缓存里,到缓存满了时候,再读入内存,是为了提供读的效率而设计的
StringBuilder sb = new StringBuilder();
while (true) {
String buff = br.readLine();
if (buff == null) {
return sb.toString();
}
sb = sb.append(buff);
}
} finally {
input.close();
}
}
/*JSON
* jsonjs
* UrlEncodedFormEntity entityhttpPost.setEntity(entity)jshttpPost
* 使getResponseContent
* json
*/
private JSONObject postRequest(JSONObject js) throws NetworkFailureException {
if (!mLoggedin) {//未登录
Log.e(TAG, "please login first");
throw new ActionFailureException("not logged in");
}
//实例化一个httpPost的对象用来向服务器传输数据在这里就是发送请求而请求的内容在js里
HttpPost httpPost = createHttpPost();
try {
LinkedList<BasicNameValuePair> list = new LinkedList<BasicNameValuePair>();
list.add(new BasicNameValuePair("r", js.toString()));
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(list, "UTF-8"); //UrlEncodedFormEntity()的形式比较单一,是普通的键值对
httpPost.setEntity(entity);
// execute the post
//执行这个请求
HttpResponse response = mHttpClient.execute(httpPost);
String jsString = getResponseContent(response.getEntity());
return new JSONObject(jsString);
} catch (ClientProtocolException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new NetworkFailureException("postRequest failed");
} catch (IOException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new NetworkFailureException("postRequest failed");
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new ActionFailureException("unable to convert response content to jsonobject");
} catch (Exception e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new ActionFailureException("error occurs when posting request");
}
}
/*
* .gtask.data.TaskTask
* jsonTask,jsPost
* postRequest
* 使task.setGidtasknew_ID
*/
public void createTask(Task task) throws NetworkFailureException {
commitUpdate();
try {
JSONObject jsPost = new JSONObject();
JSONArray actionList = new JSONArray();
// action_list
actionList.put(task.getCreateAction(getActionId()));
jsPost.put(GTaskStringUtils.GTASK_JSON_ACTION_LIST, actionList);
// client_version
jsPost.put(GTaskStringUtils.GTASK_JSON_CLIENT_VERSION, mClientVersion);
// post
JSONObject jsResponse = postRequest(jsPost);
JSONObject jsResult = (JSONObject) jsResponse.getJSONArray(
GTaskStringUtils.GTASK_JSON_RESULTS).get(0);
task.setGid(jsResult.getString(GTaskStringUtils.GTASK_JSON_NEW_ID));
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new ActionFailureException("create task: handing jsonobject failed");
}
}
/*
* createTasktasklistgid
*/
public void createTaskList(TaskList tasklist) throws NetworkFailureException {
commitUpdate();
try {
JSONObject jsPost = new JSONObject();
JSONArray actionList = new JSONArray();
// action_list
actionList.put(tasklist.getCreateAction(getActionId()));
jsPost.put(GTaskStringUtils.GTASK_JSON_ACTION_LIST, actionList);
// client version
jsPost.put(GTaskStringUtils.GTASK_JSON_CLIENT_VERSION, mClientVersion);
// post
JSONObject jsResponse = postRequest(jsPost);
JSONObject jsResult = (JSONObject) jsResponse.getJSONArray(
GTaskStringUtils.GTASK_JSON_RESULTS).get(0);
tasklist.setGid(jsResult.getString(GTaskStringUtils.GTASK_JSON_NEW_ID));
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new ActionFailureException("create tasklist: handing jsonobject failed");
}
}
/*
*
* 使JSONObject使jsPost.putPutUpdateArrayClientVersion
* 使postRequestjspost,
*/
public void commitUpdate() throws NetworkFailureException {
if (mUpdateArray != null) {
try {
JSONObject jsPost = new JSONObject();
// action_list
jsPost.put(GTaskStringUtils.GTASK_JSON_ACTION_LIST, mUpdateArray);
// client_version
jsPost.put(GTaskStringUtils.GTASK_JSON_CLIENT_VERSION, mClientVersion);
postRequest(jsPost);
mUpdateArray = null;
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new ActionFailureException("commit update: handing jsonobject failed");
}
}
}
/*
*
* commitUpdate()
*/
public void addUpdateNode(Node node) throws NetworkFailureException {
if (node != null) {
// too many update items may result in an error
// set max to 10 items
if (mUpdateArray != null && mUpdateArray.length() > 10) {
commitUpdate();
}
if (mUpdateArray == null)
mUpdateArray = new JSONArray();
mUpdateArray.put(node.getUpdateAction(getActionId()));
}
}
/*
* task,tasktask
* getGidtaskgid
* JSONObject.put(String name, Object value)task
* postRequest
*/
public void moveTask(Task task, TaskList preParent, TaskList curParent)
throws NetworkFailureException {
commitUpdate();
try {
JSONObject jsPost = new JSONObject();
JSONArray actionList = new JSONArray();
JSONObject action = new JSONObject();
// action_list
action.put(GTaskStringUtils.GTASK_JSON_ACTION_TYPE,
GTaskStringUtils.GTASK_JSON_ACTION_TYPE_MOVE);
action.put(GTaskStringUtils.GTASK_JSON_ACTION_ID, getActionId());
action.put(GTaskStringUtils.GTASK_JSON_ID, task.getGid());
if (preParent == curParent && task.getPriorSibling() != null) {
// put prioring_sibing_id only if moving within the tasklist and
// it is not the first one
//设置优先级ID只有当移动是发生在文件中
action.put(GTaskStringUtils.GTASK_JSON_PRIOR_SIBLING_ID, task.getPriorSibling());
}
action.put(GTaskStringUtils.GTASK_JSON_SOURCE_LIST, preParent.getGid()); //设置移动前所属列表
action.put(GTaskStringUtils.GTASK_JSON_DEST_PARENT, curParent.getGid()); //设置当前所属列表
if (preParent != curParent) {
// put the dest_list only if moving between tasklists
action.put(GTaskStringUtils.GTASK_JSON_DEST_LIST, curParent.getGid());
}
actionList.put(action);
//最后将ACTION_LIST加入到jsPost中
jsPost.put(GTaskStringUtils.GTASK_JSON_ACTION_LIST, actionList);
// client_version
jsPost.put(GTaskStringUtils.GTASK_JSON_CLIENT_VERSION, mClientVersion);
postRequest(jsPost);
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new ActionFailureException("move task: handing jsonobject failed");
}
}
/*
*
* JSON
* 使postRequest
*/
public void deleteNode(Node node) throws NetworkFailureException {
commitUpdate();
try {
JSONObject jsPost = new JSONObject();
JSONArray actionList = new JSONArray();
// action_list
node.setDeleted(true);
actionList.put(node.getUpdateAction(getActionId())); //这里会获取到删除操作的ID加入到actionLiast中
jsPost.put(GTaskStringUtils.GTASK_JSON_ACTION_LIST, actionList);
// client_version
jsPost.put(GTaskStringUtils.GTASK_JSON_CLIENT_VERSION, mClientVersion);
postRequest(jsPost);
mUpdateArray = null;
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new ActionFailureException("delete node: handing jsonobject failed");
}
}
/*
*
* GetURI使getResponseContent
* "_setup(")}</script>GTASK_JSON_LISTS
*/
public JSONArray getTaskLists() throws NetworkFailureException {
if (!mLoggedin) {
Log.e(TAG, "please login first");
throw new ActionFailureException("not logged in");
}
try {
HttpGet httpGet = new HttpGet(mGetUrl);
HttpResponse response = null;
response = mHttpClient.execute(httpGet);
// get the task list
//筛选工作把筛选出的字符串放入jsString
String resString = getResponseContent(response.getEntity());
String jsBegin = "_setup(";
String jsEnd = ")}</script>";
int begin = resString.indexOf(jsBegin);
int end = resString.lastIndexOf(jsEnd);
String jsString = null;
if (begin != -1 && end != -1 && begin < end) {
jsString = resString.substring(begin + jsBegin.length(), end);
}
JSONObject js = new JSONObject(jsString);
//获取GTASK_JSON_LISTS
return js.getJSONObject("t").getJSONArray(GTaskStringUtils.GTASK_JSON_LISTS);
} catch (ClientProtocolException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new NetworkFailureException("gettasklists: httpget failed");
} catch (IOException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new NetworkFailureException("gettasklists: httpget failed");
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new ActionFailureException("get task lists: handing jasonobject failed");
}
}
/*
* TASKListgid,
*/
public JSONArray getTaskList(String listGid) throws NetworkFailureException {
commitUpdate();
try {
JSONObject jsPost = new JSONObject();
JSONArray actionList = new JSONArray();
JSONObject action = new JSONObject();
// action_list
action.put(GTaskStringUtils.GTASK_JSON_ACTION_TYPE,
GTaskStringUtils.GTASK_JSON_ACTION_TYPE_GETALL);
action.put(GTaskStringUtils.GTASK_JSON_ACTION_ID, getActionId());
action.put(GTaskStringUtils.GTASK_JSON_LIST_ID, listGid); //这里设置为传入的listGid
action.put(GTaskStringUtils.GTASK_JSON_GET_DELETED, false);
actionList.put(action);
jsPost.put(GTaskStringUtils.GTASK_JSON_ACTION_LIST, actionList);
// client_version
jsPost.put(GTaskStringUtils.GTASK_JSON_CLIENT_VERSION, mClientVersion);
JSONObject jsResponse = postRequest(jsPost);
return jsResponse.getJSONArray(GTaskStringUtils.GTASK_JSON_TASKS);
} catch (JSONException e) {
Log.e(TAG, e.toString());
e.printStackTrace();
throw new ActionFailureException("get task list: handing jsonobject failed");
}
}
public Account getSyncAccount() {
return mAccount;
}
//重置更新的内容
public void resetUpdateArray() {
mUpdateArray = null;
}
}

@ -1,2 +0,0 @@
#Fri Mar 24 15:00:13 CST 2023
gradle.version=7.5

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RenderSettings">
<option name="showDecorations" value="true" />
</component>
</project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>

@ -1,2 +0,0 @@
appMetadataVersion=1.1
androidGradlePluginVersion=7.4.2

@ -1,96 +0,0 @@
#Fri Apr 14 16:51:59 CST 2023
net.micode.notes.app-main-7\:/drawable-hdpi/font_super.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_font_super.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/call_record.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_call_record.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/new_note_normal.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_new_note_normal.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_yellow.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_yellow.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_title_green.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_title_green.9.png.flat
net.micode.notes.app-main-7\:/menu/sub_folder.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\menu_sub_folder.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_title_yellow.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_title_yellow.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/font_small.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_font_small.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_2x_white.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_2x_white.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_white.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_white.9.png.flat
net.micode.notes.app-main-7\:/layout/account_dialog_title.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\layout_account_dialog_title.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_4x_green.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_4x_green.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_blue_down.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_blue_down.9.png.flat
net.micode.notes.app-main-7\:/color/secondary_text_dark.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\color_secondary_text_dark.xml.flat
net.micode.notes.app-main-7\:/layout/dialog_edit_text.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\layout_dialog_edit_text.xml.flat
net.micode.notes.app-main-7\:/layout/widget_4x.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\layout_widget_4x.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_yellow_middle.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_yellow_middle.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/menu_delete.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_menu_delete.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/clock.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_clock.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/font_normal.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_font_normal.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/dropdown_icon.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_dropdown_icon.9.png.flat
net.micode.notes.app-main-7\:/layout/note_edit.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\layout_note_edit.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_green.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_green.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_green_single.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_green_single.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_white_single.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_white_single.9.png.flat
net.micode.notes.app-main-7\:/raw-zh-rCN/introduction=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\raw-zh-rCN_introduction.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_2x_green.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_2x_green.png.flat
net.micode.notes.app-main-7\:/xml/preferences.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\xml_preferences.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_red_single.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_red_single.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/delete.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_delete.png.flat
net.micode.notes.app-main-7\:/menu/call_record_folder.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\menu_call_record_folder.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_2x_red.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_2x_red.png.flat
net.micode.notes.app-main-7\:/layout/widget_2x.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\layout_widget_2x.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/menu_move.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_menu_move.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_green_down.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_green_down.9.png.flat
net.micode.notes.app-main-7\:/layout/note_edit_list_item.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\layout_note_edit_list_item.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_2x_blue.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_2x_blue.png.flat
net.micode.notes.app-main-7\:/layout/add_account_text.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\layout_add_account_text.xml.flat
net.micode.notes.app-main-7\:/xml/widget_4x_info.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\xml_widget_4x_info.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/font_size_selector_bg.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_font_size_selector_bg.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/selected.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_selected.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/search_result.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_search_result.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_4x_white.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_4x_white.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_blue_middle.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_blue_middle.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_green_middle.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_green_middle.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_white_down.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_white_down.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_blue_single.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_blue_single.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/font_large.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_font_large.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_yellow_up.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_yellow_up.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_red_middle.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_red_middle.9.png.flat
net.micode.notes.app-main-7\:/layout/settings_header.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\layout_settings_header.xml.flat
net.micode.notes.app-main-7\:/menu/note_list.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\menu_note_list.xml.flat
net.micode.notes.app-main-7\:/menu/call_note_edit.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\menu_call_note_edit.xml.flat
net.micode.notes.app-main-7\:/drawable/new_note.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable_new_note.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_red.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_red.9.png.flat
net.micode.notes.app-main-7\:/layout/note_list.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\layout_note_list.xml.flat
net.micode.notes.app-main-7\:/color/primary_text_dark.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\color_primary_text_dark.xml.flat
net.micode.notes.app-main-7\:/layout/datetime_picker.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\layout_datetime_picker.xml.flat
net.micode.notes.app-main-7\:/raw/introduction=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\raw_introduction.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_yellow_single.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_yellow_single.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_4x_yellow.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_4x_yellow.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_4x_red.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_4x_red.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/title_alert.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_title_alert.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_red_down.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_red_down.9.png.flat
net.micode.notes.app-main-7\:/menu/note_list_options.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\menu_note_list_options.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_2x_yellow.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_2x_yellow.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/icon_app.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_icon_app.png.flat
net.micode.notes.app-main-7\:/layout/note_item.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\layout_note_item.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_background.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_background.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_title_red.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_title_red.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/title_bar_bg.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_title_bar_bg.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_footer_bg.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_footer_bg.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/new_note_pressed.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_new_note_pressed.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_green_up.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_green_up.9.png.flat
net.micode.notes.app-main-7\:/layout/note_list_dropdown_menu.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\layout_note_list_dropdown_menu.xml.flat
net.micode.notes.app-main-7\:/layout/note_list_footer.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\layout_note_list_footer.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_red_up.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_red_up.9.png.flat
net.micode.notes.app-main-7\:/menu/note_list_dropdown.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\menu_note_list_dropdown.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_white_up.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_white_up.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_title_blue.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_title_blue.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/bg_color_btn_mask.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_bg_color_btn_mask.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_blue.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_blue.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/bg_btn_set_color.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_bg_btn_set_color.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_title_white.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_title_white.9.png.flat
net.micode.notes.app-main-7\:/xml/searchable.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\xml_searchable.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/notification.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_notification.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_blue_up.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_blue_up.9.png.flat
net.micode.notes.app-main-7\:/xml/widget_2x_info.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\xml_widget_2x_info.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/note_edit_color_selector_panel.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_note_edit_color_selector_panel.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_white_middle.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_white_middle.9.png.flat
net.micode.notes.app-main-7\:/layout/folder_list_item.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\layout_folder_list_item.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_folder.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_folder.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_4x_blue.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_4x_blue.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_yellow_down.9.png=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_yellow_down.9.png.flat
net.micode.notes.app-main-7\:/menu/note_edit.xml=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\menu_note_edit.xml.flat

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\gitProject\CJR_DXW_CYW\src\Notes-master1\app\src\main\assets"/><source path="D:\gitProject\CJR_DXW_CYW\src\Notes-master1\app\build\intermediates\shader_assets\debug\out"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\gitProject\CJR_DXW_CYW\src\Notes-master1\app\src\debug\assets"/></dataSet></merger>

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\gitProject\CJR_DXW_CYW\src\Notes-master1\app\src\main\jniLibs"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\gitProject\CJR_DXW_CYW\src\Notes-master1\app\src\debug\jniLibs"/></dataSet></merger>

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\gitProject\CJR_DXW_CYW\src\Notes-master1\app\src\main\shaders"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\gitProject\CJR_DXW_CYW\src\Notes-master1\app\src\debug\shaders"/></dataSet></merger>

@ -1,4 +0,0 @@
#Fri Apr 14 16:52:00 CST 2023
base.0=D\:\\gitProject\\CJR_DXW_CYW\\src\\Notes-master1\\app\\build\\intermediates\\dex\\debug\\mergeDexDebug\\classes.dex
renamed.0=classes.dex
path.0=classes.dex

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save