diff --git a/doc/小米便签泛读报告.docx b/doc/小米便签泛读报告.docx index 4b26689..8f0ce0a 100644 Binary files a/doc/小米便签泛读报告.docx and b/doc/小米便签泛读报告.docx differ diff --git a/src/Notes-master/src/net/micode/notes/data/Contact.java b/src/Notes-master/src/net/micode/notes/data/Contact.java index d97ac5d..ab53547 100644 --- a/src/Notes-master/src/net/micode/notes/data/Contact.java +++ b/src/Notes-master/src/net/micode/notes/data/Contact.java @@ -26,6 +26,7 @@ import android.util.Log; import java.util.HashMap; public class Contact { + //建立联系人的哈希表 private static HashMap sContactCache; private static final String TAG = "Contact"; @@ -37,24 +38,27 @@ public class Contact { + " WHERE min_match = '+')"; public static String getContact(Context context, String phoneNumber) { + //如果并没有哈希表则创建新的哈希表 if(sContactCache == null) { sContactCache = new HashMap(); } - + //在哈希表的缓存中找到了联系人的电话,返回相应的字符串 if(sContactCache.containsKey(phoneNumber)) { return sContactCache.get(phoneNumber); } - + //应该是直接在存储联系人和电话的菜单里面查找电话号码所对应的联系人 String selection = CALLER_ID_SELECTION.replace("+", PhoneNumberUtils.toCallerIDMinMatch(phoneNumber)); + Cursor cursor = context.getContentResolver().query( Data.CONTENT_URI, new String [] { Phone.DISPLAY_NAME }, selection, new String[] { phoneNumber }, null); - + //如果找到了联系人就返回名称,没有就返回无 if (cursor != null && cursor.moveToFirst()) { + //找到联系人后把联系人和电话号码存入缓存中,以便下一次查找 try { String name = cursor.getString(0); sContactCache.put(phoneNumber, name); diff --git a/src/Notes-master/src/net/micode/notes/data/Notes.java b/src/Notes-master/src/net/micode/notes/data/Notes.java index f240604..1717cd5 100644 --- a/src/Notes-master/src/net/micode/notes/data/Notes.java +++ b/src/Notes-master/src/net/micode/notes/data/Notes.java @@ -17,6 +17,7 @@ package net.micode.notes.data; import android.net.Uri; +//纯定义,没有函数 public class Notes { public static final String AUTHORITY = "micode_notes"; public static final String TAG = "Notes"; diff --git a/src/Notes-master/src/net/micode/notes/data/NotesDatabaseHelper.java b/src/Notes-master/src/net/micode/notes/data/NotesDatabaseHelper.java index ffe5d57..a1e64a2 100644 --- a/src/Notes-master/src/net/micode/notes/data/NotesDatabaseHelper.java +++ b/src/Notes-master/src/net/micode/notes/data/NotesDatabaseHelper.java @@ -26,7 +26,7 @@ import net.micode.notes.data.Notes.DataColumns; import net.micode.notes.data.Notes.DataConstants; import net.micode.notes.data.Notes.NoteColumns; - +//定义了一系列操作的函数 public class NotesDatabaseHelper extends SQLiteOpenHelper { private static final String DB_NAME = "note.db"; diff --git a/src/Notes-master/src/net/micode/notes/gtask/remote/GTaskASyncTask.java b/src/Notes-master/src/net/micode/notes/gtask/remote/GTaskASyncTask.java index b3b61e7..85a789b 100644 --- a/src/Notes-master/src/net/micode/notes/gtask/remote/GTaskASyncTask.java +++ b/src/Notes-master/src/net/micode/notes/gtask/remote/GTaskASyncTask.java @@ -63,25 +63,45 @@ public class GTaskASyncTask extends AsyncTask { }); } + //private void showNotification(int tickerId, String content) { + // Notification notification = new Notification(R.drawable.notification, mContext + // .getString(tickerId), System.currentTimeMillis()); + // notification.defaults = Notification.DEFAULT_LIGHTS; + // notification.flags = Notification.FLAG_AUTO_CANCEL; + // PendingIntent pendingIntent; + // if (tickerId != R.string.ticker_success) { + // pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext, + // NotesPreferenceActivity.class), 0); + // + // } else { + // pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext, + // NotesListActivity.class), 0); + // } + // notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content, + // pendingIntent); + // mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification); + //} private void showNotification(int tickerId, String content) { - Notification notification = new Notification(R.drawable.notification, mContext - .getString(tickerId), System.currentTimeMillis()); - notification.defaults = Notification.DEFAULT_LIGHTS; - notification.flags = Notification.FLAG_AUTO_CANCEL; PendingIntent pendingIntent; if (tickerId != R.string.ticker_success) { pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext, - NotesPreferenceActivity.class), 0); - + NotesPreferenceActivity.class), PendingIntent.FLAG_IMMUTABLE); } else { pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext, - NotesListActivity.class), 0); + NotesListActivity.class), PendingIntent.FLAG_IMMUTABLE); } - notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content, - pendingIntent); + Notification.Builder builder = new Notification.Builder(mContext) + .setAutoCancel(true) + .setContentTitle(mContext.getString(R.string.app_name)) + .setContentText(content) + .setContentIntent(pendingIntent) + .setWhen(System.currentTimeMillis()) + .setOngoing(true); + Notification notification=builder.getNotification(); mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification); } + @Override protected Integer doInBackground(Void... unused) { publishProgess(mContext.getString(R.string.sync_progress_login, NotesPreferenceActivity