diff --git a/doc/小米便签的代码标注.docx b/doc/小米便签的代码标注.docx
deleted file mode 100644
index 9b86114..0000000
Binary files a/doc/小米便签的代码标注.docx and /dev/null differ
diff --git a/doc/小米便签质量分析报告.docx b/doc/小米便签质量分析报告.docx
index d677063..a4e7406 100644
Binary files a/doc/小米便签质量分析报告.docx and b/doc/小米便签质量分析报告.docx differ
diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index e5fb6a4..b6036d7 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -1,107 +1,61 @@
-
-
-
-
-
-
+ android:versionName="0.1">
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
+
-
-
-
-
-
+ android:label="@string/app_name">
- android:label="@string/app_name"
- android:launchMode="singleTop"
- android:theme="@style/NoteTheme"
- android:windowSoftInputMode="adjustPan" >
-
+
+ android:windowSoftInputMode="adjustPan">
-
-
-
-
-
-
+
+ android:theme="@style/NoteTheme">
-
+
+
-
+
-
+
+
-
+
-
+
+
-
+
-
-
-
+
-
-
+ android:multiprocess="true" />
+ android:label="@string/app_widget2x2">
-
+
-
+
+ android:label="@string/app_widget4x4">
-
+
-
+
-
-
-
-
+
+
-
-
-
+
-
-
-
+ android:name=".ui.AlarmReceiver"
+ android:process=":remote">
-
-
-
+ android:theme="@android:style/Theme.Holo.Wallpaper.NoTitleBar">
-
-
-
+ android:theme="@android:style/Theme.Holo.Light">
-
-
-
+ android:name=".gtask.remote.GTaskSyncService"
+ android:exported="false">
-
+
+
\ No newline at end of file
diff --git a/src/main/java/net/micode/notes/ui/NoteItemData.java b/src/main/java/net/micode/notes/ui/NoteItemData.java
index 832cbe9..ca9bcbe 100644
--- a/src/main/java/net/micode/notes/ui/NoteItemData.java
+++ b/src/main/java/net/micode/notes/ui/NoteItemData.java
@@ -34,6 +34,7 @@ import net.micode.notes.tool.DataUtils;
* @Version: 1.0
*/
public class NoteItemData {
+ // 用于定义查询操作中要返回的列
static final String [] PROJECTION = new String [] {
NoteColumns.ID,
NoteColumns.ALERTED_DATE,
diff --git a/src/main/java/net/micode/notes/ui/NotesListActivity.java b/src/main/java/net/micode/notes/ui/NotesListActivity.java
index 2b0e901..5eea908 100644
--- a/src/main/java/net/micode/notes/ui/NotesListActivity.java
+++ b/src/main/java/net/micode/notes/ui/NotesListActivity.java
@@ -85,6 +85,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
private static final String PREFERENCE_ADD_INTRODUCTION = "net.micode.notes.introduction";
+ /**三个状态,主页面,文件夹,通话记录文件夹*/
private enum ListEditState {
NOTE_LIST, SUB_FOLDER, CALL_RECORD_FOLDER
};
@@ -100,6 +101,8 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
private Button mAddNewNote;
private boolean mDispatch;
+ // 控制背景颜色,初始为亮
+ private int mBackgroundColor = 1;
private int mOriginY;
@@ -117,6 +120,9 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
public static final int NOTES_LISTVIEW_SCROLL_RATE = 30;
+ /** 私密模式,初始为 0 开启为 1*/
+ public static int mSecretMode = 0;
+
private NoteItemData mFocusNoteDataItem;
private static final String NORMAL_SELECTION = NoteColumns.PARENT_ID + "=?";
@@ -140,6 +146,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState); // 调用父类的onCreate函数
setContentView(R.layout.note_list);
+ getWindow().setBackgroundDrawableResource(R.drawable.bg_light);
initResources();
setAppInfoFromRawRes();
}
@@ -463,10 +470,12 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
* @return
*/
private void startAsyncNotesListQuery() {
- String selection = (mCurrentFolderId == Notes.ID_ROOT_FOLDER) ? ROOT_FOLDER_SELECTION : NORMAL_SELECTION;
+ String selection = (mCurrentFolderId == Notes.ID_ROOT_FOLDER) ? ROOT_FOLDER_SELECTION
+ : NORMAL_SELECTION;
mBackgroundQueryHandler.startQuery(FOLDER_NOTE_LIST_QUERY_TOKEN, null,
- Notes.CONTENT_NOTE_URI, NoteItemData.PROJECTION, selection, new String[] {String.valueOf(mCurrentFolderId)},
- NoteColumns.TYPE + " DESC," + NoteColumns.MODIFIED_DATE + " DESC");
+ Notes.CONTENT_NOTE_URI, NoteItemData.PROJECTION, selection, new String[]{
+ String.valueOf(mCurrentFolderId)
+ }, NoteColumns.TYPE + " DESC," + NoteColumns.MODIFIED_DATE + " DESC");
}
/**
* @Package: net.micode.notes.ui
@@ -530,6 +539,98 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
});
builder.show();
}
+
+ /**
+ * @method switchBackground
+ * @description 用以切换背景颜色
+ * @date: 1/3/2024 3:41 PM
+ * @author: YangYizhe
+ */
+ private void switchBackground(){
+ mBackgroundColor = (mBackgroundColor + 1) % 2;
+ View frameLayout = findViewById(R.id.frame_layout_id);
+ if (mBackgroundColor == 1){
+ frameLayout.setBackgroundResource(R.drawable.bg_light);
+ } else{
+ frameLayout.setBackgroundResource(R.drawable.bg_dark);
+ }
+
+ }
+
+ private boolean isSecretMode(){
+ if(mSecretMode == 1){
+ return true;
+ }else {
+ return false;
+ }
+ }
+
+ /**
+ * @method enterSecertMode
+ * @description 实现进入隐私模式的功能
+ * @date: 1/2/2024 8:18 PM
+ * @author: YangYizhe
+ */
+ private void enterSecretMode(){
+ AlertDialog.Builder dialog = new AlertDialog.Builder(NotesListActivity.this);
+ dialog.setTitle("重要提醒");
+ dialog.setMessage("您确认进入隐私模式吗?");
+ dialog.setCancelable(false);
+ dialog.setPositiveButton("确认", new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ mSecretMode = 1;
+ startAsyncNotesListQuery();
+ Toast.makeText(NotesListActivity.this,"您已进入隐私模式",Toast.LENGTH_SHORT).show();
+ }
+ });
+ dialog.setNegativeButton("取消", new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which){}
+ });
+ dialog.show();
+ }
+
+ /**
+ * @method quitSecretMode
+ * @description 实现退出隐私模式的功能
+ * @date: 1/2/2024 8:20 PM
+ * @author: YangYizhe
+ */
+ private void quitSecretMode(){
+ AlertDialog.Builder dialog = new AlertDialog.Builder(NotesListActivity.this);
+ dialog.setTitle("重要提醒");
+ dialog.setMessage("您确认退出隐私模式吗?");
+ dialog.setCancelable(false);
+ dialog.setPositiveButton("确认", new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ mSecretMode = 0;
+ startAsyncNotesListQuery();
+ Toast.makeText(NotesListActivity.this,"您已退出隐私模式",Toast.LENGTH_SHORT).show();
+ }
+ });
+ dialog.setNegativeButton("取消", new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which){}
+ });
+ dialog.show();
+ }
+
+ /**
+ * @method restoreDeletedNodes
+ * @description 进入回收站
+ * @date: 1/3/2024 8:11 PM
+ * @author: YangYizhe
+ */
+ private void restoreDeletedNodes(){
+ mState = ListEditState.SUB_FOLDER;
+ mCurrentFolderId = Notes.ID_TRASH_FOLER;
+ startAsyncNotesListQuery();
+ mTitleBar.setText("回收站");
+ mTitleBar.setVisibility(View.VISIBLE);
+ }
+
/**
* @method createNewNote
* @description 创建便签
@@ -544,6 +645,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
intent.putExtra(Notes.INTENT_EXTRA_FOLDER_ID, mCurrentFolderId);
this.startActivityForResult(intent, REQUEST_CODE_NEW_NODE);
}
+
/**
* @method batchDelete
* @description:
@@ -558,15 +660,15 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
new AsyncTask>() {
protected HashSet doInBackground(Void... unused) {
HashSet widgets = mNotesListAdapter.getSelectedWidget();
- //如果没有同步,直接删除
- if (!isSyncMode()) {
+ // 如果是回收站中的,直接删除
+ if (mCurrentFolderId == Notes.ID_TRASH_FOLER) {
if (DataUtils.batchDeleteNotes(mContentResolver, mNotesListAdapter
.getSelectedItemIds())) {
} else {
Log.e(TAG, "Delete notes error, should not happens");
}
}
- //已同步,将删除的便签移到垃圾桶
+ // 将删除的便签移到回收站
else {
if (!DataUtils.batchMoveToFolder(mContentResolver, mNotesListAdapter
.getSelectedItemIds(), Notes.ID_TRASH_FOLER)) {
@@ -891,6 +993,14 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
}
@Override
+ /**
+ * @method onPrepareOptionsMenu
+ * @description 准备菜单选项的回调方法,menu是Android自带的对象
+ * @date: 1/2/2024 7:40 PM
+ * @author: YangYizhe
+ * @param [menu] 菜单对象
+ * @return boolean 返回值指示是否处理了菜单创建事件
+ */
public boolean onPrepareOptionsMenu(Menu menu) {
menu.clear();
if (mState == ListEditState.NOTE_LIST) {
@@ -905,10 +1015,29 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
} else {
Log.e(TAG, "Wrong state:" + mState);
}
+ // 若在隐私模式之中,则不显示进入隐私模式的选项,不在隐私模式之中,则不显示退出隐私模式选项
+ if(isSecretMode()){
+ menu.findItem(R.id.menu_secret).setVisible(false);
+ } else {
+ menu.findItem(R.id.menu_quit_secret).setVisible(false);
+ }
+ if(mBackgroundColor==1) {
+ menu.findItem(R.id.menu_light_mode).setVisible(false);
+ } else {
+ menu.findItem(R.id.menu_dark_mode).setVisible(false);
+ }
return true;
}
@Override
+ /**
+ * @method onOptionsItemSelected
+ * @description 处理菜单选项的选择事件。根据被选择的菜单项不同,该方法会触发不同的操作。
+ * @date: 1/2/2024 7:41 PM
+ * @author: YangYizhe
+ * @param [item] 被选择的菜单项
+ * @return boolean 返回值指示是否处理了菜单选择事件
+ */
public boolean onOptionsItemSelected(MenuItem item) {
int itemId = item.getItemId();
if (itemId == R.id.menu_new_folder) {
@@ -931,6 +1060,16 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
createNewNote();
} else if (itemId == R.id.menu_search) {
onSearchRequested();
+ } else if (itemId == R.id.menu_secret) {
+ enterSecretMode();
+ } else if (itemId == R.id.menu_quit_secret){
+ quitSecretMode();
+ } else if(itemId == R.id.menu_light_mode) {
+ switchBackground();
+ } else if(itemId == R.id.menu_dark_mode) {
+ switchBackground();
+ } else if (itemId == R.id.menu_restore) {
+ restoreDeletedNodes();
}
return true;
}
diff --git a/src/main/java/net/micode/notes/ui/NotesListItem.java b/src/main/java/net/micode/notes/ui/NotesListItem.java
index d32a37b..5cf4b20 100644
--- a/src/main/java/net/micode/notes/ui/NotesListItem.java
+++ b/src/main/java/net/micode/notes/ui/NotesListItem.java
@@ -26,7 +26,7 @@ public class NotesListItem extends LinearLayout {
private ImageView mAlert;//闹钟图片
private TextView mTitle; //标题
private TextView mTime; //时间
- private TextView mCallName; //
+ private TextView mCallName;
private NoteItemData mItemData; //标签数据
private CheckBox mCheckBox; //打钩框
diff --git a/src/main/res/layout/note_list.xml b/src/main/res/layout/note_list.xml
index 6b25d38..ee4cfc9 100644
--- a/src/main/res/layout/note_list.xml
+++ b/src/main/res/layout/note_list.xml
@@ -19,7 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:background="@drawable/list_background">
+ android:background="@drawable/bg_light">
@@ -74,4 +74,13 @@
- @color/black_overlay
- ?android:attr/buttonBarStyle
+
+
+
+
\ No newline at end of file