diff --git a/doc/~$便签泛读、标注和维护报告文档.docx b/doc/~$便签泛读、标注和维护报告文档.docx
new file mode 100644
index 0000000..7306b70
Binary files /dev/null and b/doc/~$便签泛读、标注和维护报告文档.docx differ
diff --git a/doc/~$便签质量分析报告.docx b/doc/~$便签质量分析报告.docx
new file mode 100644
index 0000000..7115a73
Binary files /dev/null and b/doc/~$便签质量分析报告.docx differ
diff --git a/doc/~WRL2503.tmp b/doc/~WRL2503.tmp
new file mode 100644
index 0000000..2e90554
Binary files /dev/null and b/doc/~WRL2503.tmp differ
diff --git a/doc/小米便签泛读报告.docx b/doc/小米便签泛读、标注和维护报告文档.docx
similarity index 93%
rename from doc/小米便签泛读报告.docx
rename to doc/小米便签泛读、标注和维护报告文档.docx
index b0d4bc9..f6c9e7d 100644
Binary files a/doc/小米便签泛读报告.docx and b/doc/小米便签泛读、标注和维护报告文档.docx differ
diff --git a/doc/小米便签的代码标注.docx b/doc/小米便签的代码标注.docx
deleted file mode 100644
index 6d4e6b9..0000000
Binary files a/doc/小米便签的代码标注.docx and /dev/null differ
diff --git a/doc/小米便签质量分析报告.docx b/doc/小米便签质量分析报告.docx
index 09b4bc2..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 c71be5b..b6036d7 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -1,185 +1,155 @@
-
-
-
-
-
-
+ android:versionName="0.1">
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
+
-
-
+ android:icon="@drawable/icon_app_1"
+ android:label="@string/app_name">
+
+
+
+
+
+
-
+
+ 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/AlarmAlertActivity.java b/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java
index 96f28bf..e6a9d73 100644
--- a/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java
+++ b/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java
@@ -46,21 +46,23 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
- requestWindowFeature(Window.FEATURE_NO_TITLE);//设置界面显示——无标题
+ // 设置界面显示——无标题
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
final Window win = getWindow();
-
- win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);//设置窗体属性——在锁屏时显示
+ // 设置窗体属性——在锁屏时显示
+ win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
if (!isScreenOn()) {
- win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON//保持点亮、点亮屏幕、允许点亮时解锁
+ // 设置窗体属性——保持点亮、点亮屏幕、允许点亮时解锁
+ win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
| WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
| WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
}
- Intent intent = getIntent();//获取传递的 Intent
+ // 获取传递的 Intent
+ Intent intent = getIntent();
try {
// 从 Intent 中获取数据并处理——获取标签 ID
@@ -78,33 +80,24 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD
mPlayer = new MediaPlayer();
if (DataUtils.visibleInNoteDatabase(getContentResolver(), mNoteId, Notes.TYPE_NOTE)) {
- showActionDialog();// 显示对话框
- playAlarmSound();// 播放闹钟提示音
+ // 显示对话框
+ showActionDialog();
+ // 播放闹钟提示音
+ playAlarmSound();
} else {
- finish();// 结束当前 Activity
+ // 结束当前 Activity
+ finish();
}
}
- /**
- * @method isScreenOn
- * @description
- * 判断屏幕是否锁屏,调用系统函数判断,最后返回值是布尔类型
- * @date: 12/23/2023 11:21 PM
- * @author: YangYizhe
- * @param
- * @return
- */
+
private boolean isScreenOn() {
+ //判断屏幕是否锁屏,调用系统函数判断,最后返回值是布尔类型
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
return pm.isScreenOn();
}
- /**
- * @method playAlarmSound
- * @description
- * 播放闹钟提示音
- * @date: 12/23/2023 11:21 PM
- * @author: YangYizhe
- */
+
private void playAlarmSound() {
+ //闹钟提示音激发
Uri url = RingtoneManager.getActualDefaultRingtoneUri(this, RingtoneManager.TYPE_ALARM);
//调用系统的铃声管理URI,得到闹钟提示音
int silentModeStreams = Settings.System.getInt(getContentResolver(),
@@ -117,12 +110,19 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD
}
try {
mPlayer.setDataSource(this, url);
+ //方法:setDataSource(Context context, Uri uri)
+ //解释:无返回值,设置多媒体数据来源【根据 Uri】
mPlayer.prepare();
- mPlayer.setLooping(true);//设置是否循环播放
- mPlayer.start();//开始播放
+ //准备同步
+ mPlayer.setLooping(true);
+ //设置是否循环播放
+ mPlayer.start();
+ //开始播放
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
+ //e.printStackTrace()函数功能是抛出异常, 还将显示出更深的调用信息
+ //System.out.println(e),这个方法打印出异常,并且输出在哪里出现的异常
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -134,67 +134,61 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD
e.printStackTrace();
}
}
- /**
- * @method showActionDialog
- * @description
- * AlertDialog的构造方法全部是Protected的
- * 所以不能直接通过new一个AlertDialog来创建出一个AlertDialog。
- * 要创建一个AlertDialog,就要用到AlertDialog.Builder中的create()方法
- * 如这里的dialog就是新建了一个AlertDialog
- * @date: 12/23/2023 11:28 PM
- * @author: YangYizhe
- */
+
private void showActionDialog() {
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
- dialog.setTitle(R.string.app_name);//为对话框设置标题
- dialog.setMessage(mSnippet);//为对话框设置内容
- dialog.setPositiveButton(R.string.notealert_ok, this);//给对话框添加"Yes"按钮
+ /* AlertDialog的构造方法全部是Protected的
+ * 所以不能直接通过new一个AlertDialog来创建出一个AlertDialog。
+ * 要创建一个AlertDialog,就要用到AlertDialog.Builder中的create()方法
+ * 如这里的dialog就是新建了一个AlertDialog
+ */
+ dialog.setTitle(R.string.app_name);
+ //为对话框设置标题
+ dialog.setMessage(mSnippet);
+ //为对话框设置内容
+ dialog.setPositiveButton(R.string.notealert_ok, this);
+ //给对话框添加"Yes"按钮
if (isScreenOn()) {
- dialog.setNegativeButton(R.string.notealert_enter, this);//对话框添加"No"按钮
- }
+ dialog.setNegativeButton(R.string.notealert_enter, this);
+ }//对话框添加"No"按钮
dialog.show().setOnDismissListener(this);
}
- /**
- * @method onClick
- * @description 处理点击事件
- * @date: 12/23/2023 11:27 PM
- * @author: YangYizhe
- * @param dialog
- * @param which
- */
+
public void onClick(DialogInterface dialog, int which) {
- switch (which) {//用which来选择click后下一步的操作
- case DialogInterface.BUTTON_NEGATIVE://这是取消操作
- Intent intent = new Intent(this, NoteEditActivity.class);//实现两个类间的数据传输
- intent.setAction(Intent.ACTION_VIEW);//设置动作属性
- intent.putExtra(Intent.EXTRA_UID, mNoteId);//实现key-value对 EXTRA_UID为key;mNoteId为键
- startActivity(intent);//开始动作
+ switch (which) {
+ //用which来选择click后下一步的操作
+ case DialogInterface.BUTTON_NEGATIVE:
+ //这是取消操作
+ Intent intent = new Intent(this, NoteEditActivity.class);
+ //实现两个类间的数据传输
+ intent.setAction(Intent.ACTION_VIEW);
+ //设置动作属性
+ intent.putExtra(Intent.EXTRA_UID, mNoteId);
+ //实现key-value对
+ //EXTRA_UID为key;mNoteId为键
+ startActivity(intent);
+ //开始动作
break;
default:
+ //这是确定操作
break;
}
}
- /**
- * @method onDismiss
- * @description 忽略
- * @date: 12/23/2023 11:25 PM
- * @author: YangYizhe
- * @param dialog
- */
+
public void onDismiss(DialogInterface dialog) {
- stopAlarmSound();//停止闹钟声音
+ //忽略
+ stopAlarmSound();
+ //停止闹钟声音
finish();
+ //完成该动作
}
- /**
- * @method stopAlarmSound
- * @description 停止闹钟的声音
- * @date: 12/23/2023 11:26 PM
- * @author: YangYizhe
- */
+
private void stopAlarmSound() {
if (mPlayer != null) {
- mPlayer.stop();//停止播放
- mPlayer.release();//释放MediaPlayer对象
+ mPlayer.stop();
+ //停止播放
+ mPlayer.release();
+ //释放MediaPlayer对象
mPlayer = null;
}
}
diff --git a/src/main/java/net/micode/notes/ui/NoteEditActivity.java b/src/main/java/net/micode/notes/ui/NoteEditActivity.java
index 18cafd6..0ad5f86 100644
--- a/src/main/java/net/micode/notes/ui/NoteEditActivity.java
+++ b/src/main/java/net/micode/notes/ui/NoteEditActivity.java
@@ -19,6 +19,8 @@ import android.text.SpannableString;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.style.BackgroundColorSpan;
+import android.text.Editable;// 引入textwatcher和Editable
+import android.text.TextWatcher;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -75,6 +77,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
public TextView tvAlertDate;
public ImageView ibSetBgColor;
+
+ public TextView textNum;
}
private static final Map sBgSelectorBtnsMap = new HashMap();
static {
@@ -132,6 +136,70 @@ public class NoteEditActivity extends Activity implements OnClickListener,
private String mUserQuery;
private Pattern mPattern;
+
+ /**
+ * @method Textchange
+ * @description 对原始文本进行处理,去除图片字符、换行符和空格字符
+ * @date: 1/3/2024 8:48 AM
+ * @author: YangYizhe
+ * @param oriText
+ * @return 处理后的文本
+ */
+ private String Textchange(String oriText){
+ StringBuffer stringBuffer = new StringBuffer(oriText);
+ int Flag1 = -1;
+ int Flag2 = -1;
+ do {//不计入表示图片的字符
+ Flag1 = stringBuffer.indexOf("");
+ if (Flag1 != -1 && Flag2 != -1) {
+ stringBuffer = stringBuffer.replace(Flag1, Flag2+1, "");
+ }
+ } while (Flag1 != -1 && Flag2 != -1);
+
+ do {//不计入换行字符
+ Flag1 = stringBuffer.indexOf("\n");
+
+ if (Flag1 != -1){
+ stringBuffer = stringBuffer.replace(Flag1, Flag1+1, "");
+ }
+ } while (Flag1 != -1);
+ do {//不计入空格字符
+ Flag1 = stringBuffer.indexOf(" ");
+
+ if (Flag1 != -1) {
+ stringBuffer = stringBuffer.replace(Flag1, Flag1+1, "");
+ }
+ } while (Flag1 != -1);
+ return stringBuffer.toString();
+ }
+
+ /**
+ * @method count
+ * @description 监听编辑框文本变化并更新字符数
+ * @date: 1/3/2024 9:09 AM
+ * @author: YangYizhe
+ */
+ private void count() {
+ mNoteEditor.addTextChangedListener(new TextWatcher() {
+ int currentLength = 0;
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+ mNoteHeaderHolder.textNum.setText("字数:" + currentLength);
+ }
+
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+ currentLength = Textchange(mNoteEditor.getText().toString()).length();
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ mNoteHeaderHolder.textNum.setText("字数:" + currentLength);
+ }
+ });
+ }
+
/**
*在 Activity 创建时进行一些初始化工作,包括设置布局、初始化状态和资源等操作
*/
@@ -144,6 +212,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
return;
}
initResources();
+ count();
}
/**
@@ -375,6 +444,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
mNoteHeaderHolder.ivAlertIcon = (ImageView) findViewById(R.id.iv_alert_icon);
mNoteHeaderHolder.tvAlertDate = (TextView) findViewById(R.id.tv_alert_date);
mNoteHeaderHolder.ibSetBgColor = (ImageView) findViewById(R.id.btn_set_bg_color);
+ mNoteHeaderHolder.textNum = (TextView) findViewById(R.id.text_num);
mNoteHeaderHolder.ibSetBgColor.setOnClickListener(this);
mNoteEditor = (EditText) findViewById(R.id.note_edit_view);
mNoteEditorPanel = findViewById(R.id.sv_note_edit);
@@ -538,8 +608,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
int itemId = item.getItemId();
if (itemId == R.id.menu_new_note) {
createNewNote();
- }
- else if (itemId == R.id.menu_delete) {
+ } else if (itemId == R.id.menu_delete) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(R.string.alert_title_delete));
builder.setIcon(android.R.drawable.ic_dialog_alert);
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/java/net/micode/notes/ui/SplashActivity.java b/src/main/java/net/micode/notes/ui/SplashActivity.java
new file mode 100644
index 0000000..6a93d7f
--- /dev/null
+++ b/src/main/java/net/micode/notes/ui/SplashActivity.java
@@ -0,0 +1,53 @@
+package net.micode.notes.ui;
+
+import android.annotation.SuppressLint;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.WindowInsets;
+
+import android.content.Intent;
+
+import net.micode.notes.databinding.ActivitySplashBinding;
+import net.micode.notes.R;
+
+/**
+ * An example full-screen activity that shows and hides the system UI (i.e.
+ * status bar and navigation/system bar) with user interaction.
+ */
+public class SplashActivity extends AppCompatActivity {
+ /**
+ * Whether or not the system UI should be auto-hidden after
+ * {@link #AUTO_HIDE_DELAY_MILLIS} milliseconds.
+ */
+ private static final boolean AUTO_HIDE = true;
+
+ /**
+ * If {@link #AUTO_HIDE} is set, the number of milliseconds to wait after
+ * user interaction before hiding the system UI.
+ */
+ private static final int AUTO_HIDE_DELAY_MILLIS = 3000;
+
+ Handler mHandler=new Handler();
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState); //加载启动界面
+ setContentView(R.layout.activity_splash); //加载启动图片
+
+ // 当计时结束时,跳转至NotesListActivity
+ mHandler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ Intent intent=new Intent();
+ intent.setClass(SplashActivity.this, NotesListActivity.class);
+ startActivity(intent);
+ finish(); //销毁欢迎页面
+ }
+ }, 2000); // 2 秒后跳转
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/micode/notes/widget/NoteWidgetProvider.java b/src/main/java/net/micode/notes/widget/NoteWidgetProvider.java
index d1eff49..d8eb50b 100644
--- a/src/main/java/net/micode/notes/widget/NoteWidgetProvider.java
+++ b/src/main/java/net/micode/notes/widget/NoteWidgetProvider.java
@@ -46,7 +46,6 @@ public abstract class NoteWidgetProvider extends AppWidgetProvider {
NoteColumns.SNIPPET
};
-
public static final int COLUMN_ID = 0;
public static final int COLUMN_BG_COLOR_ID = 1;
public static final int COLUMN_SNIPPET = 2;
diff --git a/src/main/res/drawable-hdpi/bg_dark.png b/src/main/res/drawable-hdpi/bg_dark.png
new file mode 100644
index 0000000..7566164
Binary files /dev/null and b/src/main/res/drawable-hdpi/bg_dark.png differ
diff --git a/src/main/res/drawable-hdpi/bg_light.png b/src/main/res/drawable-hdpi/bg_light.png
new file mode 100644
index 0000000..e34a867
Binary files /dev/null and b/src/main/res/drawable-hdpi/bg_light.png differ
diff --git a/src/main/res/drawable-hdpi/icon_app_1.png b/src/main/res/drawable-hdpi/icon_app_1.png
new file mode 100644
index 0000000..96f4a88
Binary files /dev/null and b/src/main/res/drawable-hdpi/icon_app_1.png differ
diff --git a/src/main/res/drawable-hdpi/splash.png b/src/main/res/drawable-hdpi/splash.png
new file mode 100644
index 0000000..962d168
Binary files /dev/null and b/src/main/res/drawable-hdpi/splash.png differ
diff --git a/src/main/res/layout/activity_splash.xml b/src/main/res/layout/activity_splash.xml
new file mode 100644
index 0000000..a255285
--- /dev/null
+++ b/src/main/res/layout/activity_splash.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/note_edit.xml b/src/main/res/layout/note_edit.xml
index 10b2aa7..59415d7 100644
--- a/src/main/res/layout/note_edit.xml
+++ b/src/main/res/layout/note_edit.xml
@@ -30,6 +30,7 @@
android:id="@+id/note_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
+
+
+
+ android:textAppearance="@style/TextAppearancePrimaryItem" />
+ android:background="@drawable/bg_light">
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/res/menu/sub_folder.xml b/src/main/res/menu/sub_folder.xml
index b00de26..d81e568 100644
--- a/src/main/res/menu/sub_folder.xml
+++ b/src/main/res/menu/sub_folder.xml
@@ -21,4 +21,20 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/values-night/themes.xml b/src/main/res/values-night/themes.xml
new file mode 100644
index 0000000..95a787f
--- /dev/null
+++ b/src/main/res/values-night/themes.xml
@@ -0,0 +1,7 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/values-zh-rCN/strings.xml b/src/main/res/values-zh-rCN/strings.xml
index 09f75ed..dacfe89 100644
--- a/src/main/res/values-zh-rCN/strings.xml
+++ b/src/main/res/values-zh-rCN/strings.xml
@@ -119,6 +119,14 @@
便签
设置
取消
+ 亮背景
+ 暗背景
+ 私密模式
+ 退出私密模式
+ 字符数
+ 恢复
+ 欢迎页面
+ EAZZY\nNOTE
- %1$s 条符合“%2$s”的搜索结果
diff --git a/src/main/res/values-zh-rTW/strings.xml b/src/main/res/values-zh-rTW/strings.xml
index e29b79b..1bfa120 100644
--- a/src/main/res/values-zh-rTW/strings.xml
+++ b/src/main/res/values-zh-rTW/strings.xml
@@ -120,6 +120,14 @@
便籤
設置
取消
+ 亮背景
+ 暗背景
+ 私密模式
+ 退出私密模式
+ 字符数
+ 恢复
+ 欢迎页面
+ EAZZY\nNOTE
- %1$s 條符合”%2$s“的搜尋結果
diff --git a/src/main/res/values/attrs.xml b/src/main/res/values/attrs.xml
new file mode 100644
index 0000000..e52391d
--- /dev/null
+++ b/src/main/res/values/attrs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/values/colors.xml b/src/main/res/values/colors.xml
index 123ffbf..2496c0c 100644
--- a/src/main/res/values/colors.xml
+++ b/src/main/res/values/colors.xml
@@ -17,4 +17,9 @@
#335b5b5b
+ #FF039BE5
+ #FF01579B
+ #FF40C4FF
+ #FF00B0FF
+ #66000000
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 55df868..469b04c 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -15,8 +15,7 @@
limitations under the License.
-->
-
+
Notes
Notes 2x2
Notes 4x4
@@ -126,10 +125,24 @@
Notes
set
cancel
+
+ light mode
+ dark mode
+
+ secret mode
+ quit secret mode
+
+ length
+ restore
+
+ SplashActivity
+ EAZZY\nNOTE
+
- - %1$s result for \"%2$s\"
+ - %1$s result for \"%2$s\"
- - %1$s results for \"%2$s\"
+ - %1$s results for \"%2$s\"
+
diff --git a/src/main/res/values/styles.xml b/src/main/res/values/styles.xml
index ad0d90d..db56d26 100644
--- a/src/main/res/values/styles.xml
+++ b/src/main/res/values/styles.xml
@@ -16,18 +16,22 @@
-->
+
+
+
+
@@ -66,4 +70,13 @@
- visible
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml
new file mode 100644
index 0000000..a0f1516
--- /dev/null
+++ b/src/main/res/values/themes.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
\ No newline at end of file