|
|
|
@ -1,48 +1,45 @@
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
|
|
|
|
|
* 版权所有 (c) 2010-2011, MiCode 开源社区 (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
|
|
|
|
|
* 本文件授权使用 Apache License, Version 2.0(以下简称“许可证”);
|
|
|
|
|
* 除非符合许可证规定,否则不得使用此文件。
|
|
|
|
|
* 您可以从以下网址获取许可证副本:
|
|
|
|
|
*
|
|
|
|
|
* 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;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Notes 类提供了便签应用中各种常量和 Uri 的定义。
|
|
|
|
|
* 它包括便签类型、意图额外数据、小部件类型、数据常量、便签列和数据列的定义。
|
|
|
|
|
* Notes 类封装了便签应用中使用的常量和 URI 定义。
|
|
|
|
|
* 该类提供了便签类型、意图额外数据、小部件类型、数据常量、便签列和数据列的定义。
|
|
|
|
|
*/
|
|
|
|
|
public class Notes {
|
|
|
|
|
/**
|
|
|
|
|
* ContentProvider 的权威名称。
|
|
|
|
|
* ContentProvider 的权威名称,用于标识数据源。
|
|
|
|
|
*/
|
|
|
|
|
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; // 系统便签
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 特殊文件夹ID常量。
|
|
|
|
|
* 定义特殊文件夹的 ID。
|
|
|
|
|
*/
|
|
|
|
|
public static final int ID_ROOT_FOLDER = 0; // 根文件夹 ID
|
|
|
|
|
public static final int ID_TEMPARAY_FOLDER = -1; // 临时文件夹 ID
|
|
|
|
@ -50,7 +47,7 @@ public class Notes {
|
|
|
|
|
public static final int ID_TRASH_FOLDER = -3; // 回收站文件夹 ID
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 意图额外数据的键。
|
|
|
|
|
* 定义意图额外数据的键。
|
|
|
|
|
*/
|
|
|
|
|
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";
|
|
|
|
@ -60,7 +57,7 @@ public class Notes {
|
|
|
|
|
public static final String INTENT_EXTRA_CALL_DATE = "net.micode.notes.call_date";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 小部件类型常量。
|
|
|
|
|
* 定义小部件的类型。
|
|
|
|
|
*/
|
|
|
|
|
public static final int TYPE_WIDGET_INVALID = -1; // 无效小部件类型
|
|
|
|
|
public static final int TYPE_WIDGET_2X = 0; // 2x 小部件
|
|
|
|
@ -75,12 +72,12 @@ public class Notes {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 便签内容的 Uri。
|
|
|
|
|
* 定义便签内容的 URI。
|
|
|
|
|
*/
|
|
|
|
|
public static final Uri CONTENT_NOTE_URI = Uri.parse("content://" + AUTHORITY + "/note");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 数据内容的 Uri。
|
|
|
|
|
* 定义数据内容的 URI。
|
|
|
|
|
*/
|
|
|
|
|
public static final Uri CONTENT_DATA_URI = Uri.parse("content://" + AUTHORITY + "/data");
|
|
|
|
|
|
|
|
|
@ -127,7 +124,7 @@ public class Notes {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 文本便签类,实现了 DataColumns 接口,定义了文本便签的特定列和 Uri。
|
|
|
|
|
* 文本便签类,实现了 DataColumns 接口,定义了文本便签的特定列和 URI。
|
|
|
|
|
*/
|
|
|
|
|
public static final class TextNote implements DataColumns {
|
|
|
|
|
public static final String MODE = DATA1; // 模式
|
|
|
|
@ -137,11 +134,11 @@ public class Notes {
|
|
|
|
|
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/text_note"; // 文本便签的目录 MIME 类型
|
|
|
|
|
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/text_note"; // 文本便签的项 MIME 类型
|
|
|
|
|
|
|
|
|
|
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/text_note"); // 文本便签的 Uri
|
|
|
|
|
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/text_note"); // 文本便签的 URI
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 通话记录便签类,实现了 DataColumns 接口,定义了通话记录便签的特定列和 Uri。
|
|
|
|
|
* 通话记录便签类,实现了 DataColumns 接口,定义了通话记录便签的特定列和 URI。
|
|
|
|
|
*/
|
|
|
|
|
public static final class CallNote implements DataColumns {
|
|
|
|
|
public static final String CALL_DATE = DATA1; // 通话日期
|
|
|
|
@ -150,32 +147,7 @@ public class Notes {
|
|
|
|
|
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/call_note"; // 通话记录便签的目录 MIME 类型
|
|
|
|
|
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/call_note"; // 通话记录便签的项 MIME 类型
|
|
|
|
|
|
|
|
|
|
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/call_note"); // 通话记录便签的 Uri
|
|
|
|
|
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/call_note"); // 通话记录便签的 URI
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 类注释
|
|
|
|
|
Notes 类提供了便签应用中各种常量和 Uri 的定义。它包括便签类型、意图额外数据、小部件类型、数据常量、便签列和数据列的定义。
|
|
|
|
|
常量定义
|
|
|
|
|
AUTHORITY:ContentProvider 的权威名称。
|
|
|
|
|
TAG:日志标签。
|
|
|
|
|
TYPE_NOTE、TYPE_FOLDER、TYPE_SYSTEM:便签类型常量。
|
|
|
|
|
ID_ROOT_FOLDER、ID_TEMPARAY_FOLDER、ID_CALL_RECORD_FOLDER、ID_TRASH_FOLDER:特殊文件夹ID常量。
|
|
|
|
|
INTENT_EXTRA_*:意图额外数据的键。
|
|
|
|
|
TYPE_WIDGET_INVALID、TYPE_WIDGET_2X、TYPE_WIDGET_4X:小部件类型常量。
|
|
|
|
|
数据常量类
|
|
|
|
|
DataConstants:包含便签和通话记录的 MIME 类型。
|
|
|
|
|
Uri 定义
|
|
|
|
|
CONTENT_NOTE_URI:便签内容的 Uri。
|
|
|
|
|
CONTENT_DATA_URI:数据内容的 Uri。
|
|
|
|
|
便签列接口
|
|
|
|
|
NoteColumns:定义了便签表中的列名,包括便签ID、父文件夹ID、创建日期、修改日期、提醒日期、便签摘要、小部件ID、小部件类型、背景颜色ID、是否有附件、便签数量、便签类型、同步ID、本地修改标记、原始父文件夹ID、Google 任务ID、版本和置顶标记。
|
|
|
|
|
数据列接口
|
|
|
|
|
DataColumns:定义了数据表中的列名,包括数据ID、MIME 类型、便签ID、创建日期、修改日期、内容、数据1、数据2、数据3、数据4和数据5。
|
|
|
|
|
文本便签类
|
|
|
|
|
TextNote:实现了 DataColumns 接口,定义了文本便签的特定列和 Uri。包括模式、检查列表模式、目录 MIME 类型、项 MIME 类型和 Uri。
|
|
|
|
|
通话记录便签类
|
|
|
|
|
CallNote:实现了 DataColumns 接口,定义了通话记录便签的特定列和 Uri。包括通话日期、电话号码、目录 MIME 类型、项 MIME 类型和 Uri。
|
|
|
|
|
*/
|