add code comment
This commit is contained in:
parent
f38a39f464
commit
0c1a7f0297
|
@ -30,6 +30,7 @@ import java.util.HashMap;
|
||||||
* */
|
* */
|
||||||
public class Contact {
|
public class Contact {
|
||||||
private static HashMap<String, String> sContactCache;
|
private static HashMap<String, String> sContactCache;
|
||||||
|
//用于记入日志的标识
|
||||||
private static final String TAG = "Contact";
|
private static final String TAG = "Contact";
|
||||||
|
|
||||||
//在数据库中的查询条件
|
//在数据库中的查询条件
|
||||||
|
@ -49,7 +50,7 @@ public class Contact {
|
||||||
sContactCache = new HashMap<String, String>();
|
sContactCache = new HashMap<String, String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
//如果包含电话号码,则返回电话号码
|
//如果找到电话号码,则返回电话号码对应的字符串
|
||||||
if(sContactCache.containsKey(phoneNumber)) {
|
if(sContactCache.containsKey(phoneNumber)) {
|
||||||
return sContactCache.get(phoneNumber);
|
return sContactCache.get(phoneNumber);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,15 +17,18 @@
|
||||||
package net.micode.notes.data;
|
package net.micode.notes.data;
|
||||||
|
|
||||||
import android.net.Uri;
|
import android.net.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";
|
||||||
//便签类型标识
|
//用于标识便签类型-普通便签
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,10 +37,10 @@ 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
|
||||||
*/
|
*/
|
||||||
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;//垃圾文件夹标识
|
||||||
|
|
||||||
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";
|
||||||
|
@ -46,9 +49,9 @@ 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;//用于标识widget无效
|
||||||
public static final int TYPE_WIDGET_2X = 0;
|
public static final int TYPE_WIDGET_2X = 0;//用于标识使用的是2X大小的widget
|
||||||
public static final int TYPE_WIDGET_4X = 1;
|
public static final int TYPE_WIDGET_4X = 1;//用于标识使用的是4X大小的widget
|
||||||
|
|
||||||
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;
|
||||||
|
@ -64,7 +67,7 @@ public class Notes {
|
||||||
public static final Uri CONTENT_DATA_URI = Uri.parse("content://" + AUTHORITY + "/data");
|
public static final Uri CONTENT_DATA_URI = Uri.parse("content://" + AUTHORITY + "/data");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*公用接口类
|
*该类定义了一系列接口,与便签数据表,存于数据库
|
||||||
*/
|
*/
|
||||||
public interface NoteColumns {
|
public interface NoteColumns {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -29,6 +29,7 @@ import net.micode.notes.data.Notes.NoteColumns;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 该类继承了SQLiteOpenHelper类,对SQLlite数据库进行操作
|
* 该类继承了SQLiteOpenHelper类,对SQLlite数据库进行操作
|
||||||
|
* 提供了便签访问数据库
|
||||||
*/
|
*/
|
||||||
public class NotesDatabaseHelper extends SQLiteOpenHelper {
|
public class NotesDatabaseHelper extends SQLiteOpenHelper {
|
||||||
//数据库名称
|
//数据库名称
|
||||||
|
|
|
@ -35,7 +35,7 @@ import net.micode.notes.data.Notes.NoteColumns;
|
||||||
import net.micode.notes.data.NotesDatabaseHelper.TABLE;
|
import net.micode.notes.data.NotesDatabaseHelper.TABLE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*定义便签提供者类
|
*定义便签提供者类,实现了在数据库中的便签的增删查改
|
||||||
*/
|
*/
|
||||||
public class NotesProvider extends ContentProvider {
|
public class NotesProvider extends ContentProvider {
|
||||||
private static final UriMatcher mMatcher;
|
private static final UriMatcher mMatcher;
|
||||||
|
|
Loading…
Reference in New Issue