diff --git a/.gitignore b/.gitignore index ca9fa84..8774462 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /doc/实践模板-开源软件泛读、标注和维护报告文档.docx.REMOTE.docx +/doc/实践模板-开源软件泛读、标注和维护报告文档.docx.LOCAL.docx diff --git a/doc/实践模板-开源软件泛读、标注和维护报告文档.docx b/doc/实践模板-开源软件泛读、标注和维护报告文档.docx index a5b199b..b5612f2 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 f2e5b72..1bf33e4 100644 --- a/src/Notes-master/src/net/micode/notes/data/Contact.java +++ b/src/Notes-master/src/net/micode/notes/data/Contact.java @@ -14,19 +14,23 @@ * limitations under the License. */ -package net.micode.notes.data; +package net.micode.notes.data;//ָλ -import android.content.Context; +import android.content.Context;//android.content.Context -import android.database.Cursor; +import android.database.Cursor;//android.database.Cursor import android.provider.ContactsContract.CommonDataKinds.Phone; +//CommonDataKinds.Phone import android.provider.ContactsContract.Data; +//android.provider.ContactsContract.Data import android.telephony.PhoneNumberUtils; -import android.util.Log; +//android.telephony.PhoneNumberUtils +import android.util.Log;//android.util.Log -import java.util.HashMap; -//change -public class Contact { //ϵ +import java.util.HashMap;//java.util.HashMap + +//ϵ +public class Contact { private static HashMap sContactCache; private static final String TAG = "Contact"; @@ -49,6 +53,7 @@ public class Contact { // // HashMapǷphoneNumberϢ if(sContactCache.containsKey(phoneNumber)) { return sContactCache.get(phoneNumber); + //phoneNumberϢ } String selection = CALLER_ID_SELECTION.replace("+", @@ -64,14 +69,15 @@ public class Contact { // // жѯ // moveToFirst()صһ if (cursor != null && cursor.moveToFirst()) { - try { // ҵϢ + try { String name = cursor.getString(0); sContactCache.put(phoneNumber, name); return name; // 쳣 } catch (IndexOutOfBoundsException e) { Log.e(TAG, " Cursor get string error " + e.toString()); + //string errorϢ return null; } finally { cursor.close(); @@ -79,6 +85,7 @@ public class Contact { // // δҵϢ } else { Log.d(TAG, "No contact matched with number:" + phoneNumber); + //No contact matchedϢ return null; } } 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 6aad9cd..ba7b39f 100644 --- a/src/Notes-master/src/net/micode/notes/data/Notes.java +++ b/src/Notes-master/src/net/micode/notes/data/Notes.java @@ -14,12 +14,13 @@ * limitations under the License. */ -package net.micode.notes.data; +package net.micode.notes.data;//ļеλ -import android.content.ContentUris; -import android.net.Uri; +import android.content.ContentUris;//android.content.ContentUris +import android.net.Uri;//android.net.Uri // Notes ж˺ܶೣЩintͺstring public class Notes { + // public static final String AUTHORITY = "micode_notes"; public static final String TAG = "Notes"; @@ -29,10 +30,10 @@ public class Notes { public static final int TYPE_SYSTEM = 2; /** - * Following IDs are system folders' identifiers - * {@link Notes#ID_ROOT_FOLDER } is default folder - * {@link Notes#ID_TEMPARAY_FOLDER } is for notes belonging no folder - * {@link Notes#ID_CALL_RECORD_FOLDER} is to store call records + * ID ϵͳļеıʶ + * {@link Notes#ID_ROOT_FOLDER }Ĭļ + * {@link Notes#ID_TEMPARAY_FOLDER }Dzļеnotes + * {@link Notes#ID_CALL_RECORD_FOLDER}ڴ洢ͨ¼ */ public static final int ID_ROOT_FOLDER = 0; public static final int ID_TEMPARAY_FOLDER = -1; @@ -40,24 +41,25 @@ public class Notes { public static final int ID_TRASH_FOLER = -3; public static final String INTENT_EXTRA_ALERT_DATE = - + //net.micode.notes.alert_dateij "net.micode.notes.alert_date"; public static final String INTENT_EXTRA_BACKGROUND_ID = - + //net.micode.notes.background_color_idij "net.micode.notes.background_color_id"; public static final String INTENT_EXTRA_WIDGET_ID = - + //net.micode.notes.widget_idij "net.micode.notes.widget_id"; public static final String INTENT_EXTRA_WIDGET_TYPE = - + //net.micode.notes.widget_typeij "net.micode.notes.widget_type"; public static final String INTENT_EXTRA_FOLDER_ID = - + //net.micode.notes.folder_idij "net.micode.notes.folder_id"; public static final String INTENT_EXTRA_CALL_DATE = - + //net.micode.notes.call_dateij "net.micode.notes.call_date"; +//ʹwidgetҼij public static final int TYPE_WIDGET_INVALIDE = -1; public static final int TYPE_WIDGET_2X = 0; public static final int TYPE_WIDGET_4X = 1; @@ -68,16 +70,15 @@ public class Notes { } /** - * Uri to query all notes and folders + * ڲѯбļе URI */ public static final Uri CONTENT_NOTE_URI = Uri.parse("content://" + AUTHORITY + "/note");//ѯǩļеָ롣 - -// public static final Uri my_URI = ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI , 10); + public static final Uri my_URI = ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI , 10); /** - * Uri to query data + * ڲѯݵ URI */ public static final Uri CONTENT_DATA_URI = Uri.parse("content://" + @@ -86,93 +87,92 @@ AUTHORITY + "/data");// // NoteColumnsij,ں洴ݿıͷ public interface NoteColumns { /** - * The unique ID for a row + * еΨһ ID *

Type: INTEGER (long)

*/ public static final String ID = "_id"; /** - * The parent's id for note or folder + * ļеĸID *

Type: INTEGER (long)

*/ public static final String PARENT_ID = "parent_id";//Ϊʲôparent_id /** - * Created data for note or folder + * Ϊʼǻļд *

Type: INTEGER (long)

*/ public static final String CREATED_DATE = "created_date"; /** - * Latest modified date + * ޸ *

Type: INTEGER (long)

*/ public static final String MODIFIED_DATE = "modified_date"; /** - * Alert date + * *

Type: INTEGER (long)

*/ public static final String ALERTED_DATE = "alert_date"; /** - * Folder's name or text content of note + * ļƻע͵ı *

Type: TEXT

*/ public static final String SNIPPET = "snippet"; /** - * Note's widget id + * noteswidget ID *

Type: INTEGER (long)

*/ public static final String WIDGET_ID = "widget_id"; /** - * Note's widget type + * noteswidget *

Type: INTEGER (long)

*/ public static final String WIDGET_TYPE = "widget_type"; /** - * Note's background color's id + * ʼǵıɫ ID *

Type: INTEGER (long)

*/ public static final String BG_COLOR_ID = "bg_color_id"; /** - * For text note, it doesn't has attachment, for multi-media - * note, it has at least one attachment + * ıʼǣûиڶýʼǣһ *

Type: INTEGER

*/ public static final String HAS_ATTACHMENT = "has_attachment"; /** - * Folder's count of notes + * ļеıʼǼ *

Type: INTEGER (long)

*/ public static final String NOTES_COUNT = "notes_count"; /** - * The file type: folder or note + * ļͣļл *

Type: INTEGER

*/ public static final String TYPE = "type"; /** - * The last sync id + * һͬ ID *

Type: INTEGER (long)

*/ public static final String SYNC_ID = "sync_id";//ͬ /** - * Sign to indicate local modified or not + * ָʾ޸ı־ *

Type: INTEGER

*/ public static final String LOCAL_MODIFIED = "local_modified"; /** - * Original parent id before moving into temporary folder + * ƶʱļ֮ǰԭʼ ID *

Type : INTEGER

*/ public static final String ORIGIN_PARENT_ID = "origin_parent_id"; @@ -193,77 +193,72 @@ AUTHORITY + "/data");// // DataColumnsij,ں洴ݿıͷ public interface DataColumns { /** - * The unique ID for a row + * еΨһ ID *

Type: INTEGER (long)

*/ public static final String ID = "_id"; /** - * The MIME type of the item represented by this row. + * бʾ MIME ͡ *

Type: Text

*/ public static final String MIME_TYPE = "mime_type"; /** - * The reference id to note that this data belongs to + * ID *

Type: INTEGER (long)

*/ public static final String NOTE_ID = "note_id"; /** - * Created data for note or folder + * Ϊʼǻļд *

Type: INTEGER (long)

*/ public static final String CREATED_DATE = "created_date"; /** - * Latest modified date + * ޸ *

Type: INTEGER (long)

*/ public static final String MODIFIED_DATE = "modified_date"; /** - * Data's content + * *

Type: TEXT

*/ public static final String CONTENT = "content"; /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, -used for - * integer data type + * ͨУ {@link #MIMETYPE} ضģ + * Integer *

Type: INTEGER

*/ public static final String DATA1 = "data1"; /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, -used for - * integer data type + * ͨУ {@link #MIMETYPE} ضģ + * Integer *

Type: INTEGER

*/ public static final String DATA2 = "data2"; /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, -used for + * ͨУ {@link #MIMETYPE} ضģ * TEXT data type *

Type: TEXT

*/ public static final String DATA3 = "data3"; /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, -used for + * ͨУ {@link #MIMETYPE} ضģ * TEXT data type *

Type: TEXT

*/ public static final String DATA4 = "data4"; /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, -used for + * ͨУ {@link #MIMETYPE} ضģ * TEXT data type *

Type: TEXT

*/ @@ -271,7 +266,7 @@ used for }//ҪǶ洢ǩݵ public static final class TextNote implements DataColumns { /** - * Mode to indicate the text in check list mode or not + * ָʾıǷں˶бģʽģʽ *

Type: Integer 1:check list mode 0: normal mode

*/ public static final String MODE = DATA1; @@ -293,13 +288,13 @@ AUTHORITY + "/text_note"); public static final class CallNote implements DataColumns { /** - * Call date for this record + * ˼¼ĵ *

Type: INTEGER (long)

*/ public static final String CALL_DATE = DATA1; /** - * Phone number for this record + * ˼¼ĵ绰 *

Type: TEXT

*/ public static final String PHONE_NUMBER = DATA3; 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 4e41fb6..978e900 100644 --- a/src/Notes-master/src/net/micode/notes/data/NotesDatabaseHelper.java +++ b/src/Notes-master/src/net/micode/notes/data/NotesDatabaseHelper.java @@ -38,6 +38,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { public static final String DATA = "data"; } +//ݿҪij private static final String TAG = "NotesDatabaseHelper"; private static NotesDatabaseHelper mInstance; @@ -83,7 +84,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { TABLE.DATA + "(" + DataColumns.NOTE_ID + ");";//洢ǩŵһݱ /** - * Increase folder's note count when move note to the folder + * ʼƶļʱļеıʼǼ */ private static final String NOTE_INCREASE_FOLDER_COUNT_ON_UPDATE_TRIGGER = "CREATE TRIGGER increase_folder_count_on_update "+ @@ -95,7 +96,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { " END";//ļһNote֮Ҫĵݵı /** - * Decrease folder's note count when move note from folder + * ļƶʼʱļеıʼǼ */ private static final String NOTE_DECREASE_FOLDER_COUNT_ON_UPDATE_TRIGGER = "CREATE TRIGGER decrease_folder_count_on_update " + @@ -108,7 +109,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { " END";//ļƳһNote֮Ҫĵݵı /** - * Increase folder's note count when insert new note to the folder + * ļв±ʼʱļеıʼǼ */ private static final String NOTE_INCREASE_FOLDER_COUNT_ON_INSERT_TRIGGER = "CREATE TRIGGER increase_folder_count_on_insert " + @@ -120,7 +121,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { " END";//ļвһNote֮Ҫĵݵı /** - * Decrease folder's note count when delete note from the folder + * ļɾʼʱļеıʼǼ */ private static final String NOTE_DECREASE_FOLDER_COUNT_ON_DELETE_TRIGGER = "CREATE TRIGGER decrease_folder_count_on_delete " + @@ -133,7 +134,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { " END";//ļɾһNote֮Ҫĵݵı /** - * Update note's content when insert data with type {@link DataConstants#NOTE} + * Ϊ {@link DataConstants#NOTE} ʱע͵ */ private static final String DATA_UPDATE_NOTE_CONTENT_ON_INSERT_TRIGGER = "CREATE TRIGGER update_note_content_on_insert " + @@ -146,7 +147,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { " END";//ļжһNoteµ֮Ҫĵݵı /** - * Update note's content when data with {@link DataConstants#NOTE} type has changed + * {@link DataConstants#NOTE} ͵ݷʱע͵ */ private static final String DATA_UPDATE_NOTE_CONTENT_ON_UPDATE_TRIGGER = "CREATE TRIGGER update_note_content_on_update " + @@ -159,7 +160,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { " END";//Noteݱ޸ĺҪĵݵı /** - * Update note's content when data with {@link DataConstants#NOTE} type has deleted + * ɾ {@link DataConstants#NOTE} ͵ʱע */ private static final String DATA_UPDATE_NOTE_CONTENT_ON_DELETE_TRIGGER = "CREATE TRIGGER update_note_content_on_delete " + @@ -172,7 +173,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { " END";//NoteݱɾҪĵݵı /** - * Delete datas belong to note which has been deleted + * ɾɾע */ private static final String NOTE_DELETE_DATA_ON_DELETE_TRIGGER = "CREATE TRIGGER delete_data_on_delete " + @@ -183,7 +184,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { " END";//ɾɾıǩݺҪĵݵı /** - * Delete notes belong to folder which has been deleted + * ɾɾļеıǩҪĵݵı */ private static final String FOLDER_DELETE_NOTES_ON_DELETE_TRIGGER = "CREATE TRIGGER folder_delete_notes_on_delete " + @@ -194,7 +195,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { " END";//ɾɾļеıǩҪĵݵı /** - * Move notes belong to folder which has been moved to trash folder + * ԭͰбǩҪĵݵı */ private static final String FOLDER_MOVE_NOTES_ON_TRASH_TRIGGER = "CREATE TRIGGER folder_move_notes_on_trash " + @@ -204,7 +205,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { " UPDATE " + TABLE.NOTE + " SET " + NoteColumns.PARENT_ID + "=" + Notes.ID_TRASH_FOLER + " WHERE " + NoteColumns.PARENT_ID + "=old." + NoteColumns.ID + ";" + - " END";//ԭͰбǩҪĵݵı + " END"; public NotesDatabaseHelper(Context context) { super(context, DB_NAME, null, DB_VERSION); @@ -240,14 +241,14 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { ContentValues values = new ContentValues(); /** - * call record foler for call notes + * ͨ¼ Folerͨ¼ */ values.put(NoteColumns.ID, Notes.ID_CALL_RECORD_FOLDER); values.put(NoteColumns.TYPE, Notes.TYPE_SYSTEM); db.insert(TABLE.NOTE, null, values); /** - * root folder which is default folder + * ļУĬļ */ values.clear(); values.put(NoteColumns.ID, Notes.ID_ROOT_FOLDER); @@ -255,7 +256,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { db.insert(TABLE.NOTE, null, values); /** - * temporary folder which is used for moving note + * ƶʼǵʱļ */ values.clear(); values.put(NoteColumns.ID, Notes.ID_TEMPARAY_FOLDER); @@ -263,7 +264,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { db.insert(TABLE.NOTE, null, values); /** - * create trash folder + * Ͱļ */ values.clear(); values.put(NoteColumns.ID, Notes.ID_TRASH_FOLER); @@ -310,7 +311,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { if (oldVersion == 1) { upgradeToV2(db); - skipV2 = true; // this upgrade including the upgrade from v2 to v3 + skipV2 = true; // v2 v3 oldVersion++; } diff --git a/src/Notes-master/src/net/micode/notes/data/NotesProvider.java b/src/Notes-master/src/net/micode/notes/data/NotesProvider.java index b67144b..b5a1d08 100644 --- a/src/Notes-master/src/net/micode/notes/data/NotesProvider.java +++ b/src/Notes-master/src/net/micode/notes/data/NotesProvider.java @@ -14,8 +14,9 @@ * limitations under the License. */ -package net.micode.notes.data; +package net.micode.notes.data;//λ +//Ϊõĸֹ import android.app.SearchManager; import android.content.ContentProvider; import android.content.ContentUris; @@ -69,8 +70,8 @@ public class NotesProvider extends ContentProvider { } /** - * x'0A' represents the '\n' character in sqlite. For title and content in the search result, - * we will trim '\n' and white space in order to show more information. + * x'0A' ʾ sqlite е 'n' ַеıݣ + * ȥnͿհʾϢ. */ // NOTES_SEARCH_PROJECTION private static final String NOTES_SEARCH_PROJECTION = NoteColumns.ID + "," @@ -188,14 +189,14 @@ public class NotesProvider extends ContentProvider { default: throw new IllegalArgumentException("Unknown URI " + uri); } - // Notify the note uri + // ֪ͨע uri // notifyChangeһContextResolverҸ if (noteId > 0) { getContext().getContentResolver().notifyChange( ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId), null); } - // Notify the data uri + // ֪ͨ URI if (dataId > 0) { getContext().getContentResolver().notifyChange( ContentUris.withAppendedId(Notes.CONTENT_DATA_URI, dataId), null); @@ -222,8 +223,7 @@ public class NotesProvider extends ContentProvider { case URI_NOTE_ITEM: id = uri.getPathSegments().get(1); /** - * ID that smaller than 0 is system folder which is not allowed to - * trash + * С 0 ID Dzյϵͳļ */ long noteId = Long.valueOf(id); if (noteId <= 0) { @@ -329,7 +329,7 @@ public class NotesProvider extends ContentProvider { @Override public String getType(Uri uri) { - // TODO Auto-generated method stub + // TODO Զɵķ return null; } diff --git a/src/Notes-master/src/net/micode/notes/tool/BackupUtils.java b/src/Notes-master/src/net/micode/notes/tool/BackupUtils.java index 740fdbb..444d9dc 100644 --- a/src/Notes-master/src/net/micode/notes/tool/BackupUtils.java +++ b/src/Notes-master/src/net/micode/notes/tool/BackupUtils.java @@ -19,7 +19,7 @@ package net.micode.notes.tool; public class BackupUtils { private static final String TAG = "BackupUtils"; // Singleton stuff - private static BackupUtils sInstance; //ΪʲôԶĶ + private static BackupUtils sInstance; //ΪʲôԶĶ public static synchronized BackupUtils getInstance(Context context) { //ynchronized ؼ֣,൱ڲһ̣߳߳A @@ -33,8 +33,7 @@ public class BackupUtils { } /** - * Following states are signs to represents backup or restore - * status + * ״̬DZʾݻԭ״̬ı־ */ // Currently, the sdcard is not mounted SDûбװֻ public static final int STATE_SD_CARD_UNMOUONTED = 0; @@ -49,11 +48,13 @@ public class BackupUtils { private TextExport mTextExport; - private BackupUtils(Context context) { //ʼ +//ʼ + private BackupUtils(Context context) { mTextExport = new TextExport(context); } - private static boolean externalStorageAvailable() { //ⲿ洢Ƿ +//ⲿ洢Ƿ + private static boolean externalStorageAvailable() { return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()); } @@ -69,6 +70,7 @@ public class BackupUtils { return mTextExport.mFileDirectory; } +//TextExport private static class TextExport { private static final String[] NOTE_PROJECTION = { NoteColumns.ID, @@ -92,6 +94,7 @@ public class BackupUtils { DataColumns.DATA4, }; +//͵ij private static final int DATA_COLUMN_CONTENT = 0; private static final int DATA_COLUMN_MIME_TYPE = 1; @@ -116,12 +119,13 @@ public class BackupUtils { mFileDirectory = ""; } - private String getFormat(int id) { //ȡıɲ +//ȡıɲ + private String getFormat(int id) { return TEXT_FORMAT[id]; } /** - * Export the folder identified by folder id to text + * ļ ID ʶļеΪı */ private void exportFolderToText(String folderId, PrintStream ps) { // Query notes belong to this folder ͨѯparent idļidnoteѡƶIDļµNote @@ -137,7 +141,7 @@ public class BackupUtils { ps.println(String.format(getFormat(FORMAT_NOTE_DATE), DateFormat.format( mContext.getString(R.string.format_datetime_mdhm), notesCursor.getLong(NOTE_COLUMN_MODIFIED_DATE)))); - // Query data belong to this note + // ѯڴ˵ String noteId = notesCursor.getString(NOTE_COLUMN_ID); exportNoteToText(noteId, ps); //ļtext } while (notesCursor.moveToNext()); @@ -147,7 +151,7 @@ public class BackupUtils { } /** - * Export note identified by id to a print stream + * id ʶע͵ӡ */ private void exportNoteToText(String noteId, PrintStream ps) { Cursor dataCursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI, @@ -169,11 +173,11 @@ public class BackupUtils { ps.println(String.format(getFormat(FORMAT_NOTE_CONTENT), phoneNumber)); } - // Print call date + // ӡͨ ps.println(String.format(getFormat(FORMAT_NOTE_CONTENT), DateFormat .format(mContext.getString(R.string.format_datetime_mdhm), callDate))); - // Print call attachment location + // ӡʹøλ if (!TextUtils.isEmpty(location)) { ps.println(String.format(getFormat(FORMAT_NOTE_CONTENT), location)); @@ -189,7 +193,7 @@ public class BackupUtils { } dataCursor.close(); } - // print a line separator between note + // ע֮ӡзָ try { ps.write(new byte[] { Character.LINE_SEPARATOR, Character.LETTER_NUMBER @@ -200,7 +204,7 @@ public class BackupUtils { } /** - * Note will be exported as text which is user readable + * עͽΪûɶı */ public int exportToText() { //ܺexportFolderexportNote if (!externalStorageAvailable()) { @@ -213,7 +217,7 @@ public class BackupUtils { Log.e(TAG, "get print stream error"); return STATE_SYSTEM_ERROR; } - // First export folder and its notes ļУǵıǩ + //ļУǵıǩ Cursor folderCursor = mContext.getContentResolver().query( Notes.CONTENT_NOTE_URI, NOTE_PROJECTION, @@ -241,7 +245,7 @@ public class BackupUtils { folderCursor.close(); } - // Export notes in root's folder Ŀ¼ıǩڲκļУ޷ͨļеʵһֱǩĵ + // Ŀ¼ıǩڲκļУ޷ͨļеʵһֱǩĵ Cursor noteCursor = mContext.getContentResolver().query( Notes.CONTENT_NOTE_URI, NOTE_PROJECTION, @@ -254,7 +258,7 @@ public class BackupUtils { ps.println(String.format(getFormat(FORMAT_NOTE_DATE), DateFormat.format( mContext.getString(R.string.format_datetime_mdhm), noteCursor.getLong(NOTE_COLUMN_MODIFIED_DATE)))); - // Query data belong to this note + // ѯڴ˵ String noteId = noteCursor.getString(NOTE_COLUMN_ID); exportNoteToText(noteId, ps); } while (noteCursor.moveToNext()); @@ -267,7 +271,7 @@ public class BackupUtils { } /** - * Get a print stream pointed to the file {@generateExportedTextFile} + * ȡָļ {@generateExportedTextFile} Ĵӡ */ private PrintStream getExportToTextPrintStream() { File file = generateFileMountedOnSDcard(mContext, R.string.file_path, @@ -281,7 +285,8 @@ public class BackupUtils { PrintStream ps = null; try { FileOutputStream fos = new FileOutputStream(file); - ps = new PrintStream(fos); //psضļĿľǵļֱ + ps = new PrintStream(fos); + //psضļĿľǵļֱ } catch (FileNotFoundException e) { e.printStackTrace(); return null; @@ -294,7 +299,7 @@ public class BackupUtils { } /** - * Generate the text file to store imported data + * ıļԴ洢 */ private static File generateFileMountedOnSDcard(Context context, int filePathResId, int fileNameFormatResId) { StringBuilder sb = new StringBuilder(); diff --git a/src/Notes-master/src/net/micode/notes/tool/DataUtils.java b/src/Notes-master/src/net/micode/notes/tool/DataUtils.java index e591b68..2886c5f 100644 --- a/src/Notes-master/src/net/micode/notes/tool/DataUtils.java +++ b/src/Notes-master/src/net/micode/notes/tool/DataUtils.java @@ -1,4 +1,4 @@ -package net.micode.notes.tool; +package net.micode.notes.tool;//λ public class DataUtils { public static final String TAG = "DataUtils"; @@ -78,7 +78,7 @@ public class DataUtils { } /** - * Get the all folder count except system folders {@link Notes#TYPE_SYSTEM}} + * ȡϵͳļ {@link Notes#TYPE_SYSTEM}} ֮ļм */ public static int getUserFolderCount(ContentResolver resolver) { Cursor cursor =resolver.query(Notes.CONTENT_NOTE_URI, @@ -94,6 +94,7 @@ public class DataUtils { count = cursor.getInt(0); } catch (IndexOutOfBoundsException e) { Log.e(TAG, "get folder count failed:" + e.toString()); +//get folder count failed } finally { cursor.close(); } @@ -119,7 +120,8 @@ public class DataUtils { return exist; } - public static boolean existInNoteDatabase(ContentResolver resolver, long noteId) { +// noteIdǷڱʼݿ + public static boolean existInNoteDatabase(ContentResolver resolver, long noteId) {// ѯʼݵUriʹContentUris.withAppendedId()noteIdӵʼUri Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId), null, null, null, null); @@ -139,10 +141,10 @@ public class DataUtils { boolean exist = false; if (cursor != null) { - if (cursor.getCount() > 0) { + if (cursor.getCount() > 0) {// countݣ˵noteIdڱʼݿ exist = true; } - cursor.close(); + cursor.close();//ͷԴ } return exist; } @@ -191,7 +193,8 @@ public class DataUtils { return set; } - public static String getCallNumberByNoteId(ContentResolver resolver, long noteId) { +//ݸnoteIdӱʼݿлȡ绰 + public static String getCallNumberByNoteId(ContentResolver resolver, long noteId) {// ѯֵΪStringͣʾnoteIdȡĵ绰룬ȡʧ򷵻ؿַ Cursor cursor = resolver.query(Notes.CONTENT_DATA_URI, new String [] { CallNote.PHONE_NUMBER }, CallNote.NOTE_ID + "=? AND " + CallNote.MIME_TYPE + "=?", @@ -200,7 +203,7 @@ public class DataUtils { if (cursor != null && cursor.moveToFirst()) { try { - return cursor.getString(0); + return cursor.getString(0);// ȡһеĵ绰 } catch (IndexOutOfBoundsException e) { Log.e(TAG, "Get call number fails " + e.toString()); } finally { diff --git a/src/Notes-master/src/net/micode/notes/tool/GTaskStringUtils.java b/src/Notes-master/src/net/micode/notes/tool/GTaskStringUtils.java index dfc1ac6..5825486 100644 --- a/src/Notes-master/src/net/micode/notes/tool/GTaskStringUtils.java +++ b/src/Notes-master/src/net/micode/notes/tool/GTaskStringUtils.java @@ -14,102 +14,96 @@ * limitations under the License. */ -//飺˺ܶľַ̬ĿľΪṩjsonObjectӦַ"key"Щ̬Ķ嵥дһ棬Ƿdzõı̹淶 -package net.micode.notes.tool; - -//Ƕһstatic stringʵʾΪjsonObjectṩKeyЩȫдһ鿴һdzõıϰ -public class GTaskStringUtils { - - public final static String GTASK_JSON_ACTION_ID = "action_id"; - - public final static String GTASK_JSON_ACTION_LIST = "action_list"; - - public final static String GTASK_JSON_ACTION_TYPE = "action_type"; - - public final static String GTASK_JSON_ACTION_TYPE_CREATE = "create"; - - public final static String GTASK_JSON_ACTION_TYPE_GETALL = "get_all"; - - public final static String GTASK_JSON_ACTION_TYPE_MOVE = "move"; - - public final static String GTASK_JSON_ACTION_TYPE_UPDATE = "update"; - - public final static String GTASK_JSON_CREATOR_ID = "creator_id"; - - public final static String GTASK_JSON_CHILD_ENTITY = "child_entity"; - - public final static String GTASK_JSON_CLIENT_VERSION = "client_version"; - - public final static String GTASK_JSON_COMPLETED = "completed"; - - public final static String GTASK_JSON_CURRENT_LIST_ID = "current_list_id"; - - public final static String GTASK_JSON_DEFAULT_LIST_ID = "default_list_id"; - - public final static String GTASK_JSON_DELETED = "deleted"; - - public final static String GTASK_JSON_DEST_LIST = "dest_list"; - - public final static String GTASK_JSON_DEST_PARENT = "dest_parent"; - - public final static String GTASK_JSON_DEST_PARENT_TYPE = "dest_parent_type"; - - public final static String GTASK_JSON_ENTITY_DELTA = "entity_delta"; - - public final static String GTASK_JSON_ENTITY_TYPE = "entity_type"; - - public final static String GTASK_JSON_GET_DELETED = "get_deleted"; - - public final static String GTASK_JSON_ID = "id"; - - public final static String GTASK_JSON_INDEX = "index"; - - public final static String GTASK_JSON_LAST_MODIFIED = "last_modified"; - - public final static String GTASK_JSON_LATEST_SYNC_POINT = "latest_sync_point"; - - public final static String GTASK_JSON_LIST_ID = "list_id"; - - public final static String GTASK_JSON_LISTS = "lists"; - - public final static String GTASK_JSON_NAME = "name"; - - public final static String GTASK_JSON_NEW_ID = "new_id"; - - public final static String GTASK_JSON_NOTES = "notes"; - - public final static String GTASK_JSON_PARENT_ID = "parent_id"; - - public final static String GTASK_JSON_PRIOR_SIBLING_ID = "prior_sibling_id"; - - public final static String GTASK_JSON_RESULTS = "results"; - - public final static String GTASK_JSON_SOURCE_LIST = "source_list"; - - public final static String GTASK_JSON_TASKS = "tasks"; - - public final static String GTASK_JSON_TYPE = "type"; - - public final static String GTASK_JSON_TYPE_GROUP = "GROUP"; - - public final static String GTASK_JSON_TYPE_TASK = "TASK"; - - public final static String GTASK_JSON_USER = "user"; - - public final static String MIUI_FOLDER_PREFFIX = "[MIUI_Notes]"; - - public final static String FOLDER_DEFAULT = "Default"; - - public final static String FOLDER_CALL_NOTE = "Call_Note"; - - public final static String FOLDER_META = "METADATA"; - - public final static String META_HEAD_GTASK_ID = "meta_gid"; - - public final static String META_HEAD_NOTE = "meta_note"; - - public final static String META_HEAD_DATA = "meta_data"; - - public final static String META_NOTE_NAME = "[META INFO] DON'T UPDATE AND DELETE"; +//˺ܶľַ̬ĿľΪṩjsonObjectӦַ"key"Щ̬Ķ嵥дһ +package net.micode.notes.tool;//λ +//ඨһЩstatic stringʵʾΪjsonObjectṩKeyЩȫдһ鿴 +public class GTaskStringUtils { + +// س +public final static String GTASK_JSON_ACTION_ID = "action_id"; // ID +public final static String GTASK_JSON_ACTION_LIST = "action_list"; // б +public final static String GTASK_JSON_ACTION_TYPE = "action_type"; // +public final static String GTASK_JSON_ACTION_TYPE_CREATE = "create"; // +public final static String GTASK_JSON_ACTION_TYPE_GETALL = "get_all"; // ȡж +public final static String GTASK_JSON_ACTION_TYPE_MOVE = "move"; // ƶ +public final static String GTASK_JSON_ACTION_TYPE_UPDATE = "update"; // ¶ + +public final static String GTASK_JSON_CREATOR_ID = "creator_id"; // ID + +public final static String GTASK_JSON_CHILD_ENTITY = "child_entity"; // ʵ + +public final static String GTASK_JSON_CLIENT_VERSION = "client_version"; // ͻ˰汾 + +public final static String GTASK_JSON_COMPLETED = "completed"; // ״̬ + +public final static String GTASK_JSON_CURRENT_LIST_ID = "current_list_id"; // ǰбID + +public final static String GTASK_JSON_DEFAULT_LIST_ID = "default_list_id"; // ĬбID + +public final static String GTASK_JSON_DELETED = "deleted"; // ɾ״̬ + +public final static String GTASK_JSON_DEST_LIST = "dest_list"; // Ŀб + +public final static String GTASK_JSON_DEST_PARENT = "dest_parent"; // Ŀ길 + +public final static String GTASK_JSON_DEST_PARENT_TYPE = "dest_parent_type"; // Ŀ길 + +public final static String GTASK_JSON_ENTITY_DELTA = "entity_delta"; // ʵ + +public final static String GTASK_JSON_ENTITY_TYPE = "entity_type"; // ʵ + +public final static String GTASK_JSON_GET_DELETED = "get_deleted"; // ȡɾ + +public final static String GTASK_JSON_ID = "id"; // ID + +public final static String GTASK_JSON_INDEX = "index"; // + +public final static String GTASK_JSON_LAST_MODIFIED = "last_modified"; // ޸ʱ + +public final static String GTASK_JSON_LATEST_SYNC_POINT = "latest_sync_point"; // ͬ + +public final static String GTASK_JSON_LIST_ID = "list_id"; // бID + +public final static String GTASK_JSON_LISTS = "lists"; // б + +public final static String GTASK_JSON_NAME = "name"; // + +public final static String GTASK_JSON_NEW_ID = "new_id"; // ID + +public final static String GTASK_JSON_NOTES = "notes"; // ע + +public final static String GTASK_JSON_PARENT_ID = "parent_id"; // ID + +public final static String GTASK_JSON_PRIOR_SIBLING_ID = "prior_sibling_id"; // һֵܽڵID + +public final static String GTASK_JSON_RESULTS = "results"; // + +public final static String GTASK_JSON_SOURCE_LIST = "source_list"; // Դб + +public final static String GTASK_JSON_TASKS = "tasks"; // + +// س +public final static String GTASK_JSON_TYPE = "type"; // +public final static String GTASK_JSON_TYPE_GROUP = "GROUP"; // +public final static String GTASK_JSON_TYPE_TASK = "TASK"; // + +public final static String GTASK_JSON_USER = "user"; // û + +public final static String MIUI_FOLDER_PREFFIX = "[MIUI_Notes]"; // MIUIļǰ׺ + +public final static String FOLDER_DEFAULT = "Default"; // Ĭļ + +public final static String FOLDER_CALL_NOTE = "Call_Note"; // 绰עļ + +public final static String FOLDER_META = "METADATA"; // Ԫļ + +public final static String META_HEAD_GTASK_ID = "meta_gid"; // ԪϢID + +public final static String META_HEAD_NOTE = "meta_note"; // ԪϢע + +public final static String META_HEAD_DATA = "meta_data"; // ԪϢ + +public final static String META_NOTE_NAME = "[META INFO] DON'T UPDATE AND DELETE"; // ԪϢע + } \ No newline at end of file diff --git a/src/Notes-master/src/net/micode/notes/tool/ResourceParser.java b/src/Notes-master/src/net/micode/notes/tool/ResourceParser.java index e1846a3..f0e8b41 100644 --- a/src/Notes-master/src/net/micode/notes/tool/ResourceParser.java +++ b/src/Notes-master/src/net/micode/notes/tool/ResourceParser.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package net.micode.notes.tool; +package net.micode.notes.tool;//λ -/*飺ԴʵϾǻȡԴڳʹãɫͼƬ +/*ԴʵϾǻȡԴڳʹãɫͼƬ * ʵַҪR.java࣬а * R.id Դ * R.drawable ͼƬԴ ʹã @@ -31,6 +31,7 @@ package net.micode.notes.tool; * BG_DEFAULT_FONT_SIZE ĬıСУ */ +//Сɫ public class ResourceParser { public static final int YELLOW = 0; @@ -48,6 +49,7 @@ public class ResourceParser { public static final int BG_DEFAULT_FONT_SIZE = TEXT_MEDIUM; +//ǩɫ public static class NoteBgResources { private final static int [] BG_EDIT_RESOURCES = new int [] { R.drawable.edit_yellow, @@ -57,6 +59,7 @@ public class ResourceParser { R.drawable.edit_red }; +//ɫ private final static int [] BG_EDIT_TITLE_RESOURCES = new int [] { R.drawable.edit_title_yellow, R.drawable.edit_title_blue, @@ -73,7 +76,8 @@ public class ResourceParser { return BG_EDIT_TITLE_RESOURCES[id]; } } - //ֱӻȡĬϵıɫ̫PREFERENCE_SET_BG_COLOR_KEYǸfinal string,Ҳ˵getBoolean϶ִelseΪʲôҪôд + + //ֱӻȡĬϵıɫ public static int getDefaultBgId(Context context) { if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean( NotesPreferenceActivity.PREFERENCE_SET_BG_COLOR_KEY, false)) { @@ -82,7 +86,8 @@ public class ResourceParser { return BG_DEFAULT_COLOR; } } - + + //ڴ洢ͬͱʼǵĵһʼǵıԴID public static class NoteItemBgResources { private final static int [] BG_FIRST_RESOURCES = new int [] { R.drawable.list_yellow_up, @@ -92,6 +97,7 @@ public class ResourceParser { R.drawable.list_red_up }; +//ڴ洢ͬͱʼǵмʼǵıԴID private final static int [] BG_NORMAL_RESOURCES = new int [] { R.drawable.list_yellow_middle, R.drawable.list_blue_middle, @@ -100,6 +106,7 @@ public class ResourceParser { R.drawable.list_red_middle }; +//ڴ洢ͬͱʼǵʼǵıԴID private final static int [] BG_LAST_RESOURCES = new int [] { R.drawable.list_yellow_down, R.drawable.list_blue_down, @@ -108,6 +115,7 @@ public class ResourceParser { R.drawable.list_red_down, }; +//NoteItemBgResourcesڲеһ̬BG_SINGLE_RESOURCESڴ洢ͬͱʼֻһʼʱıԴID private final static int [] BG_SINGLE_RESOURCES = new int [] { R.drawable.list_yellow_single, R.drawable.list_blue_single, @@ -115,19 +123,23 @@ public class ResourceParser { R.drawable.list_green_single, R.drawable.list_red_single }; - + + //ڻȡضidӦĵһʼǵıԴID public static int getNoteBgFirstRes(int id) { return BG_FIRST_RESOURCES[id]; } +//ڻȡضidӦһʼǵıԴID public static int getNoteBgLastRes(int id) { return BG_LAST_RESOURCES[id]; } +//ڻȡضidӦֻһʼʱıԴID public static int getNoteBgSingleRes(int id) { return BG_SINGLE_RESOURCES[id]; } +//ڻȡضidӦмʼǵıԴID public static int getNoteBgNormalRes(int id) { return BG_NORMAL_RESOURCES[id]; } @@ -174,9 +186,7 @@ public class ResourceParser { //һݴĺֹidԴˣԶĬϵý public static int getTexAppearanceResource(int id) { /** - * HACKME: Fix bug of store the resource id in shared preference. - * The id may larger than the length of resources, in this case, - * return the {@link ResourceParser#BG_DEFAULT_FONT_SIZE} + * HACKME޸Դ ID 洢ڹѡеĴid ܴԴ ȣڱУ {@link ResourceParser#BG_DEFAULT_FONT_SIZE} */ if (id >= TEXTAPPEARANCE_RESOURCES.length) { return BG_DEFAULT_FONT_SIZE;