From dd6bdb875e04828b1d07b040cf179ed7184a9524 Mon Sep 17 00:00:00 2001 From: ynmlzdwsp <2727940448@qq.com> Date: Sat, 30 Sep 2023 11:34:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../32360bf24febc78f20db52498c7576b3d8650d56 | 4 +- .../6cbf8bd9aa98eff862b1dc067330ba66ba4493aa | 4 +- .../876016634c6642b35109680ccac740dc8271b236 | 6 +- .../a446c87b1013132f8adaf83656b582028e8809af | 8 +- .../ab153b0256bc5f6c194e188cec0b8e327e347a90 | 22 +- .../ad72331a1bed265bb9c0fe838faa74dbf69fce32 | 188 ++++++++---------- .idea/sonarlint/issuestore/index.pb | 48 ++++- .idea/sonarlint/securityhotspotstore/index.pb | 48 ++++- .../micode/notes/ui/NotesListActivity.java | 71 ++++++- 9 files changed, 269 insertions(+), 130 deletions(-) diff --git a/.idea/sonarlint/issuestore/3/2/32360bf24febc78f20db52498c7576b3d8650d56 b/.idea/sonarlint/issuestore/3/2/32360bf24febc78f20db52498c7576b3d8650d56 index 5879af3..ac3ea31 100644 --- a/.idea/sonarlint/issuestore/3/2/32360bf24febc78f20db52498c7576b3d8650d56 +++ b/.idea/sonarlint/issuestore/3/2/32360bf24febc78f20db52498c7576b3d8650d56 @@ -18,9 +18,9 @@ java:S1319S"`The type of "ids" should be an interface such as "Set" rather than  java:S1319"mThe return type of this method should be an interface such as "Set" rather than the implementation "HashSet".( S -java:S2589>"8Remove this expression which always evaluates to "false"(Ύ -S java:S2589e"8Remove this expression which always evaluates to "false"(Ύ +S +java:S2589>"8Remove this expression which always evaluates to "false"(Ύ U java:S1118&":Add a private constructor to hide the implicit public one.( T diff --git a/.idea/sonarlint/issuestore/6/c/6cbf8bd9aa98eff862b1dc067330ba66ba4493aa b/.idea/sonarlint/issuestore/6/c/6cbf8bd9aa98eff862b1dc067330ba66ba4493aa index bdfcc68..fb3fece 100644 --- a/.idea/sonarlint/issuestore/6/c/6cbf8bd9aa98eff862b1dc067330ba66ba4493aa +++ b/.idea/sonarlint/issuestore/6/c/6cbf8bd9aa98eff862b1dc067330ba66ba4493aa @@ -6,6 +6,4 @@ java:S1604L"(Make this anonymous inner class a lambda(Ҵѝ C java:S1604v"(Make this anonymous inner class a lambda(ё ? -java:S1604"(Make this anonymous inner class a lambda( -V -java:S3398"?Move this method into the anonymous class declared at line 118.( \ No newline at end of file +java:S1604"(Make this anonymous inner class a lambda( \ No newline at end of file diff --git a/.idea/sonarlint/issuestore/8/7/876016634c6642b35109680ccac740dc8271b236 b/.idea/sonarlint/issuestore/8/7/876016634c6642b35109680ccac740dc8271b236 index cc88819..cee8356 100644 --- a/.idea/sonarlint/issuestore/8/7/876016634c6642b35109680ccac740dc8271b236 +++ b/.idea/sonarlint/issuestore/8/7/876016634c6642b35109680ccac740dc8271b236 @@ -1,11 +1,11 @@ F -java:S1066"/Merge this if statement with the enclosing one.( +java:S1066"/Merge this if statement with the enclosing one.( 3 java:S2386A"Make this member "protected".( 8 java:S2386K"Make this member "protected".(㳎 X -java:S1126"AReplace this if-then-else statement by a single return statement.( +java:S1126"AReplace this if-then-else statement by a single return statement.( ? -java:S1125"(Remove the unnecessary boolean literals.( \ No newline at end of file +java:S1125"(Remove the unnecessary boolean literals.( \ No newline at end of file diff --git a/.idea/sonarlint/issuestore/a/4/a446c87b1013132f8adaf83656b582028e8809af b/.idea/sonarlint/issuestore/a/4/a446c87b1013132f8adaf83656b582028e8809af index 9975d96..5dcc2d5 100644 --- a/.idea/sonarlint/issuestore/a/4/a446c87b1013132f8adaf83656b582028e8809af +++ b/.idea/sonarlint/issuestore/a/4/a446c87b1013132f8adaf83656b582028e8809af @@ -7,9 +7,5 @@ java:S3776 \ java:S2147"ECombine this catch with the one at line 301, which has the same body.(ߝȴ \ -java:S2147"ECombine this catch with the one at line 334, which has the same body.(ﭣ -] java:S899"BDo something with the "boolean" value returned by "createNewFile".(А -? -java:S3398"#Move this method into "TextExport".( -9 -java:S3398H"#Move this method into "TextExport".( \ No newline at end of file +java:S2147"ECombine this catch with the one at line 335, which has the same body.(ﭣ +] java:S899"BDo something with the "boolean" value returned by "createNewFile".(А \ No newline at end of file diff --git a/.idea/sonarlint/issuestore/a/b/ab153b0256bc5f6c194e188cec0b8e327e347a90 b/.idea/sonarlint/issuestore/a/b/ab153b0256bc5f6c194e188cec0b8e327e347a90 index d470860..5b20ba7 100644 --- a/.idea/sonarlint/issuestore/a/b/ab153b0256bc5f6c194e188cec0b8e327e347a90 +++ b/.idea/sonarlint/issuestore/a/b/ab153b0256bc5f6c194e188cec0b8e327e347a90 @@ -12,11 +12,11 @@ java:S2293b"YReplace the type specification in this constructor call with the d t java:S2293c"YReplace the type specification in this constructor call with the diamond operator ("<>").( ] -java:S1192"FDefine a constant instead of duplicating this literal " DESC" 3 times.(Ա +java:S1192"FDefine a constant instead of duplicating this literal " DESC" 3 times.(Ա K java:S1066"/Merge this if statement with the enclosing one.( K -java:S1066"/Merge this if statement with the enclosing one.(˼֓ +java:S1066"/Merge this if statement with the enclosing one.(˼֓ i java:S3776"RRefactor this method to reduce its Cognitive Complexity from 29 to the 15 allowed.(þ I @@ -24,20 +24,20 @@ java:S1905 C java:S1905"-Remove this unnecessary cast to "JSONObject".(؛ i -java:S3776"RRefactor this method to reduce its Cognitive Complexity from 28 to the 15 allowed.( +java:S3776"RRefactor this method to reduce its Cognitive Complexity from 28 to the 15 allowed.( n -java:S3776"RRefactor this method to reduce its Cognitive Complexity from 41 to the 15 allowed.(˰ +java:S3776"RRefactor this method to reduce its Cognitive Complexity from 41 to the 15 allowed.(˰ n -java:S3776"RRefactor this method to reduce its Cognitive Complexity from 34 to the 15 allowed.(ɸ +java:S3776"RRefactor this method to reduce its Cognitive Complexity from 34 to the 15 allowed.(ɸ 5 -java:S2129"Remove this "Long" constructor(ϭ +java:S2129"Remove this "Long" constructor(ϭ C -java:S1874",Remove this use of "Long"; it is deprecated.(ϭ +java:S1874",Remove this use of "Long"; it is deprecated.(ϭ n -java:S3776"RRefactor this method to reduce its Cognitive Complexity from 20 to the 15 allowed.(ƶؠ +java:S3776"RRefactor this method to reduce its Cognitive Complexity from 20 to the 15 allowed.(ƶؠ G -java:S1172"+Remove this unused method parameter "node".(ƶؠ +java:S1172"+Remove this unused method parameter "node".(ƶؠ C -java:S1905"'Remove this unnecessary cast to "Node".( +java:S1905"'Remove this unnecessary cast to "Node".( > -java:S1905"'Remove this unnecessary cast to "Node".( \ No newline at end of file +java:S1905"'Remove this unnecessary cast to "Node".( \ No newline at end of file diff --git a/.idea/sonarlint/issuestore/a/d/ad72331a1bed265bb9c0fe838faa74dbf69fce32 b/.idea/sonarlint/issuestore/a/d/ad72331a1bed265bb9c0fe838faa74dbf69fce32 index 708e66b..cb9f12a 100644 --- a/.idea/sonarlint/issuestore/a/d/ad72331a1bed265bb9c0fe838faa74dbf69fce32 +++ b/.idea/sonarlint/issuestore/a/d/ad72331a1bed265bb9c0fe838faa74dbf69fce32 @@ -1,107 +1,95 @@ -p -java:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").(艥 -> -java:S1604"(Make this anonymous inner class a lambda(̺V -? -java:S1604"(Make this anonymous inner class a lambda(ά -? -java:S1604"(Make this anonymous inner class a lambda(ܴ -D -java:S1604"(Make this anonymous inner class a lambda( -? -java:S1604"(Make this anonymous inner class a lambda( -? -java:S1604"(Make this anonymous inner class a lambda(۱ -? -java:S1604"(Make this anonymous inner class a lambda(ά -g -java:S1301"KReplace this "switch" statement by "if" statements to increase readability.(ד -7 -java:S1116`"Remove this empty statement.( -a -java:S1124"EReorder the modifiers to comply with the Java Language Specification.( -[ -java:S1124"EReorder the modifiers to comply with the Java Language Specification.(Ѿk -n -java:S3776"RRefactor this method to reduce its Cognitive Complexity from 17 to the 15 allowed.( -2 -java:S3626"Remove this redundant jump.(݅ -2 -java:S3626"Remove this redundant jump.(݅ -2 -java:S3626"Remove this redundant jump.(݅ -P -java:S1874"9Remove this use of "PreferenceManager"; it is deprecated.(­ -Z -java:S1874"CRemove this use of "getDefaultSharedPreferences"; it is deprecated.(­ -N -java:S1135"2Complete the task associated to this TODO comment.(̐ +w +java:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").(艥81 +E +java:S1604"(Make this anonymous inner class a lambda(̺V81 F -java:S2093"*Change this "try" to a try-with-resources.( -o -java:S1450"XRemove the "mMoveMenu" field and declare it as a local variable in the relevant methods.( -j -java:S1450"SRemove the "menu" field and declare it as a local variable in the relevant methods.( +java:S1604"(Make this anonymous inner class a lambda(ά81 +F +java:S1604"(Make this anonymous inner class a lambda(ܴ81 +K +java:S1604"(Make this anonymous inner class a lambda(81 +F +java:S1604"(Make this anonymous inner class a lambda(81 +F +java:S1604"(Make this anonymous inner class a lambda(۱81 +F +java:S1604"(Make this anonymous inner class a lambda(ά81 n -java:S3252"RUse static access with "android.widget.AbsListView" for "MultiChoiceModeListener".( -N -java:S1135"2Complete the task associated to this TODO comment.( -N -java:S1135"2Complete the task associated to this TODO comment.( -F java:S106"+Replace this use of System.out by a logger.( -R java:S125""; it is deprecated.(? -? java:S108")Either remove or fill this block of code.(ʥ -a -java:S1874"JDon't override a deprecated method or explicitly mark it as "@Deprecated".(Ϳ -K -java:S1874"/Remove this use of "execute"; it is deprecated.(嫏 -S -java:S1874"7Remove this use of "toggleSoftInput"; it is deprecated.( -O -java:S1874"3Remove this use of "SHOW_FORCED"; it is deprecated.( -h -java:S3776"RRefactor this method to reduce its Cognitive Complexity from 17 to the 15 allowed.(# -N -java:S1135"2Complete the task associated to this TODO comment.( -^ -java:S1126"BReplace this if-then-else statement by a single method invocation.(玒 -N -java:S1135"2Complete the task associated to this TODO comment.( -f -java:S1874"JDon't override a deprecated method or explicitly mark it as "@Deprecated".( -A java:S106"+Replace this use of System.out by a logger.(Ί -F java:S106"+Replace this use of System.out by a logger.( -Q -java:S1874"5Remove this use of "onBackPressed"; it is deprecated.( +java:S2093"*Change this "try" to a try-with-resources.(81 +v +java:S1450"XRemove the "mMoveMenu" field and declare it as a local variable in the relevant methods.(81 +q +java:S1450"SRemove the "menu" field and declare it as a local variable in the relevant methods.(81 +u +java:S3252"RUse static access with "android.widget.AbsListView" for "MultiChoiceModeListener".(81 +U +java:S1135"2Complete the task associated to this TODO comment.(81 +U +java:S1135"2Complete the task associated to this TODO comment.(81 +M java:S106"+Replace this use of System.out by a logger.(81 +Y java:S125""; it is deprecated.(Ч -f -java:S1874"JDon't override a deprecated method or explicitly mark it as "@Deprecated".(ች -K -java:S1874"/Remove this use of "execute"; it is deprecated.(嫏 +java:S1874".Remove this use of ""; it is deprecated.(?8؞1 +F java:S108")Either remove or fill this block of code.(ʥ8؞1 h -java:S3776"RRefactor this method to reduce its Cognitive Complexity from 18 to the 15 allowed.(b -d java:S100"NRename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(Ҏ -B -java:S1172"+Remove this unused method parameter "view".(Ҏ -K -java:S3398"/Move this method into "BackgroundQueryHandler".( -G -java:S3398"0Move this method into "OnListItemClickListener".( -< -java:S3398"%Move this method into "ModeCallback".( -A -java:S3398"%Move this method into "ModeCallback".( \ No newline at end of file +java:S1874"JDon't override a deprecated method or explicitly mark it as "@Deprecated".(Ϳ8؞1 +R +java:S1874"/Remove this use of "execute"; it is deprecated.(嫏8؞1 +Z +java:S1874"7Remove this use of "toggleSoftInput"; it is deprecated.(8؞1 +V +java:S1874"3Remove this use of "SHOW_FORCED"; it is deprecated.(8؞1 +o +java:S3776"RRefactor this method to reduce its Cognitive Complexity from 17 to the 15 allowed.(#8؞1 +U +java:S1135"2Complete the task associated to this TODO comment.(8„؞1 +e +java:S1126"BReplace this if-then-else statement by a single method invocation.(玒8Ä؞1 +U +java:S1135"2Complete the task associated to this TODO comment.(8Ä؞1 +m +java:S1874"JDon't override a deprecated method or explicitly mark it as "@Deprecated".(8Ą؞1 +H java:S106"+Replace this use of System.out by a logger.(Ί8Ą؞1 +M java:S106"+Replace this use of System.out by a logger.(8ń؞1 +X +java:S1874"5Remove this use of "onBackPressed"; it is deprecated.(8Ƅ؞1 +Q +java:S1874".Remove this use of ""; it is deprecated.(Ч8ф؞1 +m +java:S1874"JDon't override a deprecated method or explicitly mark it as "@Deprecated".(ች8҄؞1 +R +java:S1874"/Remove this use of "execute"; it is deprecated.(嫏8Ԅ؞1 +o +java:S3776"RRefactor this method to reduce its Cognitive Complexity from 18 to the 15 allowed.(b8ք؞1 +k java:S100"NRename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(Ҏ8ڄ؞1 +I +java:S1172"+Remove this unused method parameter "view".(Ҏ8ڄ؞1 \ No newline at end of file diff --git a/.idea/sonarlint/issuestore/index.pb b/.idea/sonarlint/issuestore/index.pb index 5177437..06f3fbd 100644 --- a/.idea/sonarlint/issuestore/index.pb +++ b/.idea/sonarlint/issuestore/index.pb @@ -168,4 +168,50 @@ Capp/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java,0\2\023468 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 \ No newline at end of file +Aapp/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java,a\b\ab153b0256bc5f6c194e188cec0b8e327e347a90 +u +Eapp/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java,f\0\f087b1ba1b9c91b7293fea0fb071eaed62a42137 +b +2app/src/main/java/net/micode/notes/model/Note.java,d\d\dd970bd8ce083850fca1d4d159647ccd110e57cb +f +6app/src/main/java/net/micode/notes/tool/DataUtils.java,3\2\32360bf24febc78f20db52498c7576b3d8650d56 +m +=app/src/main/java/net/micode/notes/tool/GTaskStringUtils.java,c\4\c42ad3cd6e664963fa1849c760a57d417d500ee7 +k +;app/src/main/java/net/micode/notes/tool/ResourceParser.java,c\6\c65f5dc8218ef1da6f6bfb5d1b14aea855a54d7f +P + app/src/main/AndroidManifest.xml,8\c\8c55c3ccc257e5907959013f99656e4c8ec3903e +h +8app/src/main/java/net/micode/notes/tool/BackupUtils.java,a\4\a446c87b1013132f8adaf83656b582028e8809af +i +9app/src/main/java/net/micode/notes/model/WorkingNote.java,8\7\876016634c6642b35109680ccac740dc8271b236 +l +>() { @@ -606,6 +645,9 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt } } + /** + * 显示软键盘 + */ private void showSoftInput() { InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); if (inputMethodManager != null) { @@ -618,6 +660,11 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); } + + /** + * 显示创建或编辑文件夹对话框 + * @param create + */ private void showCreateOrModifyFolderDialog(final boolean create) { final AlertDialog.Builder builder = new AlertDialog.Builder(this); View view = LayoutInflater.from(this).inflate(R.layout.dialog_edit_text, null); @@ -731,6 +778,11 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt } } + /** + * 更新指定标识的小部件 + * @param appWidgetId + * @param appWidgetType + */ private void updateWidget(int appWidgetId, int appWidgetType) { Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE); if (appWidgetType == Notes.TYPE_WIDGET_2X) { @@ -750,6 +802,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt setResult(RESULT_OK, intent); } + private final OnCreateContextMenuListener mFolderOnCreateContextMenuListener = new OnCreateContextMenuListener() { public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { if (mFocusNoteDataItem != null) { @@ -803,6 +856,11 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt return true; } + /** + * 根据当前状态 mState 的不同,在菜单准备显示时根据状态填充不同的菜单项,并根据条件设置指定菜单项的标题。 + * @param menu + * @return + */ @Override public boolean onPrepareOptionsMenu(Menu menu) { menu.clear(); @@ -867,6 +925,10 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt return true; } + /** + * 导出笔记到文本文件 + */ + @SuppressLint("StaticFieldLeak") private void exportNoteToText() { final BackupUtils backup = BackupUtils.getInstance(NotesListActivity.this); new AsyncTask() { @@ -960,6 +1022,9 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt } + /** + * 查询目标文件夹列表 + */ private void startQueryDestinationFolders() { String selection = NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>? AND " + NoteColumns.ID + "<>?"; selection = (mState == ListEditState.NOTE_LIST) ? selection: