From d88a65106d34951a19dffb3eeccdd55664105766 Mon Sep 17 00:00:00 2001 From: zkx Date: Wed, 20 Dec 2023 23:57:21 +0800 Subject: [PATCH] cmt: track onCreate 50% --- src/main/java/net/micode/notes/model/WorkingNote.java | 8 ++++++++ src/main/java/net/micode/notes/ui/NoteEditActivity.java | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/micode/notes/model/WorkingNote.java b/src/main/java/net/micode/notes/model/WorkingNote.java index caaed12..87fbd8a 100644 --- a/src/main/java/net/micode/notes/model/WorkingNote.java +++ b/src/main/java/net/micode/notes/model/WorkingNote.java @@ -176,6 +176,14 @@ public class WorkingNote { public static WorkingNote createEmptyNote(Context context, long folderId, int widgetId, int widgetType, int defaultBgColorId) { + /** + * @method: createEmptyNote + * @description: 创建一个空的工作便签,根据传入参数,设置好背景色、是否为挂件等 + * @date: 2023/12/20 23:55 + * @author: zhoukexing + * @param: [context, folderId, widgetId, widgetType, defaultBgColorId] + * @return: net.micode.notes.model.WorkingNote 返回一个WorkingNote实例 + */ WorkingNote note = new WorkingNote(context, folderId); note.setBgColorId(defaultBgColorId); note.setWidgetId(widgetId); diff --git a/src/main/java/net/micode/notes/ui/NoteEditActivity.java b/src/main/java/net/micode/notes/ui/NoteEditActivity.java index 03aef1b..94fd5f5 100644 --- a/src/main/java/net/micode/notes/ui/NoteEditActivity.java +++ b/src/main/java/net/micode/notes/ui/NoteEditActivity.java @@ -172,6 +172,7 @@ public class NoteEditActivity extends Activity //NOTE: extends--单继承,但 this.setContentView(R.layout.note_edit); if (savedInstanceState == null && !initActivityState(getIntent())) { + // savedInstanceState? @zhoukexing 2023/12/20 23:45 finish(); return; } @@ -250,6 +251,7 @@ public class NoteEditActivity extends Activity //NOTE: extends--单继承,但 ResourceParser.getDefaultBgId(this)); // Parse call-record note + // 解析文档,看是否有号码存在,以便展示的时候渲染 @zhoukexing 2023/12/20 23:49 String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); long callDate = intent.getLongExtra(Notes.INTENT_EXTRA_CALL_DATE, 0); if (callDate != 0 && phoneNumber != null) { @@ -259,6 +261,7 @@ public class NoteEditActivity extends Activity //NOTE: extends--单继承,但 long noteId = 0; if ((noteId = DataUtils.getNoteIdByPhoneNumberAndCallDate(getContentResolver(), phoneNumber, callDate)) > 0) { + // TODO: 2023/12/20 mWorkingNote = WorkingNote.load(this, noteId); if (mWorkingNote == null) { Log.e(TAG, "load call note failed with note id" + noteId); @@ -270,7 +273,7 @@ public class NoteEditActivity extends Activity //NOTE: extends--单继承,但 widgetType, bgResId); mWorkingNote.convertToCallNote(phoneNumber, callDate); } - } else { + } else { // 没有要显示的电话 mWorkingNote = WorkingNote.createEmptyNote(this, folderId, widgetId, widgetType, bgResId); }