批注了model包,上传两个报告进行期中测评

pull/9/head
夏彦博 11 months ago
parent 6b3a15d3b9
commit 204772e78e

@ -1,2 +0,0 @@
# xiaomi_mini

@ -33,78 +33,102 @@ import net.micode.notes.data.Notes.TextNote;
import java.util.ArrayList;
/**
* @classname: Note
* @description:便便
* 便
* @date: 2024/1/2 21:31
* @author: Xia Yanbo
*/
public class Note {
private ContentValues mNoteDiffValues;
private NoteData mNoteData;
private static final String TAG = "Note";
/**
* Create a new note id for adding a new note to databases
* @classname: Note
* @description:便
* @date: 2024/1/2 20:36
* @author: Xia Yanbo
* @param:context
* @param:folderId id
* @return:noteIDid
*/
public static synchronized long getNewNoteId(Context context, long folderId) {
public static synchronized long getNewNoteId(Context context, long folderId) {//控制类的所有实例的并发访问
// Create a new note in the database
//初始化变量的信息
ContentValues values = new ContentValues();
long createdTime = System.currentTimeMillis();
values.put(NoteColumns.CREATED_DATE, createdTime);
values.put(NoteColumns.MODIFIED_DATE, createdTime);
values.put(NoteColumns.TYPE, Notes.TYPE_NOTE);
values.put(NoteColumns.LOCAL_MODIFIED, 1);
values.put(NoteColumns.PARENT_ID, folderId);
Uri uri = context.getContentResolver().insert(Notes.CONTENT_NOTE_URI, values);
values.put(NoteColumns.CREATED_DATE, createdTime);//创建时间
values.put(NoteColumns.MODIFIED_DATE, createdTime);//修改时间
values.put(NoteColumns.TYPE, Notes.TYPE_NOTE);//便签类型
values.put(NoteColumns.LOCAL_MODIFIED, 1);//本地修改位,表示在本地被修改过与否
values.put(NoteColumns.PARENT_ID, folderId);//所属包的id
Uri uri = context.getContentResolver().insert(Notes.CONTENT_NOTE_URI, values);//插入新的便签记录(标记)
long noteId = 0;
try {
noteId = Long.valueOf(uri.getPathSegments().get(1));
} catch (NumberFormatException e) {
noteId = Long.valueOf(uri.getPathSegments().get(1));//获取新笔记纪录的id
} catch (NumberFormatException e) {//获取失败报错
Log.e(TAG, "Get note id error :" + e.toString());
noteId = 0;
}
//如果noteid为-1抛出id错误的信息
if (noteId == -1) {
throw new IllegalStateException("Wrong note id:" + noteId);
}
return noteId;
}
//初始化定义两个变量用来存储便签的数据,一个是存储便签属性、一个是存储便签内容
public Note() {
mNoteDiffValues = new ContentValues();
mNoteData = new NoteData();
mNoteDiffValues = new ContentValues();//便签属性
mNoteData = new NoteData();//便签内容
}
//设置便签的属性
public void setNoteValue(String key, String value) {
mNoteDiffValues.put(key, value);
mNoteDiffValues.put(NoteColumns.LOCAL_MODIFIED, 1);
mNoteDiffValues.put(NoteColumns.MODIFIED_DATE, System.currentTimeMillis());
mNoteDiffValues.put(key, value);//键值id
mNoteDiffValues.put(NoteColumns.LOCAL_MODIFIED, 1);//本地编辑修改位
mNoteDiffValues.put(NoteColumns.MODIFIED_DATE, System.currentTimeMillis());//修改日期
}
//设置文本数据(标记)
public void setTextData(String key, String value) {
mNoteData.setTextData(key, value);
}
//设置文本数据的id
public void setTextDataId(long id) {
mNoteData.setTextDataId(id);
}
//获取文本数据的id
public long getTextDataId() {
return mNoteData.mTextDataId;
}
//设置通话数据的id
public void setCallDataId(long id) {
mNoteData.setCallDataId(id);
}
//设置通话数据
public void setCallData(String key, String value) {
mNoteData.setCallData(key, value);
}
//判断本地的文件有没有被修改
public boolean isLocalModified() {
return mNoteDiffValues.size() > 0 || mNoteData.isLocalModified();
}
/**
* @classname: Note
* @methodname syncNote
* @description:便
* @date: 2024/1/2 20:54
* @author: Xia Yanbo
* @param:context
* @param:noteid便id
* @return:boolean
*/
public boolean syncNote(Context context, long noteId) {
if (noteId <= 0) {
throw new IllegalArgumentException("Wrong note id:" + noteId);
}
//没有修改过则不需要更新
if (!isLocalModified()) {
return true;
}
@ -112,7 +136,7 @@ public class Note {
/**
* In theory, once data changed, the note should be updated on {@link NoteColumns#LOCAL_MODIFIED} and
* {@link NoteColumns#MODIFIED_DATE}. For data safety, though update note fails, we also update the
* note data info
* note data info
*/
if (context.getContentResolver().update(
ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId), mNoteDiffValues, null,
@ -120,8 +144,8 @@ public class Note {
Log.e(TAG, "Update note error, should not happen");
// Do not return, fall through
}
mNoteDiffValues.clear();
mNoteDiffValues.clear();//清除属性
//如果笔记在本地被修改过并且推送至ContentResolver失败则返回false
if (mNoteData.isLocalModified()
&& (mNoteData.pushIntoContentResolver(context, noteId) == null)) {
return false;
@ -131,86 +155,97 @@ public class Note {
}
private class NoteData {
private long mTextDataId;
private ContentValues mTextDataValues;
private long mTextDataId;//文本数据的id
private long mCallDataId;
private ContentValues mTextDataValues;//存储文本数据的键值对
private ContentValues mCallDataValues;
private long mCallDataId;//通话数据的id
private static final String TAG = "NoteData";
private ContentValues mCallDataValues;//存储通话数据
private static final String TAG = "NoteData";//记录标签,为日志记录打上标签。
//给新来的见证便签的键值以及id
public NoteData() {
mTextDataValues = new ContentValues();
mCallDataValues = new ContentValues();
mTextDataId = 0;
mCallDataId = 0;
}
//比较文本大小,确定是否被修改过
boolean isLocalModified() {
return mTextDataValues.size() > 0 || mCallDataValues.size() > 0;
}
//设置文本数据的id
void setTextDataId(long id) {
if(id <= 0) {
throw new IllegalArgumentException("Text data id should larger than 0");
}
mTextDataId = id;
}
//设置通话数据的id
void setCallDataId(long id) {
if (id <= 0) {
throw new IllegalArgumentException("Call data id should larger than 0");
}
mCallDataId = id;
}
//设置通话数据的id
void setCallData(String key, String value) {
mCallDataValues.put(key, value);
mNoteDiffValues.put(NoteColumns.LOCAL_MODIFIED, 1);
mNoteDiffValues.put(NoteColumns.MODIFIED_DATE, System.currentTimeMillis());
}
//设置文本数据
void setTextData(String key, String value) {
mTextDataValues.put(key, value);
mNoteDiffValues.put(NoteColumns.LOCAL_MODIFIED, 1);
mNoteDiffValues.put(NoteColumns.MODIFIED_DATE, System.currentTimeMillis());
}
/**
* @classname: NoteData
* @methodname pushIntoContentResolver
* @description:
* @date: 2024/1/2 21:10
* @author: Xia Yanbo
* @param:noteId便id
* @param:context
* @return:uri
*/
Uri pushIntoContentResolver(Context context, long noteId) {
/**
* Check for safety
*/
//检查笔记的id是否正确
if (noteId <= 0) {
throw new IllegalArgumentException("Wrong note id:" + noteId);
}
//创建行动列表
ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>();
ContentProviderOperation.Builder builder = null;
//如果文本数据不为空,进行更新操作
if(mTextDataValues.size() > 0) {
mTextDataValues.put(DataColumns.NOTE_ID, noteId);
// 如果文本数据ID为0说明是新插入的数据
if (mTextDataId == 0) {
mTextDataValues.put(DataColumns.MIME_TYPE, TextNote.CONTENT_ITEM_TYPE);
Uri uri = context.getContentResolver().insert(Notes.CONTENT_DATA_URI,
mTextDataValues);
mTextDataValues);//设置对应的关键键值,插入新的文本数据
try {
setTextDataId(Long.valueOf(uri.getPathSegments().get(1)));
} catch (NumberFormatException e) {
setTextDataId(Long.valueOf(uri.getPathSegments().get(1)));//获取数据的id
} catch (NumberFormatException e) {//获取失败打印错误信息
Log.e(TAG, "Insert new text data fail with noteId" + noteId);
mTextDataValues.clear();
return null;
}
} else {
} else {//创建一个更新操作,并设置更新的数据和条件
builder = ContentProviderOperation.newUpdate(ContentUris.withAppendedId(
Notes.CONTENT_DATA_URI, mTextDataId));
builder.withValues(mTextDataValues);
operationList.add(builder.build());
operationList.add(builder.build());//将更新操作添加到操作列表中
}
mTextDataValues.clear();
}
//同理如果通信数据不为空,进行更新操作
if(mCallDataValues.size() > 0) {
mCallDataValues.put(DataColumns.NOTE_ID, noteId);
if (mCallDataId == 0) {
@ -232,19 +267,19 @@ public class Note {
}
mCallDataValues.clear();
}
//行动列表非空
if (operationList.size() > 0) {
try {
try { // 使用内容解析器ContentResolver的applyBatch方法来批量执行操作列表中的操作
ContentProviderResult[] results = context.getContentResolver().applyBatch(
Notes.AUTHORITY, operationList);
return (results == null || results.length == 0 || results[0] == null) ? null
: ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId);
: ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId);//返回操作完成后的结果
} catch (RemoteException e) {
Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));
return null;
} catch (OperationApplicationException e) {
Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));
return null;
return null;//报错反馈
}
}
return null;

@ -31,37 +31,43 @@ import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.data.Notes.TextNote;
import net.micode.notes.tool.ResourceParser.NoteBgResources;
/**
* @classname: WorkingNote
* @description:便便便
* 便
* @date: 2024/1/4 11:03
* @author: Xia Yanbo
*/
public class WorkingNote {
// Note for the working note
private Note mNote;
private Note mNote;//便签对象
// Note Id
private long mNoteId;
private long mNoteId;//便签的id
// Note content
private String mContent;
private String mContent;//内容字符串
// Note mode
private int mMode;
private long mAlertDate;
private int mMode;//便签所处的模式(任务清单/普通)
private long mModifiedDate;
private long mAlertDate;//提醒时间
private int mBgColorId;
private long mModifiedDate;//修改日期
private int mWidgetId;
private int mBgColorId;//背景颜色
private int mWidgetType;
private int mWidgetId;//小插件的id号
private long mFolderId;
private int mWidgetType;//小插件的类型
private Context mContext;
private long mFolderId;//所属便签包的id号
private static final String TAG = "WorkingNote";
private Context mContext;//便签的上下文
private boolean mIsDeleted;
private static final String TAG = "WorkingNote";//用于接收日志的标签
private NoteSettingChangedListener mNoteSettingStatusListener;
private boolean mIsDeleted;//表示是否已经被删除
private NoteSettingChangedListener mNoteSettingStatusListener;//设置一个监听器,监听便签设置的改变
//定义数据的字段
public static final String[] DATA_PROJECTION = new String[] {
DataColumns.ID,
DataColumns.CONTENT,
@ -71,7 +77,7 @@ public class WorkingNote {
DataColumns.DATA3,
DataColumns.DATA4,
};
//定义便签的字段
public static final String[] NOTE_PROJECTION = new String[] {
NoteColumns.PARENT_ID,
NoteColumns.ALERTED_DATE,
@ -80,7 +86,7 @@ public class WorkingNote {
NoteColumns.WIDGET_TYPE,
NoteColumns.MODIFIED_DATE
};
//数据相关的参数
private static final int DATA_ID_COLUMN = 0;
private static final int DATA_CONTENT_COLUMN = 1;
@ -88,7 +94,7 @@ public class WorkingNote {
private static final int DATA_MIME_TYPE_COLUMN = 2;
private static final int DATA_MODE_COLUMN = 3;
//便签相关的参数
private static final int NOTE_PARENT_ID_COLUMN = 0;
private static final int NOTE_ALERTED_DATE_COLUMN = 1;
@ -102,19 +108,38 @@ public class WorkingNote {
private static final int NOTE_MODIFIED_DATE_COLUMN = 5;
// New note construct
/**
* @classname: WorkingNote
* @methodname WorkingNote
* @description:便
* @date: 2024/1/3 19:26
* @author: Xia Yanbo
* @param:context
* @param:folderIdid
*/
private WorkingNote(Context context, long folderId) {
mContext = context;
mAlertDate = 0;
mModifiedDate = System.currentTimeMillis();
mFolderId = folderId;
mNote = new Note();
mNoteId = 0;
mNoteId = 0;//初始化笔记id为0
mIsDeleted = false;
mMode = 0;
mWidgetType = Notes.TYPE_WIDGET_INVALIDE;
}
// Existing note construct
/**
* @classname: WorkingNote
* @methodname WorkingNote
* @description:使
* @date: 2024/1/3 21:33
* @author: Xia Yanbo
* @param:context
* @param:noteIdid
* @param:folderIdid
*/
private WorkingNote(Context context, long noteId, long folderId) {
mContext = context;
mNoteId = noteId;
@ -123,14 +148,23 @@ public class WorkingNote {
mNote = new Note();
loadNote();
}
/**
* @classname: WorkingNote
* @methodname loadNote
* @description:/便
* @date: 2024/1/3 21:34
* @author: Xia Yanbo
*/
private void loadNote() {
//查询数据库获取与给定笔记id关联的笔记
Cursor cursor = mContext.getContentResolver().query(
ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, mNoteId), NOTE_PROJECTION, null,
null, null);
if (cursor != null) {
//如果cursor不为空移动到结果集的第一行
if (cursor.moveToFirst()) {
//从结果集获取各个属性值
mFolderId = cursor.getLong(NOTE_PARENT_ID_COLUMN);
mBgColorId = cursor.getInt(NOTE_BG_COLOR_ID_COLUMN);
mWidgetId = cursor.getInt(NOTE_WIDGET_ID_COLUMN);
@ -139,33 +173,43 @@ public class WorkingNote {
mModifiedDate = cursor.getLong(NOTE_MODIFIED_DATE_COLUMN);
}
cursor.close();
} else {
} else {//如果找不到关联的笔记抛出异常
Log.e(TAG, "No note with id:" + mNoteId);
throw new IllegalArgumentException("Unable to find note with id " + mNoteId);
}
// 调用loadNoteData方法继续加载与笔记相关的其他数据标记
loadNoteData();
}
/**
* @classname: WorkingNote
* @methodname loadNoteData
* @description:便
* @date: 2024/1/3 21:48
* @author: Xia Yanbo
*/
private void loadNoteData() {
//查询数据库获取与给定笔记id关联的笔记
Cursor cursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI, DATA_PROJECTION,
DataColumns.NOTE_ID + "=?", new String[] {
String.valueOf(mNoteId)
}, null);
if (cursor != null) {
//光标移动到查询结果的第一行
if (cursor.moveToFirst()) {
do {
String type = cursor.getString(DATA_MIME_TYPE_COLUMN);
String type = cursor.getString(DATA_MIME_TYPE_COLUMN);//获取当前笔记的类型
//如果笔记是普通的笔记获取笔记内容、模式、id等参数完成赋值
if (DataConstants.NOTE.equals(type)) {
mContent = cursor.getString(DATA_CONTENT_COLUMN);
mMode = cursor.getInt(DATA_MODE_COLUMN);
mNote.setTextDataId(cursor.getLong(DATA_ID_COLUMN));
} else if (DataConstants.CALL_NOTE.equals(type)) {
} else if (DataConstants.CALL_NOTE.equals(type)) {//如果数据是通话数据从数据行中直接获取数据id
mNote.setCallDataId(cursor.getLong(DATA_ID_COLUMN));
} else {
Log.d(TAG, "Wrong note type with type:" + type);
}
} while (cursor.moveToNext());
} while (cursor.moveToNext());//光标移动到下一行
}
cursor.close();
} else {
@ -173,7 +217,7 @@ public class WorkingNote {
throw new IllegalArgumentException("Unable to find note's data with id " + mNoteId);
}
}
//创建一个空的便签设置属性以及资源的id号等等信息
public static WorkingNote createEmptyNote(Context context, long folderId, int widgetId,
int widgetType, int defaultBgColorId) {
WorkingNote note = new WorkingNote(context, folderId);
@ -182,15 +226,17 @@ public class WorkingNote {
note.setWidgetType(widgetType);
return note;
}
//读取便签的内容
public static WorkingNote load(Context context, long id) {
return new WorkingNote(context, id, 0);
}
public synchronized boolean saveNote() {
//检查笔记是否有保存的价值
if (isWorthSaving()) {
if (!existInDatabase()) {
if ((mNoteId = Note.getNewNoteId(mContext, mFolderId)) == 0) {
// 如果不在数据库里根据包的id和上下文获取一个新的笔记ID如果获取失败则返回false并记录日志
if ((mNoteId = Note.getNewNoteId(mContext, mFolderId)) == 0) {//获取失败返回的id是0
Log.e(TAG, "Create new note fail with id:" + mNoteId);
return false;
}
@ -200,6 +246,7 @@ public class WorkingNote {
/**
* Update widget content if there exist any widget of this note
*
*/
if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID
&& mWidgetType != Notes.TYPE_WIDGET_INVALIDE
@ -211,12 +258,13 @@ public class WorkingNote {
return false;
}
}
//检查是否位于数据库中
public boolean existInDatabase() {
return mNoteId > 0;
}
//检查便签是否具有保存的价值
private boolean isWorthSaving() {
//如果在数据库中已经存在而本地没有修改,或者便签已被删除了,或者便签为空,不值得保存
if (mIsDeleted || (!existInDatabase() && TextUtils.isEmpty(mContent))
|| (existInDatabase() && !mNote.isLocalModified())) {
return false;
@ -224,11 +272,11 @@ public class WorkingNote {
return true;
}
}
//设置笔记设置状态的监听器为工作状态
public void setOnSettingStatusChangedListener(NoteSettingChangedListener l) {
mNoteSettingStatusListener = l;
}
//设置提醒的日期
public void setAlertDate(long date, boolean set) {
if (date != mAlertDate) {
mAlertDate = date;
@ -238,7 +286,7 @@ public class WorkingNote {
mNoteSettingStatusListener.onClockAlertChanged(date, set);
}
}
//删除标记值
public void markDeleted(boolean mark) {
mIsDeleted = mark;
if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID
@ -247,6 +295,7 @@ public class WorkingNote {
}
}
//设置背景的颜色id
public void setBgColorId(int id) {
if (id != mBgColorId) {
mBgColorId = id;
@ -256,9 +305,10 @@ public class WorkingNote {
mNote.setNoteValue(NoteColumns.BG_COLOR_ID, String.valueOf(id));
}
}
//设置任务清单模式
public void setCheckListMode(int mode) {
if (mMode != mode) {
//进行任务清单模式必要组件的的设置
if (mNoteSettingStatusListener != null) {
mNoteSettingStatusListener.onCheckListModeChanged(mMode, mode);
}
@ -266,7 +316,7 @@ public class WorkingNote {
mNote.setTextData(TextNote.MODE, String.valueOf(mMode));
}
}
//设定组件相关的类型id等信息
public void setWidgetType(int type) {
if (type != mWidgetType) {
mWidgetType = type;
@ -280,24 +330,25 @@ public class WorkingNote {
mNote.setNoteValue(NoteColumns.WIDGET_ID, String.valueOf(mWidgetId));
}
}
//设置当前工作便签的文本
public void setWorkingText(String text) {
if (!TextUtils.equals(mContent, text)) {
mContent = text;
mContent = text;//文本不一样时更新内容
mNote.setTextData(DataColumns.CONTENT, mContent);
}
}
//将便签转化为通话便签
public void convertToCallNote(String phoneNumber, long callDate) {
mNote.setCallData(CallNote.CALL_DATE, String.valueOf(callDate));
mNote.setCallData(CallNote.PHONE_NUMBER, phoneNumber);
mNote.setNoteValue(NoteColumns.PARENT_ID, String.valueOf(Notes.ID_CALL_RECORD_FOLDER));
}
//获取是否设置有提醒
public boolean hasClockAlert() {
return (mAlertDate > 0 ? true : false);
}
//根据需要,返回对应的参数值
public String getContent() {
return mContent;
}
@ -341,7 +392,13 @@ public class WorkingNote {
public int getWidgetType() {
return mWidgetType;
}
/**
* @classname: WorkingNote
* @description:便
*
* @date: 2024/1/4 9:22
* @author: Xia Yanbo
*/
public interface NoteSettingChangedListener {
/**
* Called when the background color of current note has just changed
@ -355,6 +412,7 @@ public class WorkingNote {
/**
* Call when user create note from widget
*
*/
void onWidgetChanged();

@ -95,38 +95,28 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
NOTE_LIST, SUB_FOLDER, CALL_RECORD_FOLDER
};
private ListEditState mState;
private BackgroundQueryHandler mBackgroundQueryHandler;
private NotesListAdapter mNotesListAdapter;
private ListView mNotesListView;
private Button mAddNewNote;
private boolean mDispatch;
private int mOriginY;
private int mDispatchY;
private TextView mTitleBar;
private long mCurrentFolderId;
private ContentResolver mContentResolver;
private ModeCallback mModeCallBack;
// 声明一些私有成员变量。
private ListEditState mState; // 当前列表的编辑状态
private BackgroundQueryHandler mBackgroundQueryHandler; // 用于在后台执行查询的处理程序
private NotesListAdapter mNotesListAdapter; // 笔记列表的适配器
private ListView mNotesListView; // 显示笔记列表的视图
private Button mAddNewNote; // 添加新笔记的按钮
private boolean mDispatch; // 一个标志,可能用于控制事件分发
private int mOriginY; // 原始Y坐标可能用于触摸事件处理
private int mDispatchY; // 分发的Y坐标也可能用于触摸事件处理
private TextView mTitleBar; // 标题栏文本视图
private long mCurrentFolderId; // 当前文件夹的ID
private ContentResolver mContentResolver; // 内容解析器,用于访问应用的数据
private ModeCallback mModeCallBack; // 模式回调接口的实现,可能用于在不同的操作模式之间切换
private static final String TAG = "NotesListActivity";
public static final int NOTES_LISTVIEW_SCROLL_RATE = 30;
//正在关注的笔记数据对象
private NoteItemData mFocusNoteDataItem;
private static final String NORMAL_SELECTION = NoteColumns.PARENT_ID + "=?";
//拼接访问串
private static final String ROOT_FOLDER_SELECTION = "(" + NoteColumns.TYPE + "<>"
+ Notes.TYPE_SYSTEM + " AND " + NoteColumns.PARENT_ID + "=?)" + " OR ("
+ NoteColumns.ID + "=" + Notes.ID_CALL_RECORD_FOLDER + " AND "
@ -134,12 +124,21 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
private final static int REQUEST_CODE_OPEN_NODE = 102;
private final static int REQUEST_CODE_NEW_NODE = 103;
//表示是否在私密模式
public static int secret_mode = 0;
/**
* @classname: NotesListActivity
* @methodname onCreate
* @description:
* @date: 2024/1/4 11:47
* @author: Xia Yanbo
* @param:savedInstanceState
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//根据布局文件呈现菜单视图
setContentView(R.layout.note_list);
initResources();
@ -148,13 +147,25 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
*/
setAppInfoFromRawRes();
}
/**
* @classname: NotesListActivity
* @methodname onActivityResult
* @description:
* @date: 2024/1/4 11:49
* @author: Xia Yanbo
* @param:requestCode
* @param:resultCode
* @param:data
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK
&& (requestCode == REQUEST_CODE_OPEN_NODE || requestCode == REQUEST_CODE_NEW_NODE)) {
// 根据请求的代码类型进行相应的处理
if (resultCode == RESULT_OK // 如果返回的结果码是RESULT_OK表示操作成功
&& (requestCode == REQUEST_CODE_OPEN_NODE || requestCode == REQUEST_CODE_NEW_NODE)) { // 并且请求码是打开节点或新建节点
// 清空笔记列表的适配器游标(可能是在执行打开或新建节点操作后,刷新或重置列表)
mNotesListAdapter.changeCursor(null);
} else {
} else { // 其他情况
// 调用父类的onActivityResult方法将结果传递给上层处理。
super.onActivityResult(requestCode, resultCode, data);
}
}
@ -1017,7 +1028,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
return false;
}
public void setSecretMode() {
public static void setSecretMode() {
if(secret_mode==0)
{
secret_mode=1;

Loading…
Cancel
Save