对FoldersListAdapter.java进行阅读理解以及添加注释

Signed-off-by: qianji <1535486312@qq.com>
a_branch
qianji 3 years ago
parent 9cf78e01ed
commit e3b841371a

@ -0,0 +1,10 @@
E
java:S1604*"(Make this anonymous inner class a lambda(í˽ý¦<E28099>1
o java:S100"NRename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(¦Ÿ¦×ýÿÿÿÿ¦<E28099>1

java:S3923P"]This conditional operation returns the same value whether the condition is "true" or "false".(Ýç®Üÿÿÿÿÿ¦<E28099>1
W
java:S1874P"5Remove this use of "FORMAT_24HOUR"; it is deprecated.(Ýç®Üÿÿÿÿÿ¦<E28099>1
W
java:S1874P"5Remove this use of "FORMAT_24HOUR"; it is deprecated.(Ýç®Üÿÿÿÿÿ¦<E28099>1

@ -0,0 +1,23 @@
t
java:S22937"YReplace the type specification in this constructor call with the diamond operator ("<>").(áºÐ»ûÿÿÿÿ
t
java:S2293b"YReplace the type specification in this constructor call with the diamond operator ("<>").(áºÐ»ûÿÿÿÿ
u
java:S2293Ø"YReplace the type specification in this constructor call with the diamond operator ("<>").(Ûª¡úÿÿÿÿ
v
java:S1319-"`The type of "ids" should be an interface such as "Set" rather than the implementation "HashSet".(îîè“
{
java:S1319["`The type of "ids" should be an interface such as "Set" rather than the implementation "HashSet".(󆱋ÿÿÿÿÿ

java:S1319Î"mThe return type of this method should be an interface such as "Set" rather than the implementation "HashSet".(ÛëÈðýÿÿÿÿ
S
java:S2589C"8Remove this expression which always evaluates to "false"(ÎŽŽéûÿÿÿÿ
S
java:S2589m"8Remove this expression which always evaluates to "false"(ÎŽŽéûÿÿÿÿ
T
java:S11552">Use isEmpty() to check whether the collection is empty or not.(´¤”Ó
Z
java:S2147L"DCombine this catch with the one at line 73, which has the same body.(æš©›
[
java:S2147t"ECombine this catch with the one at line 114, which has the same body.(æš©›

@ -0,0 +1,13 @@
o
java:S22931"YReplace the type specification in this constructor call with the diamond operator ("<>").(§þ¢¾
D
java:S1604Ò"(Make this anonymous inner class a lambda(¯<>Àžÿÿÿÿÿ
f
java:S1301h"KReplace this "switch" statement by "if" statements to increase readability.(ãÁð™øÿÿÿÿ
M
java:S1135c"2Complete the task associated to this TODO comment.(ƒŠ® úÿÿÿÿ
^
java:S1126±"BReplace this if-then-else statement by a single method invocation.(‚å¿¥ûÿÿÿÿ
P
java:S2864Æ"4Iterate over the "entrySet" instead of the "keySet".(ΚŸ<C5A1>ûÿÿÿÿ

@ -0,0 +1,67 @@
t
java:S2293W"YReplace the type specification in this constructor call with the diamond operator ("<>").(ÑÓ<C391>¥üÿÿÿÿ
t
java:S2293`"YReplace the type specification in this constructor call with the diamond operator ("<>").(®ú÷õþÿÿÿÿ
t
java:S2293i"YReplace the type specification in this constructor call with the diamond operator ("<>").(êÝýÂþÿÿÿÿ
o
java:S2293q"YReplace the type specification in this constructor call with the diamond operator ("<>").(À—’¢
p
java:S2293Ù"YReplace the type specification in this constructor call with the diamond operator ("<>").(艥ð
?
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(××ß’
q
java:S1104N"VMake tvModified a static final constant or non-public and provide accessors if needed.(ƒëÔ£ÿÿÿÿÿ
r
java:S1104P"WMake ivAlertIcon a static final constant or non-public and provide accessors if needed.(ªà¶±ûÿÿÿÿ
r
java:S1104R"WMake tvAlertDate a static final constant or non-public and provide accessors if needed.(“²<E2809C>Öúÿÿÿÿ
s
java:S1104T"XMake ibSetBgColor a static final constant or non-public and provide accessors if needed.(ýãä¬üÿÿÿÿ
n
java:S1450"WRemove the "mPattern" field and declare it as a local variable in the relevant methods.(©´ÖÛ
n
java:S3776"RRefactor this method to reduce its Cognitive Complexity from 26 to the 15 allowed.(ݨÁ±øÿÿÿÿ
W
java:S1874Ø"@Remove this use of "SOFT_INPUT_ADJUST_RESIZE"; it is deprecated.(ѯ”<C2AF>
\
java:S1874þ"@Remove this use of "SOFT_INPUT_ADJUST_RESIZE"; it is deprecated.(Ò£ú¿ÿÿÿÿÿ
O
java:S1874<18>"9Remove this use of "setTextAppearance"; it is deprecated.(½õË(
K
java:S2864˜"4Iterate over the "entrySet" instead of the "keySet".(­Ô‡ï
N
java:S1135¤"2Complete the task associated to this TODO comment.(Ùü§“ýÿÿÿÿ
8
java:S1116¸"Remove this empty statement.(ôŸŽìúÿÿÿÿ
X
java:S1126å"AReplace this if-then-else statement by a single return statement.(®ÎÚÉ
8
java:S1116"Remove this empty statement.(ôŸŽìúÿÿÿÿ
P
java:S1874ƒ"9Remove this use of "PreferenceManager"; it is deprecated.(ª¦úÅ
Z
java:S1874ƒ"CRemove this use of "getDefaultSharedPreferences"; it is deprecated.(ª¦úÅ
U
java:S1874À"9Remove this use of "setTextAppearance"; it is deprecated.(ÑëÊäüÿÿÿÿ
f
java:S1874È"JDon't override a deprecated method or explicitly mark it as "@Deprecated".(œƒƒ©ùÿÿÿÿ
Q
java:S1874Î"5Remove this use of "onBackPressed"; it is deprecated.(<28>Ñàÿÿÿÿÿ
G
java:S1874Ù"0Remove this use of "getColor"; it is deprecated.(è¤ÔÃ
d
java:S3252Û"MUse static access with "android.text.Spanned" for "SPAN_INCLUSIVE_EXCLUSIVE".(ŸÍÃó
U
java:S1874å"9Remove this use of "setTextAppearance"; it is deprecated.(Ùú˜Êøÿÿÿÿ
T
java:S1874Ñ"=Remove this use of "EXTRA_SHORTCUT_INTENT"; it is deprecated.(·Ã°Ÿ
R
java:S1874Ò";Remove this use of "EXTRA_SHORTCUT_NAME"; it is deprecated.(ÒÀ‘ç
[
java:S1874Ô"DRemove this use of "EXTRA_SHORTCUT_ICON_RESOURCE"; it is deprecated.(§éǾ

@ -0,0 +1,11 @@
E
java:S16049"(Make this anonymous inner class a lambda(ñ×®è8±¦­¡<C2AD>1
J
java:S1604C"(Make this anonymous inner class a lambda(Ò´Ñ<C2B4>ÿÿÿÿÿ8²¦­¡<C2AD>1
J
java:S1604w"(Make this anonymous inner class a lambda(×ÉÑ‘úÿÿÿÿ8²¦­¡<C2AD>1
F
java:S1604˜"(Make this anonymous inner class a lambda(À¸èž8²¦­¡<C2AD>1
]
java:S3398ê"?Move this method into the anonymous class declared at line 119.( šåš8ú§­¡<C2AD>1

@ -0,0 +1,13 @@
k java:S116w"VRename this field "TEXT_FORMAT" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(Ñ›–¼
i java:S100Á"NRename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(<28>é߯ûÿÿÿÿ
d java:S100˜"NRename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(Ôœ¯£
[
java:S2147¹"ECombine this catch with the one at line 310, which has the same body.(‰üú
\
java:S2147Ú"ECombine this catch with the one at line 344, 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".(…´<C2B4>

@ -88,11 +88,11 @@ K
java:S1874â"/Remove this use of "execute"; it is deprecated.( å«<C3A5>ûÿÿÿÿ
h
java:S3776ñ"RRefactor this method to reduce its Cognitive Complexity from 18 to the 15 allowed.(ôŒùb
K
java:S3398¼"/Move this method into "BackgroundQueryHandler".(—÷õŽüÿÿÿÿ
G
java:S3398˜"0Move this method into "OnListItemClickListener".(‘ðð¡
A
java:S3398˜"%Move this method into "ModeCallback".(“ðÉçýÿÿÿÿ
<
java:S3398Ø"%Move this method into "ModeCallback".(ãìîí
G
java:S3398˜"0Move this method into "OnListItemClickListener".(‘ðð¡
K
java:S3398¼"/Move this method into "BackgroundQueryHandler".(—÷õŽüÿÿÿÿ

@ -0,0 +1,3 @@
E
java:S1604"(Make this anonymous inner class a lambda(€ÖÊ©8·ÇÉ«<C389>1

@ -0,0 +1,7 @@
:
java:S2386"Make this member "protected".(±ê™–8Ñô<C391>¬<EFBFBD>1
K
java:S1874".Remove this use of "<init>"; it is deprecated.(椱8Ñô<C391>¬<EFBFBD>1
T
java:S1135"2Complete the task associated to this TODO comment.(ƒŠ® úÿÿÿÿ8Ñô<C391>¬<EFBFBD>1

@ -13,8 +13,6 @@ Y
)app/src/main/res/values-zh-rTW/arrays.xml,7\8\78b400021a4b67de1cb9c996b2d32e042fc1fec3
l
<app/src/main/java/net/micode/notes/ui/AlarmInitReceiver.java,0\2\0268ec648e2fc0139b30ed13396174b7392c1ae2
h
8app/src/main/java/net/micode/notes/ui/NotesListItem.java,5\d\5dfe6902d8ec740690f88d644e74362c3be08fad
m
=app/src/main/java/net/micode/notes/tool/GTaskStringUtils.java,c\4\c42ad3cd6e664963fa1849c760a57d417d500ee7
k
@ -49,8 +47,6 @@ q
Aapp/src/main/java/net/micode/notes/widget/NoteWidgetProvider.java,5\8\58052a8597c5f01595e1c849728bcae66c27a1a6
u
Eapp/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java,f\0\f087b1ba1b9c91b7293fea0fb071eaed62a42137
g
7app/src/main/java/net/micode/notes/ui/NoteItemData.java,0\8\08c35f02f11c35ae9ebf8db0a482054dfa1cf493
Q
!app/src/main/res/raw/introduction,3\3\332c6f3d75926e4702a2bec3dcc4f101b096d5a2
b
@ -67,8 +63,6 @@ S
#app/src/main/res/menu/note_list.xml,4\3\4382a5e52a040a8135b4c0fc2653f95c42c8766b
X
(app/src/main/res/menu/call_note_edit.xml,1\0\102ed1bbec66cf4d2c859a294d53f757520c9c3a
l
<app/src/main/java/net/micode/notes/ui/NotesListActivity.java,a\d\ad72331a1bed265bb9c0fe838faa74dbf69fce32
[
+app/src/main/res/menu/note_list_options.xml,7\e\7e6c62cbf2db3592d39ae44d7f78b9e37151187e
\
@ -139,13 +133,41 @@ V
&app/src/main/res/drawable/new_note.xml,a\5\a5deab8a7a2cdb1cdc00e34cf882d28fd0f00c28
X
(app/src/main/res/raw-zh-rCN/introduction,9\d\9d3f688bcd8166493a0cc97a200f519d2f20537c
k
;app/src/main/java/net/micode/notes/ui/NotesListAdapter.java,2\8\283f16cc23da56ca65616082bc810304d3511d0a
r
Bapp/src/main/java/net/micode/notes/ui/NotesPreferenceActivity.java,d\a\da57ce446af85bbd9aefee65e969869f0cff78b0
@
local.properties,0\7\0712df971a99ac4d2fccb8e0fb19f377f3374cca
?
settings.gradle,0\5\05efc8b1657769a27696d478ded1e95f38737233
h
8app/src/main/java/net/micode/notes/ui/AlarmReceiver.java,5\8\5836a695995df8fadacfa6409fe8d21d88946842
8app/src/main/java/net/micode/notes/ui/AlarmReceiver.java,5\8\5836a695995df8fadacfa6409fe8d21d88946842
X
(gradle/wrapper/gradle-wrapper.properties,f\b\fbe448ebfc3eb2d4e308f6b8b043666f5b57235e
@
app/build.gradle,f\4\f4a01d6a4fcb971362ec00a83903fd3902f52164
<
build.gradle,f\0\f07866736216be0ee2aba49e392191aeae700a35
h
8app/src/main/java/net/micode/notes/tool/BackupUtils.java,a\4\a446c87b1013132f8adaf83656b582028e8809af
f
6app/src/main/java/net/micode/notes/tool/DataUtils.java,3\2\32360bf24febc78f20db52498c7576b3d8650d56
i
9app/src/main/java/net/micode/notes/ui/DateTimePicker.java,6\c\6cbf8bd9aa98eff862b1dc067330ba66ba4493aa
g
7app/src/main/java/net/micode/notes/ui/DropdownMenu.java,d\1\d1cc822fa9d783a8d4563bf6e139b7ae10de2fb1
o
?app/src/main/java/net/micode/notes/ui/DateTimePickerDialog.java,2\b\2bfc771e07e87c37d3a76a2c815bc8fb30649798
k
;app/src/main/java/net/micode/notes/ui/NoteEditActivity.java,5\7\577f30d26378ec8a2bd2e4a43f3c79b3f04c402c
g
7app/src/main/java/net/micode/notes/ui/NoteEditText.java,5\0\503adcf2a0be1ecdb94a15efba4433b6589877b9
g
7app/src/main/java/net/micode/notes/ui/NoteItemData.java,0\8\08c35f02f11c35ae9ebf8db0a482054dfa1cf493
l
<app/src/main/java/net/micode/notes/ui/NotesListActivity.java,a\d\ad72331a1bed265bb9c0fe838faa74dbf69fce32
k
;app/src/main/java/net/micode/notes/ui/NotesListAdapter.java,2\8\283f16cc23da56ca65616082bc810304d3511d0a
h
8app/src/main/java/net/micode/notes/ui/NotesListItem.java,5\d\5dfe6902d8ec740690f88d644e74362c3be08fad
r
Bapp/src/main/java/net/micode/notes/ui/NotesPreferenceActivity.java,d\a\da57ce446af85bbd9aefee65e969869f0cff78b0
m
=app/src/main/java/net/micode/notes/ui/FoldersListAdapter.java,f\9\f9f49497f95afd327db7a7a512612aa1089003d4

@ -13,8 +13,6 @@ Y
)app/src/main/res/values-zh-rTW/arrays.xml,7\8\78b400021a4b67de1cb9c996b2d32e042fc1fec3
l
<app/src/main/java/net/micode/notes/ui/AlarmInitReceiver.java,0\2\0268ec648e2fc0139b30ed13396174b7392c1ae2
h
8app/src/main/java/net/micode/notes/ui/NotesListItem.java,5\d\5dfe6902d8ec740690f88d644e74362c3be08fad
m
=app/src/main/java/net/micode/notes/tool/GTaskStringUtils.java,c\4\c42ad3cd6e664963fa1849c760a57d417d500ee7
k
@ -49,8 +47,6 @@ q
Aapp/src/main/java/net/micode/notes/widget/NoteWidgetProvider.java,5\8\58052a8597c5f01595e1c849728bcae66c27a1a6
u
Eapp/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java,f\0\f087b1ba1b9c91b7293fea0fb071eaed62a42137
g
7app/src/main/java/net/micode/notes/ui/NoteItemData.java,0\8\08c35f02f11c35ae9ebf8db0a482054dfa1cf493
Q
!app/src/main/res/raw/introduction,3\3\332c6f3d75926e4702a2bec3dcc4f101b096d5a2
b
@ -67,8 +63,6 @@ S
#app/src/main/res/menu/note_list.xml,4\3\4382a5e52a040a8135b4c0fc2653f95c42c8766b
X
(app/src/main/res/menu/call_note_edit.xml,1\0\102ed1bbec66cf4d2c859a294d53f757520c9c3a
l
<app/src/main/java/net/micode/notes/ui/NotesListActivity.java,a\d\ad72331a1bed265bb9c0fe838faa74dbf69fce32
[
+app/src/main/res/menu/note_list_options.xml,7\e\7e6c62cbf2db3592d39ae44d7f78b9e37151187e
\
@ -139,13 +133,41 @@ V
&app/src/main/res/drawable/new_note.xml,a\5\a5deab8a7a2cdb1cdc00e34cf882d28fd0f00c28
X
(app/src/main/res/raw-zh-rCN/introduction,9\d\9d3f688bcd8166493a0cc97a200f519d2f20537c
k
;app/src/main/java/net/micode/notes/ui/NotesListAdapter.java,2\8\283f16cc23da56ca65616082bc810304d3511d0a
r
Bapp/src/main/java/net/micode/notes/ui/NotesPreferenceActivity.java,d\a\da57ce446af85bbd9aefee65e969869f0cff78b0
@
local.properties,0\7\0712df971a99ac4d2fccb8e0fb19f377f3374cca
?
settings.gradle,0\5\05efc8b1657769a27696d478ded1e95f38737233
h
8app/src/main/java/net/micode/notes/ui/AlarmReceiver.java,5\8\5836a695995df8fadacfa6409fe8d21d88946842
8app/src/main/java/net/micode/notes/ui/AlarmReceiver.java,5\8\5836a695995df8fadacfa6409fe8d21d88946842
X
(gradle/wrapper/gradle-wrapper.properties,f\b\fbe448ebfc3eb2d4e308f6b8b043666f5b57235e
i
9app/src/main/java/net/micode/notes/ui/DateTimePicker.java,6\c\6cbf8bd9aa98eff862b1dc067330ba66ba4493aa
k
;app/src/main/java/net/micode/notes/ui/NoteEditActivity.java,5\7\577f30d26378ec8a2bd2e4a43f3c79b3f04c402c
@
app/build.gradle,f\4\f4a01d6a4fcb971362ec00a83903fd3902f52164
<
build.gradle,f\0\f07866736216be0ee2aba49e392191aeae700a35
h
8app/src/main/java/net/micode/notes/tool/BackupUtils.java,a\4\a446c87b1013132f8adaf83656b582028e8809af
o
?app/src/main/java/net/micode/notes/ui/DateTimePickerDialog.java,2\b\2bfc771e07e87c37d3a76a2c815bc8fb30649798
f
6app/src/main/java/net/micode/notes/tool/DataUtils.java,3\2\32360bf24febc78f20db52498c7576b3d8650d56
g
7app/src/main/java/net/micode/notes/ui/NoteEditText.java,5\0\503adcf2a0be1ecdb94a15efba4433b6589877b9
g
7app/src/main/java/net/micode/notes/ui/DropdownMenu.java,d\1\d1cc822fa9d783a8d4563bf6e139b7ae10de2fb1
m
=app/src/main/java/net/micode/notes/ui/FoldersListAdapter.java,f\9\f9f49497f95afd327db7a7a512612aa1089003d4
g
7app/src/main/java/net/micode/notes/ui/NoteItemData.java,0\8\08c35f02f11c35ae9ebf8db0a482054dfa1cf493
l
<app/src/main/java/net/micode/notes/ui/NotesListActivity.java,a\d\ad72331a1bed265bb9c0fe838faa74dbf69fce32
k
;app/src/main/java/net/micode/notes/ui/NotesListAdapter.java,2\8\283f16cc23da56ca65616082bc810304d3511d0a
h
8app/src/main/java/net/micode/notes/ui/NotesListItem.java,5\d\5dfe6902d8ec740690f88d644e74362c3be08fad
r
Bapp/src/main/java/net/micode/notes/ui/NotesPreferenceActivity.java,d\a\da57ce446af85bbd9aefee65e969869f0cff78b0

@ -1,19 +1,3 @@
/*
* 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.ui;
import android.content.Context;
@ -30,10 +14,14 @@ import net.micode.notes.data.Notes.NoteColumns;
public class FoldersListAdapter extends CursorAdapter {
//CursorAdapter是Cursor和ListView的接口
//FoldersListAdapter继承了CursorAdapter的类
//主要作用是便签数据库和用户的交互
//这里就是用folder文件夹的形式展现给用户
public static final String [] PROJECTION = {
NoteColumns.ID,
NoteColumns.SNIPPET
};
NoteColumns.ID,
NoteColumns.SNIPPET
};//调用数据库中便签的ID和片段
public static final int ID_COLUMN = 0;
public static final int NAME_COLUMN = 1;
@ -41,34 +29,38 @@ public class FoldersListAdapter extends CursorAdapter {
public FoldersListAdapter(Context context, Cursor c) {
super(context, c);
// TODO Auto-generated constructor stub
}
}//数据库操作
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
//ViewGroup是容器
return new FolderListItem(context);
}
}//创建一个文件夹,对于各文件夹中子标签的初始化
@Override
public void bindView(View view, Context context, Cursor cursor) {
if (view instanceof FolderListItem) {
//instanceof 是 Java 的保留关键字。它的作用是测试它左边的对象是否是它右边的类的实例,返回 boolean 的数据类型
String folderName = (cursor.getLong(ID_COLUMN) == Notes.ID_ROOT_FOLDER) ? context
.getString(R.string.menu_move_parent_folder) : cursor.getString(NAME_COLUMN);
((FolderListItem) view).bind(folderName);
}
}
}//将各个布局文件绑定起来
public String getFolderName(Context context, int position) {
Cursor cursor = (Cursor) getItem(position);
return (cursor.getLong(ID_COLUMN) == Notes.ID_ROOT_FOLDER) ? context
.getString(R.string.menu_move_parent_folder) : cursor.getString(NAME_COLUMN);
}
}//根据数据库中标签的ID得到标签的各项内容
private class FolderListItem extends LinearLayout {
private TextView mName;
public FolderListItem(Context context) {
super(context);
//操作数据库
inflate(context, R.layout.folder_list_item, this);
//根据布局文件的名字等信息将其找出来
mName = (TextView) findViewById(R.id.tv_folder_name);
}

Loading…
Cancel
Save