添加注释

b_branch
ynmlzdwsp 1 year ago
parent d4a66e755a
commit 89e24ef6f0

@ -1,21 +1,21 @@
>
java:S1604t"(Make this anonymous inner class a lambda(Éãî
?
java:S1604"(Make this anonymous inner class a lambda(Éãî
V java:S125"<This block of commented-out lines of code should be removed.(Í<C38D>¸ýÿÿÿÿ

java:S3008""eRename this field "GTASK_SYNC_NOTIFICATION_ID" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ëíÅÍúÿÿÿÿ
java:S3008%"eRename this field "GTASK_SYNC_NOTIFICATION_ID" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ëíÅÍúÿÿÿÿ
L
java:S1874 "1Remove this use of "AsyncTask"; it is deprecated.(¯ÚÔËúÿÿÿÿ
java:S1874#"1Remove this use of "AsyncTask"; it is deprecated.(¯ÚÔËúÿÿÿÿ
N
java:S3878="8Remove this array creation and simply pass the elements.(‘Àߎ
java:S3878D"8Remove this array creation and simply pass the elements.(‘Àߎ
M
java:S1874="7Remove this use of "publishProgress"; it is deprecated.(‘Àߎ
java:S1874D"7Remove this use of "publishProgress"; it is deprecated.(‘Àߎ
C
java:S1172B".Remove this unused method parameter "content".(ÖÔ¥R
java:S1172I".Remove this unused method parameter "content".(ÖÔ¥R
K
java:S1874E"0Remove this use of "defaults"; it is deprecated.(±æÝÈûÿÿÿÿ
V java:S125Q"<This block of commented-out lines of code should be removed.(ëœôùþÿÿÿÿ
java:S1874L"0Remove this use of "defaults"; it is deprecated.(±æÝÈûÿÿÿÿ
V java:S125X"<This block of commented-out lines of code should be removed.(ëœôùþÿÿÿÿ
e
java:S1874^"JDon't override a deprecated method or explicitly mark it as "@Deprecated".(ë•·ÿÿÿÿÿ
java:S1874k"JDon't override a deprecated method or explicitly mark it as "@Deprecated".(ë•·ÿÿÿÿÿ
e
java:S1874f"JDon't override a deprecated method or explicitly mark it as "@Deprecated".(÷ችûÿÿÿÿ
java:S1874w"JDon't override a deprecated method or explicitly mark it as "@Deprecated".(÷ችûÿÿÿÿ

@ -1,29 +1,29 @@
u
java:S2293Ï"YReplace the type specification in this constructor call with the diamond operator ("<>").(æå<C3A6>„þÿÿÿÿ
|
java:S2293Ö"YReplace the type specification in this constructor call with the diamond operator ("<>").(æå<C3A6>„þÿÿÿÿ8Ыâý«1
a
java:S2184t"FCast one of the operands of this multiplication operation to a "long".(癸<><EFBFBD><E69A9D><EFBFBD><EFBFBD>
T
java:S1874L"9Remove this use of "DefaultHttpClient"; it is deprecated.(覩レ<E8A6A9><E383AC><EFBFBD><EFBFBD><EFBFBD>
H
java:S1874è"2Remove this use of "HttpParams"; it is deprecated.(ŸÅE
java:S1874ï"2Remove this use of "HttpParams"; it is deprecated.(ŸÅE
M
java:S1874è"7Remove this use of "BasicHttpParams"; it is deprecated.(ŸÅE
java:S1874ï"7Remove this use of "BasicHttpParams"; it is deprecated.(ŸÅE
X
java:S1874é"<Remove this use of "HttpConnectionParams"; it is deprecated.(­Ú¬Ùùÿÿÿÿ
java:S1874ð"<Remove this use of "HttpConnectionParams"; it is deprecated.(­Ú¬Ùùÿÿÿÿ
X
java:S1874é"<Remove this use of "setConnectionTimeout"; it is deprecated.(­Ú¬Ùùÿÿÿÿ
java:S1874ð"<Remove this use of "setConnectionTimeout"; it is deprecated.(­Ú¬Ùùÿÿÿÿ
X
java:S1874ê"<Remove this use of "HttpConnectionParams"; it is deprecated.(åÙµÌûÿÿÿÿ
P
java:S1874ê"4Remove this use of "setSoTimeout"; it is deprecated.(åÙµÌûÿÿÿÿ
O
java:S1874ë"9Remove this use of "DefaultHttpClient"; it is deprecated.(ÛÔÇ/
java:S1874ñ"<Remove this use of "HttpConnectionParams"; it is deprecated.(åÙµÌûÿÿÿÿ
W
java:S1874ñ"4Remove this use of "setSoTimeout"; it is deprecated.(åÙµÌûÿÿÿÿ­âý«1
V
java:S1874î":Remove this use of "HttpProtocolParams"; it is deprecated.(Õêøÿÿÿÿÿ
F
java:S2093"*Change this "try" to a try-with-resources.(¡»¢üùÿÿÿÿ
\
java:S2147Ý"ECombine this catch with the one at line 345, which has the same body.(ï­£Ä
\
java:S2147œ"ECombine this catch with the one at line 536, which has the same body.(ï­£Ä
java:S1874ò"9Remove this use of "DefaultHttpClient"; it is deprecated.(ÛÔÇ/8¢­âý«1
]
java:S1874õ":Remove this use of "HttpProtocolParams"; it is deprecated.(Õêøÿÿÿÿÿ­âý«1
M
java:S2093½"*Change this "try" to a try-with-resources.(¡»¢üùÿÿÿÿ­âý«1
c
java:S2147ä"ECombine this catch with the one at line 352, which has the same body.(ﭣĭâý«1
c
java:S2147£"ECombine this catch with the one at line 543, which has the same body.(ﭣĭâý«1

@ -1,5 +1,5 @@
\
java:S2259¹"@A "NullPointerException" could be thrown; "js" is nullable here.(±ú”§ýÿÿÿÿ
i
java:S3776"RRefactor this method to reduce its Cognitive Complexity from 16 to the 15 allowed.(´ÇŽª
c
java:S2259Ì"@A "NullPointerException" could be thrown; "js" is nullable here.(±ú”§ýÿÿÿÿ8ŠÚ<EFBFBD>ü«1
p
java:S3776¥"RRefactor this method to reduce its Cognitive Complexity from 16 to the 15 allowed.(´ÇŽª8å³<EFBFBD>ü«1

@ -1,15 +1,15 @@
|
java:S2293<18>"YReplace the type specification in this constructor call with the diamond operator ("<>").(Ÿ“<C5B8>…üÿÿÿÿ8ƒ¯ê«1
|
java:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").(Ÿ“<C5B8>…üÿÿÿÿ8ƒ¯ê«1
|
java:S2293¢"YReplace the type specification in this constructor call with the diamond operator ("<>").(Ÿ“<C5B8>…üÿÿÿÿ8ƒ¯ê«1
9
java:S2386."Make this member "protected".(êÝÐu8Œ±ê«1
u
java:S2293<18>"YReplace the type specification in this constructor call with the diamond operator ("<>").(Ÿ“<C5B8>…üÿÿÿÿ
u
java:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").(Ÿ“<C5B8>…üÿÿÿÿ
u
java:S2293¢"YReplace the type specification in this constructor call with the diamond operator ("<>").(Ÿ“<C5B8>…üÿÿÿÿ
2
java:S2386."Make this member "protected".(êÝÐu
n
java:S3776å"RRefactor this method to reduce its Cognitive Complexity from 91 to the 15 allowed.(¸ŸêÉýÿÿÿÿ
h
java:S3776»"RRefactor this method to reduce its Cognitive Complexity from 32 to the 15 allowed.(ë®Æ
ã
java:S6541åA "Brain Method" was detected. Refactor it to reduce at least one of the following metrics: LOC from 116 to 64, Complexity from 51 to 14, Nesting Level from 6 to 2, Number of Variables from 23 to 6.(¸ŸêÉýÿÿÿÿ
java:S3776ï"RRefactor this method to reduce its Cognitive Complexity from 91 to the 15 allowed.(¸ŸêÉýÿÿÿÿ8<>±ê«1
o
java:S3776Ï"RRefactor this method to reduce its Cognitive Complexity from 32 to the 15 allowed.(ë®Æ8­™ê«1
ê
java:S6541ïA "Brain Method" was detected. Refactor it to reduce at least one of the following metrics: LOC from 116 to 64, Complexity from 51 to 14, Nesting Level from 6 to 2, Number of Variables from 23 to 6.(¸ŸêÉýÿÿÿÿ8°±ê«1

@ -149,3 +149,23 @@ k
;app/src/main/java/net/micode/notes/gtask/data/MetaData.java,c\1\c182d0c9c237ea8a46a92ccaae9bb5c751923a88
j
:app/src/main/java/net/micode/notes/data/NotesProvider.java,6\a\6a65e747031f27aef20597b4181148a9fbf963d5
g
7app/src/main/java/net/micode/notes/gtask/data/Node.java,3\a\3aac5305cb73bfbdeb8078cd264d04323fa80e92
j
:app/src/main/java/net/micode/notes/gtask/data/SqlData.java,9\3\934a4e2abf19d28a53f6aeb1dcd99248c44b6892
j
:app/src/main/java/net/micode/notes/gtask/data/SqlNote.java,f\1\f1226eeacd46c914d51f3d1a6d6f27377490d2a4
g
7app/src/main/java/net/micode/notes/gtask/data/Task.java,d\1\d187f1271655c3d91661a39fe6de395b6a9f290a
k
;app/src/main/java/net/micode/notes/gtask/data/TaskList.java,e\0\e094aec5c3e1b6f44539adff3114f5a1ad603ddc
~
Napp/src/main/java/net/micode/notes/gtask/exception/ActionFailureException.java,5\f\5f6162ca79fcea353b280c5dc84973a9c37d2c74

Oapp/src/main/java/net/micode/notes/gtask/exception/NetworkFailureException.java,0\f\0f0f0549145d0e2bfb972ba1ed2e2c38bfd6d1b1
s
Capp/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java,0\2\023468cfdd0b71d4098903b9070e364658e2fbcf
p
@app/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java,4\5\4529b3a97b0f3b19b895aa06f23bed63ff38a312
q
Aapp/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java,a\b\ab153b0256bc5f6c194e188cec0b8e327e347a90

@ -149,3 +149,23 @@ j
:app/src/main/java/net/micode/notes/data/NotesProvider.java,6\a\6a65e747031f27aef20597b4181148a9fbf963d5
k
;app/src/main/java/net/micode/notes/gtask/data/MetaData.java,c\1\c182d0c9c237ea8a46a92ccaae9bb5c751923a88
g
7app/src/main/java/net/micode/notes/gtask/data/Node.java,3\a\3aac5305cb73bfbdeb8078cd264d04323fa80e92
j
:app/src/main/java/net/micode/notes/gtask/data/SqlData.java,9\3\934a4e2abf19d28a53f6aeb1dcd99248c44b6892
j
:app/src/main/java/net/micode/notes/gtask/data/SqlNote.java,f\1\f1226eeacd46c914d51f3d1a6d6f27377490d2a4
g
7app/src/main/java/net/micode/notes/gtask/data/Task.java,d\1\d187f1271655c3d91661a39fe6de395b6a9f290a
k
;app/src/main/java/net/micode/notes/gtask/data/TaskList.java,e\0\e094aec5c3e1b6f44539adff3114f5a1ad603ddc
~
Napp/src/main/java/net/micode/notes/gtask/exception/ActionFailureException.java,5\f\5f6162ca79fcea353b280c5dc84973a9c37d2c74

Oapp/src/main/java/net/micode/notes/gtask/exception/NetworkFailureException.java,0\f\0f0f0549145d0e2bfb972ba1ed2e2c38bfd6d1b1
p
@app/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java,4\5\4529b3a97b0f3b19b895aa06f23bed63ff38a312
s
Capp/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java,0\2\023468cfdd0b71d4098903b9070e364658e2fbcf
q
Aapp/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java,a\b\ab153b0256bc5f6c194e188cec0b8e327e347a90

@ -54,6 +54,11 @@ public class Task extends Node {
mMetaInfo = null;
}
/**
* JSON
* @param actionId
* @return
*/
public JSONObject getCreateAction(int actionId) {
JSONObject js = new JSONObject();
@ -103,6 +108,12 @@ public class Task extends Node {
return js;
}
/**
* JSON
* @param actionId
* @return
*/
public JSONObject getUpdateAction(int actionId) {
JSONObject js = new JSONObject();
@ -135,6 +146,10 @@ public class Task extends Node {
return js;
}
/**
* JSON
* @param js
*/
public void setContentByRemoteJSON(JSONObject js) {
if (js != null) {
try {
@ -175,6 +190,10 @@ public class Task extends Node {
}
}
/**
* JSON
* @param js
*/
public void setContentByLocalJSON(JSONObject js) {
if (js == null || !js.has(GTaskStringUtils.META_HEAD_NOTE)
|| !js.has(GTaskStringUtils.META_HEAD_DATA)) {
@ -204,6 +223,10 @@ public class Task extends Node {
}
}
/**
* JSON
* @return
*/
public JSONObject getLocalJSONFromContent() {
String name = getName();
try {
@ -247,6 +270,10 @@ public class Task extends Node {
}
}
/**
*
* @param metaData
*/
public void setMetaInfo(MetaData metaData) {
if (metaData != null && metaData.getNotes() != null) {
try {
@ -258,6 +285,11 @@ public class Task extends Node {
}
}
/**
*
* @param c
* @return
*/
public int getSyncAction(Cursor c) {
try {
JSONObject noteInfo = null;
@ -311,6 +343,10 @@ public class Task extends Node {
return SYNC_ACTION_ERROR;
}
/**
*
* @return
*/
public boolean isWorthSaving() {
return mMetaInfo != null || (getName() != null && getName().trim().length() > 0)
|| (getNotes() != null && getNotes().trim().length() > 0);

@ -29,6 +29,9 @@ import net.micode.notes.ui.NotesListActivity;
import net.micode.notes.ui.NotesPreferenceActivity;
/**
*
*/
public class GTaskASyncTask extends AsyncTask<Void, String, Integer> {
private static int GTASK_SYNC_NOTIFICATION_ID = 5234235;
@ -57,6 +60,10 @@ public class GTaskASyncTask extends AsyncTask<Void, String, Integer> {
mTaskManager.cancelSync();
}
/**
*
* @param message
*/
public void publishProgess(String message) {
publishProgress(new String[] {
message
@ -83,6 +90,11 @@ public class GTaskASyncTask extends AsyncTask<Void, String, Integer> {
mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification);
}
/**
* 线
* @param unused
* @return
*/
@Override
protected Integer doInBackground(Void... unused) {
publishProgess(mContext.getString(R.string.sync_progress_login, NotesPreferenceActivity
@ -90,6 +102,7 @@ public class GTaskASyncTask extends AsyncTask<Void, String, Integer> {
return mTaskManager.sync(mContext, this);
}
@Override
protected void onProgressUpdate(String... progress) {
showNotification(R.string.ticker_syncing, progress[0]);
@ -98,6 +111,10 @@ public class GTaskASyncTask extends AsyncTask<Void, String, Integer> {
}
}
/**
*
* @param result
*/
@Override
protected void onPostExecute(Integer result) {
if (result == GTaskManager.STATE_SUCCESS) {

@ -114,10 +114,13 @@ public class GTaskClient {
// we suppose that the cookie would expire after 5 minutes
// then we need to re-login
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
@ -130,13 +133,16 @@ public class GTaskClient {
return true;
}
//更新最新登录时间为当前时间
mLastLoginTime = System.currentTimeMillis();
//调用loginGoogleAccount方法进行Google账户登录并获取认证令牌。
String authToken = loginGoogleAccount(activity, false);
if (authToken == null) {
Log.e(TAG, "login google account failed");
return false;
}
//如果不是以 "gmail.com" 或 "googlemail.com" 结尾的自定义域名账户则构建登录URL并使用tryToLoginGtask方法尝试登录
// login with custom domain if necessary
if (!(mAccount.name.toLowerCase().endsWith("gmail.com") || mAccount.name.toLowerCase()
.endsWith("googlemail.com"))) {
@ -152,6 +158,7 @@ public class GTaskClient {
}
}
//如果自定义域名登录失败则使用Google官方的登录URL并使用tryToLoginGtask方法尝试登录
// try to login with google official url
if (!mLoggedin) {
mGetUrl = GTASK_GET_URL;

@ -247,6 +247,10 @@ public class GTaskManager {
}
}
/**
* GTasks
* @throws NetworkFailureException
*/
private void syncContent() throws NetworkFailureException {
int syncType;
Cursor c = null;

Loading…
Cancel
Save