add code comment

This commit is contained in:
ziji Wu 2019-11-02 08:36:26 +08:00
parent f38a39f464
commit 0c1a7f0297
4 changed files with 19 additions and 14 deletions

View File

@ -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);
} }

View File

@ -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 {
/** /**

View File

@ -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 {
//数据库名称 //数据库名称

View File

@ -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;