|
|
@ -14,12 +14,14 @@
|
|
|
|
* limitations under the License.
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
package net.micode.notes.data;
|
|
|
|
|
|
|
|
|
|
|
|
//这是一个Android应用中用于管理笔记数据的常量定义类,属于net.micode.notes.data包。
|
|
|
|
|
|
|
|
package net.micode.notes.data;//导入包
|
|
|
|
|
|
|
|
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.net.Uri;//导入了Android的Uri类用于处理内容URI
|
|
|
|
public class Notes {
|
|
|
|
public class Notes {//定义了三种类型常量:普通笔记、文件夹和系统文件夹
|
|
|
|
public static final String AUTHORITY = "micode_notes";
|
|
|
|
public static final String AUTHORITY = "micode_notes";
|
|
|
|
public static final String TAG = "Notes";
|
|
|
|
public static final String TAG = "Notes";//TAG: 用于日志的标签
|
|
|
|
public static final int TYPE_NOTE = 0;
|
|
|
|
public static final int TYPE_NOTE = 0;
|
|
|
|
public static final int TYPE_FOLDER = 1;
|
|
|
|
public static final int TYPE_FOLDER = 1;
|
|
|
|
public static final int TYPE_SYSTEM = 2;
|
|
|
|
public static final int TYPE_SYSTEM = 2;
|
|
|
@ -30,11 +32,12 @@ public class Notes {
|
|
|
|
* {@link Notes#ID_TEMPARAY_FOLDER } is for notes belonging no folder
|
|
|
|
* {@link Notes#ID_TEMPARAY_FOLDER } is for notes belonging no folder
|
|
|
|
* {@link Notes#ID_CALL_RECORD_FOLDER} is to store call records
|
|
|
|
* {@link Notes#ID_CALL_RECORD_FOLDER} is to store call records
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
//定义了系统文件夹的特殊ID值,包括根文件夹、临时文件夹、通话记录文件夹和回收站
|
|
|
|
public static final int ID_ROOT_FOLDER = 0;
|
|
|
|
public static final int ID_ROOT_FOLDER = 0;
|
|
|
|
public static final int ID_TEMPARAY_FOLDER = -1;
|
|
|
|
public static final int ID_TEMPARAY_FOLDER = -1;
|
|
|
|
public static final int ID_CALL_RECORD_FOLDER = -2;
|
|
|
|
public static final int ID_CALL_RECORD_FOLDER = -2;
|
|
|
|
public static final int ID_TRASH_FOLER = -3;
|
|
|
|
public static final int ID_TRASH_FOLER = -3;
|
|
|
|
|
|
|
|
//定义了用于Activity或Service间传递数据的Intent Extra键名
|
|
|
|
public static final String INTENT_EXTRA_ALERT_DATE = "net.micode.notes.alert_date";
|
|
|
|
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_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_ID = "net.micode.notes.widget_id";
|
|
|
@ -42,25 +45,25 @@ public class Notes {
|
|
|
|
public static final String INTENT_EXTRA_FOLDER_ID = "net.micode.notes.folder_id";
|
|
|
|
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 String INTENT_EXTRA_CALL_DATE = "net.micode.notes.call_date";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//定义了笔记小部件的类型常量
|
|
|
|
public static final int TYPE_WIDGET_INVALIDE = -1;
|
|
|
|
public static final int TYPE_WIDGET_INVALIDE = -1;
|
|
|
|
public static final int TYPE_WIDGET_2X = 0;
|
|
|
|
public static final int TYPE_WIDGET_2X = 0;
|
|
|
|
public static final int TYPE_WIDGET_4X = 1;
|
|
|
|
public static final int TYPE_WIDGET_4X = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//定义了数据类型常量,包括普通笔记和通话笔记
|
|
|
|
public static class DataConstants {
|
|
|
|
public static class DataConstants {
|
|
|
|
public static final String NOTE = TextNote.CONTENT_ITEM_TYPE;
|
|
|
|
public static final String NOTE = TextNote.CONTENT_ITEM_TYPE;
|
|
|
|
public static final String CALL_NOTE = CallNote.CONTENT_ITEM_TYPE;
|
|
|
|
public static final String CALL_NOTE = CallNote.CONTENT_ITEM_TYPE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//定义了访问笔记和数据的ContentProvider URI
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Uri to query all notes and folders
|
|
|
|
* Uri to query all notes and folders
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static final Uri CONTENT_NOTE_URI = Uri.parse("content://" + AUTHORITY + "/note");
|
|
|
|
public static final Uri CONTENT_NOTE_URI = Uri.parse("content://" + AUTHORITY + "/note");
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Uri to query data
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final Uri CONTENT_DATA_URI = Uri.parse("content://" + AUTHORITY + "/data");
|
|
|
|
public static final Uri CONTENT_DATA_URI = Uri.parse("content://" + AUTHORITY + "/data");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//定义了笔记表的列名常量,包括ID、父ID、创建日期、修改日期等
|
|
|
|
public interface NoteColumns {
|
|
|
|
public interface NoteColumns {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* The unique ID for a row
|
|
|
|
* The unique ID for a row
|
|
|
@ -167,6 +170,7 @@ public class Notes {
|
|
|
|
public static final String VERSION = "version";
|
|
|
|
public static final String VERSION = "version";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//定义了数据表的列名常量,包括ID、MIME类型、笔记ID等
|
|
|
|
public interface DataColumns {
|
|
|
|
public interface DataColumns {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* The unique ID for a row
|
|
|
|
* The unique ID for a row
|
|
|
@ -241,6 +245,7 @@ public class Notes {
|
|
|
|
public static final String DATA5 = "data5";
|
|
|
|
public static final String DATA5 = "data5";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//表示文本笔记的数据结构,定义了检查列表模式和内容类型
|
|
|
|
public static final class TextNote implements DataColumns {
|
|
|
|
public static final class TextNote implements DataColumns {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Mode to indicate the text in check list mode or not
|
|
|
|
* Mode to indicate the text in check list mode or not
|
|
|
@ -257,6 +262,7 @@ public class Notes {
|
|
|
|
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/text_note");
|
|
|
|
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/text_note");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//表示通话笔记的数据结构,定义了通话日期和电话号码字段
|
|
|
|
public static final class CallNote implements DataColumns {
|
|
|
|
public static final class CallNote implements DataColumns {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Call date for this record
|
|
|
|
* Call date for this record
|
|
|
@ -276,4 +282,4 @@ public class Notes {
|
|
|
|
|
|
|
|
|
|
|
|
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/call_note");
|
|
|
|
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/call_note");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|