diff --git a/src/.idea/workspace.xml b/src/.idea/workspace.xml
index 0b04a9e..11b2b8a 100644
--- a/src/.idea/workspace.xml
+++ b/src/.idea/workspace.xml
@@ -6,7 +6,7 @@
-
+
@@ -42,11 +42,11 @@
-
+
-
-
+
+
@@ -66,7 +66,7 @@
-
+
@@ -97,7 +97,7 @@
-
+
@@ -816,7 +816,14 @@
1570673666384
-
+
+ 1570707769289
+
+
+
+ 1570707769289
+
+
@@ -894,12 +901,12 @@
-
-
+
+
@@ -1202,18 +1209,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1233,10 +1228,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
@@ -1255,13 +1269,6 @@
-
-
-
-
-
-
-
diff --git a/src/app/src/main/java/net/micode/notes/ui/NotesListActivity.java b/src/app/src/main/java/net/micode/notes/ui/NotesListActivity.java
index 6940eee..d093306 100644
--- a/src/app/src/main/java/net/micode/notes/ui/NotesListActivity.java
+++ b/src/app/src/main/java/net/micode/notes/ui/NotesListActivity.java
@@ -1026,6 +1026,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
if (view instanceof NotesListItem) {
NoteItemData item = ((NotesListItem) view).getItemData();
if (mNotesListAdapter.isInChoiceMode()) {
+ //如果为便签类型
if (item.getType() == Notes.TYPE_NOTE) {
position = position - mNotesListView.getHeaderViewsCount();
mModeCallBack.onItemCheckedStateChanged(null, position, id,
@@ -1034,18 +1035,26 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
return;
}
+ //对状态进行选择
switch (mState) {
+ //如果为列表状态
case NOTE_LIST:
+ //判断是否为文件夹
if (item.getType() == Notes.TYPE_FOLDER
|| item.getType() == Notes.TYPE_SYSTEM) {
+ //是,打开文件夹
openFolder(item);
} else if (item.getType() == Notes.TYPE_NOTE) {
+ //如果是便签,打开便签
openNode(item);
} else {
+ //异常处理,将错误类型记入日志
Log.e(TAG, "Wrong note type in NOTE_LIST");
}
break;
+ //如果为子文件夹状态,不执行操作
case SUB_FOLDER:
+ //如果为通话记录类型
case CALL_RECORD_FOLDER:
if (item.getType() == Notes.TYPE_NOTE) {
openNode(item);
@@ -1062,10 +1071,13 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
}
private void startQueryDestinationFolders() {
+ //定义用于在数据库中查询的语句,对type、parent_id、ID进行判断选择
String selection = NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>? AND " + NoteColumns.ID + "<>?";
selection = (mState == ListEditState.NOTE_LIST) ? selection:
"(" + selection + ") OR (" + NoteColumns.ID + "=" + Notes.ID_ROOT_FOLDER + ")";
+ //后台查询句柄
+ //结果以最近修改时间排序
mBackgroundQueryHandler.startQuery(FOLDER_LIST_QUERY_TOKEN,
null,
Notes.CONTENT_NOTE_URI,
@@ -1079,17 +1091,26 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
NoteColumns.MODIFIED_DATE + " DESC");
}
+ /*
+ * 该方法实现了长按的操作
+ * @ view 窗口类
+ * @ id
+ * */
public boolean onItemLongClick(AdapterView> parent, View view, int position, long id) {
+ //判断窗体是否为列表状态
if (view instanceof NotesListItem) {
+ //是,设置焦点便签
mFocusNoteDataItem = ((NotesListItem) view).getItemData();
if (mFocusNoteDataItem.getType() == Notes.TYPE_NOTE && !mNotesListAdapter.isInChoiceMode()) {
if (mNotesListView.startActionMode(mModeCallBack) != null) {
mModeCallBack.onItemCheckedStateChanged(null, position, id, true);
mNotesListView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
} else {
+ //便签活动状态设置失败,记入日志
Log.e(TAG, "startActionMode fails");
}
- } else if (mFocusNoteDataItem.getType() == Notes.TYPE_FOLDER) {
+ } else if (mFocusNoteDataItem.getType() == Notes.TYPE_FOLDER) {//如果为文件夹状态
+ //设置窗体内容为文件夹内容
mNotesListView.setOnCreateContextMenuListener(mFolderOnCreateContextMenuListener);
}
}