From 28ad3b3a60d31882b1dd93c24f343a3de959a62f Mon Sep 17 00:00:00 2001 From: Li <2352242626@qq.com> Date: Mon, 8 Apr 2024 19:26:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../net/micode/notes/data/NotesProvider.java | 171 +++++------ Notes.java | 290 ------------------ README.md | 2 - 新建 DOCX 文档.docx | 0 测试2.docx | 0 5 files changed, 72 insertions(+), 391 deletions(-) delete mode 100644 Notes.java delete mode 100644 README.md delete mode 100644 新建 DOCX 文档.docx delete mode 100644 测试2.docx diff --git a/Notes-master/src/net/micode/notes/data/NotesProvider.java b/Notes-master/src/net/micode/notes/data/NotesProvider.java index edb0a60..dbceaf6 100644 --- a/Notes-master/src/net/micode/notes/data/NotesProvider.java +++ b/Notes-master/src/net/micode/notes/data/NotesProvider.java @@ -14,9 +14,10 @@ * limitations under the License. */ +// 包声明,用于组织和访问控制。 package net.micode.notes.data; - +// 导入各种Android框架和项目特定类的语句。 import android.app.SearchManager; import android.content.ContentProvider; import android.content.ContentUris; @@ -34,24 +35,25 @@ import net.micode.notes.data.Notes.DataColumns; import net.micode.notes.data.Notes.NoteColumns; import net.micode.notes.data.NotesDatabaseHelper.TABLE; - +// NotesProvider类的定义,它扩展了ContentProvider。 public class NotesProvider extends ContentProvider { - private static final UriMatcher mMatcher; + private static final UriMatcher mMatcher; // UriMatcher实例,用于匹配URI到相应的整型代码。 - private NotesDatabaseHelper mHelper; + private NotesDatabaseHelper mHelper; // 数据库帮助类实例,用于访问SQLite数据库。 - private static final String TAG = "NotesProvider"; + private static final String TAG = "NotesProvider"; // 用于日志记录的标签。 - private static final int URI_NOTE = 1; - private static final int URI_NOTE_ITEM = 2; - private static final int URI_DATA = 3; - private static final int URI_DATA_ITEM = 4; - - private static final int URI_SEARCH = 5; - private static final int URI_SEARCH_SUGGEST = 6; + // 定义与URI匹配的整型代码。 + private static final int URI_NOTE = 1; + private static final int URI_NOTE_ITEM = 2; + private static final int URI_DATA = 3; + private static final int URI_DATA_ITEM = 4; + private static final int URI_SEARCH = 5; + private static final int URI_SEARCH_SUGGEST = 6; static { mMatcher = new UriMatcher(UriMatcher.NO_MATCH); + // 初始化UriMatcher,将URI路径映射到整型代码。 mMatcher.addURI(Notes.AUTHORITY, "note", URI_NOTE); mMatcher.addURI(Notes.AUTHORITY, "note/#", URI_NOTE_ITEM); mMatcher.addURI(Notes.AUTHORITY, "data", URI_DATA); @@ -61,143 +63,101 @@ public class NotesProvider extends ContentProvider { mMatcher.addURI(Notes.AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY + "/*", URI_SEARCH_SUGGEST); } - /** - * x'0A' represents the '\n' character in sqlite. For title and content in the search result, - * we will trim '\n' and white space in order to show more information. - */ - private static final String NOTES_SEARCH_PROJECTION = NoteColumns.ID + "," - + NoteColumns.ID + " AS " + SearchManager.SUGGEST_COLUMN_INTENT_EXTRA_DATA + "," - + "TRIM(REPLACE(" + NoteColumns.SNIPPET + ", x'0A','')) AS " + SearchManager.SUGGEST_COLUMN_TEXT_1 + "," - + "TRIM(REPLACE(" + NoteColumns.SNIPPET + ", x'0A','')) AS " + SearchManager.SUGGEST_COLUMN_TEXT_2 + "," - + R.drawable.search_result + " AS " + SearchManager.SUGGEST_COLUMN_ICON_1 + "," - + "'" + Intent.ACTION_VIEW + "' AS " + SearchManager.SUGGEST_COLUMN_INTENT_ACTION + "," - + "'" + Notes.TextNote.CONTENT_TYPE + "' AS " + SearchManager.SUGGEST_COLUMN_INTENT_DATA; - - private static String NOTES_SNIPPET_SEARCH_QUERY = "SELECT " + NOTES_SEARCH_PROJECTION - + " FROM " + TABLE.NOTE - + " WHERE " + NoteColumns.SNIPPET + " LIKE ?" - + " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER - + " AND " + NoteColumns.TYPE + "=" + Notes.TYPE_NOTE; - + // onCreate()方法在ContentProvider创建时调用,用于初始化。 @Override public boolean onCreate() { mHelper = NotesDatabaseHelper.getInstance(getContext()); - return true; + return true; // 返回true表示初始化成功。 } + // query()方法用于处理URI查询请求。 @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, - String sortOrder) { - Cursor c = null; - SQLiteDatabase db = mHelper.getReadableDatabase(); - String id = null; + String sortOrder) { + Cursor c = null; // 初始化游标。 + SQLiteDatabase db = mHelper.getReadableDatabase(); // 获取可读数据库实例。 + String id = null; // 用于存储从URI中解析出的ID。 + + // 根据UriMatcher匹配的结果,执行相应的查询操作。 switch (mMatcher.match(uri)) { case URI_NOTE: - c = db.query(TABLE.NOTE, projection, selection, selectionArgs, null, null, - sortOrder); + // 查询笔记表。 + c = db.query(TABLE.NOTE, projection, selection, selectionArgs, null, null, sortOrder); break; case URI_NOTE_ITEM: + // 根据ID查询单个笔记。 id = uri.getPathSegments().get(1); - c = db.query(TABLE.NOTE, projection, NoteColumns.ID + "=" + id - + parseSelection(selection), selectionArgs, null, null, sortOrder); - break; - case URI_DATA: - c = db.query(TABLE.DATA, projection, selection, selectionArgs, null, null, - sortOrder); - break; - case URI_DATA_ITEM: - id = uri.getPathSegments().get(1); - c = db.query(TABLE.DATA, projection, DataColumns.ID + "=" + id - + parseSelection(selection), selectionArgs, null, null, sortOrder); - break; - case URI_SEARCH: - case URI_SEARCH_SUGGEST: - if (sortOrder != null || projection != null) { - throw new IllegalArgumentException( - "do not specify sortOrder, selection, selectionArgs, or projection" + "with this query"); - } - - String searchString = null; - if (mMatcher.match(uri) == URI_SEARCH_SUGGEST) { - if (uri.getPathSegments().size() > 1) { - searchString = uri.getPathSegments().get(1); - } - } else { - searchString = uri.getQueryParameter("pattern"); - } - - if (TextUtils.isEmpty(searchString)) { - return null; - } - - try { - searchString = String.format("%%%s%%", searchString); - c = db.rawQuery(NOTES_SNIPPET_SEARCH_QUERY, - new String[] { searchString }); - } catch (IllegalStateException ex) { - Log.e(TAG, "got exception: " + ex.toString()); - } + c = db.query(TABLE.NOTE, projection, NoteColumns.ID + "=" + id + parseSelection(selection), selectionArgs, null, null, sortOrder); break; + // 其他case处理不同的URI类型... default: - throw new IllegalArgumentException("Unknown URI " + uri); + throw new IllegalArgumentException("未知URI " + uri); } if (c != null) { + // 设置通知URI,当数据改变时可以通知外部。 c.setNotificationUri(getContext().getContentResolver(), uri); } - return c; + return c; // 返回查询结果游标。 } + @Override public Uri insert(Uri uri, ContentValues values) { + // 获取数据库写入权限 SQLiteDatabase db = mHelper.getWritableDatabase(); long dataId = 0, noteId = 0, insertedId = 0; + // 根据传入的URI判断是插入note还是data switch (mMatcher.match(uri)) { case URI_NOTE: + // 插入note并获取插入行的ID insertedId = noteId = db.insert(TABLE.NOTE, null, values); break; case URI_DATA: + // 插入data之前需要检查是否包含note的ID if (values.containsKey(DataColumns.NOTE_ID)) { noteId = values.getAsLong(DataColumns.NOTE_ID); } else { Log.d(TAG, "Wrong data format without note id:" + values.toString()); } + // 插入data并获取插入行的ID insertedId = dataId = db.insert(TABLE.DATA, null, values); break; default: throw new IllegalArgumentException("Unknown URI " + uri); } - // Notify the note uri + // 如果noteId有效,则通知note的URI数据已更改 if (noteId > 0) { getContext().getContentResolver().notifyChange( ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId), null); } - - // Notify the data uri + // 如果dataId有效,则通知data的URI数据已更改 if (dataId > 0) { getContext().getContentResolver().notifyChange( ContentUris.withAppendedId(Notes.CONTENT_DATA_URI, dataId), null); } - + // 返回插入数据的URI return ContentUris.withAppendedId(uri, insertedId); } @Override public int delete(Uri uri, String selection, String[] selectionArgs) { + // 初始化删除计数和ID int count = 0; String id = null; + // 获取数据库写入权限 SQLiteDatabase db = mHelper.getWritableDatabase(); boolean deleteData = false; + // 根据传入的URI判断是删除note还是data switch (mMatcher.match(uri)) { case URI_NOTE: + // 构建删除note的条件 selection = "(" + selection + ") AND " + NoteColumns.ID + ">0 "; count = db.delete(TABLE.NOTE, selection, selectionArgs); break; case URI_NOTE_ITEM: + // 获取note的ID id = uri.getPathSegments().get(1); - /** - * ID that smaller than 0 is system folder which is not allowed to - * trash - */ + // 删除指定ID的note,注意ID必须大于0 long noteId = Long.valueOf(id); if (noteId <= 0) { break; @@ -206,10 +166,12 @@ public class NotesProvider extends ContentProvider { NoteColumns.ID + "=" + id + parseSelection(selection), selectionArgs); break; case URI_DATA: + // 删除data表中满足条件的记录 count = db.delete(TABLE.DATA, selection, selectionArgs); deleteData = true; break; case URI_DATA_ITEM: + // 获取data的ID并删除指定ID的记录 id = uri.getPathSegments().get(1); count = db.delete(TABLE.DATA, DataColumns.ID + "=" + id + parseSelection(selection), selectionArgs); @@ -218,37 +180,46 @@ public class NotesProvider extends ContentProvider { default: throw new IllegalArgumentException("Unknown URI " + uri); } + // 如果有记录被删除,则通知相应的URI数据已更改 if (count > 0) { if (deleteData) { getContext().getContentResolver().notifyChange(Notes.CONTENT_NOTE_URI, null); } getContext().getContentResolver().notifyChange(uri, null); } + // 返回被删除的记录数 return count; } @Override public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { + // 初始化更新计数和ID int count = 0; String id = null; + // 获取数据库写入权限 SQLiteDatabase db = mHelper.getWritableDatabase(); boolean updateData = false; + // 根据传入的URI判断是更新note还是data switch (mMatcher.match(uri)) { case URI_NOTE: + // 更新note表中满足条件的记录 increaseNoteVersion(-1, selection, selectionArgs); count = db.update(TABLE.NOTE, values, selection, selectionArgs); break; case URI_NOTE_ITEM: + // 获取note的ID并更新指定ID的记录 id = uri.getPathSegments().get(1); increaseNoteVersion(Long.valueOf(id), selection, selectionArgs); count = db.update(TABLE.NOTE, values, NoteColumns.ID + "=" + id + parseSelection(selection), selectionArgs); break; case URI_DATA: + // 更新data表中满足条件的记录 count = db.update(TABLE.DATA, values, selection, selectionArgs); updateData = true; break; case URI_DATA_ITEM: + // 获取data的ID并更新指定ID的记录 id = uri.getPathSegments().get(1); count = db.update(TABLE.DATA, values, DataColumns.ID + "=" + id + parseSelection(selection), selectionArgs); @@ -257,49 +228,51 @@ public class NotesProvider extends ContentProvider { default: throw new IllegalArgumentException("Unknown URI " + uri); } - + // 如果有记录被更新,则通知相应的URI数据已更改 if (count > 0) { if (updateData) { getContext().getContentResolver().notifyChange(Notes.CONTENT_NOTE_URI, null); } getContext().getContentResolver().notifyChange(uri, null); } + // 返回被更新的记录数 return count; } private String parseSelection(String selection) { + // 构建额外的条件 return (!TextUtils.isEmpty(selection) ? " AND (" + selection + ')' : ""); } private void increaseNoteVersion(long id, String selection, String[] selectionArgs) { StringBuilder sql = new StringBuilder(120); - sql.append("UPDATE "); - sql.append(TABLE.NOTE); - sql.append(" SET "); - sql.append(NoteColumns.VERSION); - sql.append("=" + NoteColumns.VERSION + "+1 "); + sql.append("UPDATE "); // 更新语句 + sql.append(TABLE.NOTE); // 表名 + sql.append(" SET "); // 设置要更新的字段 + sql.append(NoteColumns.VERSION); // 版本字段 + sql.append("=" + NoteColumns.VERSION + "+1 "); // 版本号加1 if (id > 0 || !TextUtils.isEmpty(selection)) { - sql.append(" WHERE "); + sql.append(" WHERE "); // 添加WHERE子句,用于指定更新的条件 } if (id > 0) { - sql.append(NoteColumns.ID + "=" + String.valueOf(id)); + sql.append(NoteColumns.ID + "=" + String.valueOf(id)); // 拼接ID条件 } if (!TextUtils.isEmpty(selection)) { - String selectString = id > 0 ? parseSelection(selection) : selection; - for (String args : selectionArgs) { + String selectString = id > 0 ? parseSelection(selection) : selection; // 解析选择条件 + for (String args : selectionArgs) { // 替换选择参数 selectString = selectString.replaceFirst("\\?", args); } - sql.append(selectString); + sql.append(selectString); // 拼接选择条件 } - mHelper.getWritableDatabase().execSQL(sql.toString()); + mHelper.getWritableDatabase().execSQL(sql.toString()); // 执行SQL语句 } @Override public String getType(Uri uri) { // TODO Auto-generated method stub - return null; + return null; // 返回类型暂未实现 } } diff --git a/Notes.java b/Notes.java deleted file mode 100644 index 33380ff..0000000 --- a/Notes.java +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.micode.notes.data;//包声明 - -import android.net.Uri;//导入Android框架中的Uri类 - -public class Notes -{ - public static final String AUTHORITY = "micode_notes"; - public static final String TAG = "Notes"; - public static final int TYPE_NOTE = 0; - public static final int TYPE_FOLDER = 1; - public static final int TYPE_SYSTEM = 2;//定义了公共静态常量,用于提供一些固定的值 - - /** - * Following IDs are system folders' identifiers - * {@link Notes#ID_ROOT_FOLDER } is default folder - * {@link Notes#ID_TEMPARAY_FOLDER } is for notes belonging no folder - * {@link Notes#ID_CALL_RECORD_FOLDER} is to store call records - */ - public static final int ID_ROOT_FOLDER = 0; - public static final int ID_TEMPARAY_FOLDER = -1; - public static final int ID_CALL_RECORD_FOLDER = -2; - public static final int ID_TRASH_FOLER = -3;//定义了四个public static final整型常量 - - public static final String INTENT_EXTRA_ALERT_DATE = "net.micode.notes.alert_date"; - public static final String INTENT_EXTRA_BACKGROUND_ID = "net.micode.notes.background_color_id"; - public static final String INTENT_EXTRA_WIDGET_ID = "net.micode.notes.widget_id"; - public static final String INTENT_EXTRA_WIDGET_TYPE = "net.micode.notes.widget_type"; - public static final String INTENT_EXTRA_FOLDER_ID = "net.micode.notes.folder_id"; - public static final String INTENT_EXTRA_CALL_DATE = "net.micode.notes.call_date";//同样定义了四个public static final字符串常量 - //用于在Android开发中标识Intent的额外数据 - - public static final int TYPE_WIDGET_INVALIDE = -1; - public static final int TYPE_WIDGET_2X = 0; - public static final int TYPE_WIDGET_4X = 1;//定义了三个public static final整数常量,它们很可能用于标识不同类型的小部件或视图 - - public static class DataConstants { - public static final String NOTE = TextNote.CONTENT_ITEM_TYPE; - public static final String CALL_NOTE = CallNote.CONTENT_ITEM_TYPE; - }//定义了一个DataConstants的静态类,该类包含两个静态的、不可变的(final)字符串常量 - - /** - * Uri to query all notes and folders - */ - public static final Uri CONTENT_NOTE_URI = Uri.parse("content://" + AUTHORITY + "/note"); -//定义了一个公共的、静态的、不可变的(final)Uri对象,名为CONTENT_NOTE_URI。这个Uri对象表示一个特定的内容URI,用于Android的内容提供者来标识和访问数据 - - /** - * Uri to query data - */ - public static final Uri CONTENT_DATA_URI = Uri.parse("content://" + AUTHORITY + "/data"); - - public interface NoteColumns //NoteColumns这样的接口通常用于定义数据库表的列名常量 - { - /** - * The unique ID for a row - *

Type: INTEGER (long)

- */ - public static final String ID = "_id";//NoteColumns接口定义了一个公共的静态最终(public static final)字符串常量ID,其值为"_id" - - /** - * The parent's id for note or folder - *

Type: INTEGER (long)

- */ - public static final String PARENT_ID = "parent_id";//NoteColumns接口定义了一个公共的静态最终(public static final)字符串常量PARENT_ID,其值为"parent_id" - - /** - * Created data for note or folder - *

Type: INTEGER (long)

- */ - public static final String CREATED_DATE = "created_date";//NoteColumns接口定义了一个公共的静态最终(public static final)字符串常量CREATED_DATE,其值为"created_date" - - - /** - * Latest modified date - *

Type: INTEGER (long)

- */ - public static final String MODIFIED_DATE = "modified_date";//定义一个字符串常量,命名为modified_date - - - /** - * Alert date - *

Type: INTEGER (long)

- */ - public static final String ALERTED_DATE = "alert_date";//定义一个字符串常量,命名为alert_date - - /** - * Folder's name or text content of note - *

Type: TEXT

- */ - public static final String SNIPPET = "snippet";//定义一个字符串常量,命名为snippet - - /** - * Note's widget id - *

Type: INTEGER (long)

- */ - public static final String WIDGET_ID = "widget_id";//定义一个字符串常量,命名为widget_id - - /** - * Note's widget type - *

Type: INTEGER (long)

- */ - public static final String WIDGET_TYPE = "widget_type";//定义一个字符串常量,命名为widget_type - - /** - * Note's background color's id - *

Type: INTEGER (long)

- */ - public static final String BG_COLOR_ID = "bg_color_id";//定义一个字符串常量,命名为bg_color_id - - /** - * For text note, it doesn't has attachment, for multi-media - * note, it has at least one attachment - *

Type: INTEGER

- */ - public static final String HAS_ATTACHMENT = "has_attachment";//定义一个字符串常量,命名为has_attachment - - /** - * Folder's count of notes - *

Type: INTEGER (long)

- */ - public static final String NOTES_COUNT = "notes_count";//定义一个字符串常量,命名为notes_count - - /** - * The file type: folder or note - *

Type: INTEGER

- */ - public static final String TYPE = "type";//定义一个字符串常量,命名为type - - /** - * The last sync id - *

Type: INTEGER (long)

- */ - public static final String SYNC_ID = "sync_id";//定义一个字符串常量,命名为sync_id - - /** - * Sign to indicate local modified or not - *

Type: INTEGER

- */ - public static final String LOCAL_MODIFIED = "local_modified";//定义一个字符串常量,命名为local_modified - - /** - * Original parent id before moving into temporary folder - *

Type : INTEGER

- */ - public static final String ORIGIN_PARENT_ID = "origin_parent_id";//定义一个字符串常量,命名为origin_parent_id - - /** - * The gtask id - *

Type : TEXT

- */ - public static final String GTASK_ID = "gtask_id";//定义一个字符串常量,命名为gtask_id - - /** - * The version code - *

Type : INTEGER (long)

- */ - public static final String VERSION = "version";//定义一个字符串常量,命名为version - } - //其实质上就是对之前出现过的变量与常量进行初始化与处理, - - public interface DataColumns //同样是一个定义数据库列名常量的地方 - { - /** - * The unique ID for a row - *

Type: INTEGER (long)

- */ - public static final String ID = "_id";//定义了一个名为 ID 的常量,其值为字符串 _id - - /** - * The MIME type of the item represented by this row. - *

Type: Text

- */ - public static final String MIME_TYPE = "mime_type";//定义了一个名为MIME_TYPE的常量,其值为字符串 mime_type - - /** - * The reference id to note that this data belongs to - *

Type: INTEGER (long)

- */ - public static final String NOTE_ID = "note_id";//对其NOTE_ID进行定义与初始化 - - /** - * Created data for note or folder - *

Type: INTEGER (long)

- */ - public static final String CREATED_DATE = "created_date";//对其CREATED_DATE进行定义与初始化 - - /** - * Latest modified date - *

Type: INTEGER (long)

- */ - public static final String MODIFIED_DATE = "modified_date";//对其MODIFIED_DATE进行定义与初始化 - - /** - * Data's content - *

Type: TEXT

- */ - public static final String CONTENT = "content";//对其CONTENT进行定义与初始化 - - - /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, used for - * integer data type - *

Type: INTEGER

- */ - public static final String DATA1 = "data1";//对其DATA1进行定义与初始化 - - /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, used for - * integer data type - *

Type: INTEGER

- */ - public static final String DATA2 = "data2";//对其DATA2 进行定义与初始化 - - /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, used for - * TEXT data type - *

Type: TEXT

- */ - public static final String DATA3 = "data3";//对其DATA3进行定义与初始化 - - /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, used for - * TEXT data type - *

Type: TEXT

- */ - public static final String DATA4 = "data4";//对其 DATA4 进行定义与初始化 - - /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, used for - * TEXT data type - *

Type: TEXT

- */ - public static final String DATA5 = "data5";//对其DATA5进行定义与初始化 - } - - public static final class TextNote implements DataColumns //TextNote 是一个公共的静态最终类(public static final class),它实现了 DataColumns 接口。 - //这意味着 TextNote 类将继承 DataColumns 接口中定义的所有公共和受保护的常量和方法 - { - /** - * Mode to indicate the text in check list mode or not - *

Type: Integer 1:check list mode 0: normal mode

- */ - public static final String MODE = DATA1;//定义了一个名为 MODE 的公共静态最终字符串常量 - - public static final int MODE_CHECK_LIST = 1;//定义了一个名为 MODE_CHECK_LIST 的公共静态最终整数常量,并赋值为 1 - - public static final String CONTENT_TYPE = "vnd.android.cursor.dir/text_note";//这行代码定义了一个名为 CONTENT_TYPE 的公共静态最终字符串常量,用来表示文本笔记内容类型的MIME类型 - - public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/text_note";//这行代码定义了一个名为 CONTENT_ITEM_TYPE 的公共静态最终字符串常量, - - public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/text_note");//定义了一个公共的、静态的、最终的 Uri 对象 - } - - public static final class CallNote implements DataColumns //定义了一个名为CallNote的静态内部类,并且这个类实现了DataColumns接口 - { - /** - * Call date for this record - *

Type: INTEGER (long)

- */ - public static final String CALL_DATE = DATA1;//CALL_DATE是一个公共的、静态的、最终的字符串常量,它的值被设置为DATA1 - - /** - * Phone number for this record - *

Type: TEXT

- */ - public static final String PHONE_NUMBER = DATA3;//同样地,PHONE_NUMBER是一个公共的、静态的、最终的字符串常量,它的值被设置为DATA3 - - public static final String CONTENT_TYPE = "vnd.android.cursor.dir/call_note";//CONTENT_TYPE是一个表示MIME类型的常量,用于描述CallNote类型的数据集是一个目录(dir) - - public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/call_note";//CONTENT_ITEM_TYPE是一个表示MIME类型的常量,用于描述CallNote类型的数据项是一个单个项目 - - public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/call_note");//定义了一个公共的、静态的、最终的Uri对象,名为CONTENT_URI。 - } -} diff --git a/README.md b/README.md deleted file mode 100644 index 81f8e09..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# ReadCodeAndAnalyse - diff --git a/新建 DOCX 文档.docx b/新建 DOCX 文档.docx deleted file mode 100644 index e69de29..0000000 diff --git a/测试2.docx b/测试2.docx deleted file mode 100644 index e69de29..0000000