补偿note类和contact类的注释

syh
19960030627 2 years ago
parent 8ed2a4137e
commit 6a3195b72a

@ -25,9 +25,20 @@ import android.util.Log;
import java.util.HashMap;
/**
* change
*/
public class Contact {
/**
*
*/
private static HashMap<String, String> sContactCache;
private static final String TAG = "Contact";
/**
* CALLER_ID_SELECTION
*/
private static final String CALLER_ID_SELECTION = "PHONE_NUMBERS_EQUAL(" + Phone.NUMBER
+ ",?) AND " + Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'"
@ -36,6 +47,13 @@ public class Contact {
+ " FROM phone_lookup"
+ " WHERE min_match = '+')";
/**
*
* @param context
* @param phoneNumber
* @return
*/
public static String getContact(Context context, String phoneNumber) {
if(sContactCache == null) {
sContactCache = new HashMap<String, String>();
@ -47,6 +65,7 @@ public class Contact {
String selection = CALLER_ID_SELECTION.replace("+",
PhoneNumberUtils.toCallerIDMinMatch(phoneNumber));
Cursor cursor = context.getContentResolver().query(
Data.CONTENT_URI,
new String [] { Phone.DISPLAY_NAME },

@ -35,6 +35,9 @@ import java.util.ArrayList;
public class Note {
/**
*private ContentValues mNoteDiffValues;
*/
private ContentValues mNoteDiffValues;
private NoteData mNoteData;
private static final String TAG = "Note";
@ -50,7 +53,14 @@ public class Note {
values.put(NoteColumns.TYPE, Notes.TYPE_NOTE);
values.put(NoteColumns.LOCAL_MODIFIED, 1);
values.put(NoteColumns.PARENT_ID, folderId);
/**
*
*/
Uri uri = context.getContentResolver().insert(Notes.CONTENT_NOTE_URI, values);
/**
* ContentResolver()ContentProvider
*
*/
long noteId = 0;
try {
@ -59,6 +69,9 @@ public class Note {
Log.e(TAG, "Get note id error :" + e.toString());
noteId = 0;
}
/**
* try-catch
*/
if (noteId == -1) {
throw new IllegalStateException("Wrong note id:" + noteId);
}
@ -70,36 +83,81 @@ public class Note {
mNoteData = new NoteData();
}
/**
* 便便便
* @param key
* @param value
*/
public void setNoteValue(String key, String value) {
mNoteDiffValues.put(key, value);
mNoteDiffValues.put(NoteColumns.LOCAL_MODIFIED, 1);
mNoteDiffValues.put(NoteColumns.MODIFIED_DATE, System.currentTimeMillis());
}
/**
*
* @param key
* @param value
*/
public void setTextData(String key, String value) {
mNoteData.setTextData(key, value);
}
/**
*
* @param id
*/
public void setTextDataId(long id) {
mNoteData.setTextDataId(id);
}
/**
* ID
* @return
*/
public long getTextDataId() {
return mNoteData.mTextDataId;
}
/**
* ID
* @param id
*/
public void setCallDataId(long id) {
mNoteData.setCallDataId(id);
}
/**
* ID
* @param key
* @param value
*/
public void setCallData(String key, String value) {
mNoteData.setCallData(key, value);
}
/**
* ID
* @return
*/
public boolean isLocalModified() {
return mNoteDiffValues.size() > 0 || mNoteData.isLocalModified();
}
/**
*
* @param context
* @param noteId
* @return
*/
public boolean syncNote(Context context, long noteId) {
if (noteId <= 0) {
throw new IllegalArgumentException("Wrong note id:" + noteId);
@ -130,14 +188,27 @@ public class Note {
return true;
}
/**
*
*/
private class NoteData {
/**
* 便
*/
private long mTextDataId;
private ContentValues mTextDataValues;
/**
*
*/
private long mCallDataId;
private ContentValues mCallDataValues;
/**
*
*/
private static final String TAG = "NoteData";
@ -148,6 +219,11 @@ public class Note {
mCallDataId = 0;
}
/**
*
* @return
*/
boolean isLocalModified() {
return mTextDataValues.size() > 0 || mCallDataValues.size() > 0;
}
@ -178,6 +254,13 @@ public class Note {
mNoteDiffValues.put(NoteColumns.MODIFIED_DATE, System.currentTimeMillis());
}
/**
* Uri
* @param context
* @param noteId
* @return
*/
Uri pushIntoContentResolver(Context context, long noteId) {
/**
* Check for safety
@ -185,9 +268,15 @@ public class Note {
if (noteId <= 0) {
throw new IllegalArgumentException("Wrong note id:" + noteId);
}
/**
*
*/
ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>();
ContentProviderOperation.Builder builder = null;
/**
*
*/
if(mTextDataValues.size() > 0) {
mTextDataValues.put(DataColumns.NOTE_ID, noteId);
@ -210,6 +299,9 @@ public class Note {
}
mTextDataValues.clear();
}
/**
* DataColums
*/
if(mCallDataValues.size() > 0) {
mCallDataValues.put(DataColumns.NOTE_ID, noteId);
@ -232,6 +324,9 @@ public class Note {
}
mCallDataValues.clear();
}
/**
* DataColumns
*/
if (operationList.size() > 0) {
try {
@ -247,6 +342,9 @@ public class Note {
return null;
}
}
/**
*
*/
return null;
}
}

@ -2,6 +2,7 @@
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
#
#Sun Mar 26 21:27:32 CST 2023
sdk.dir=C\:\\Users\\MikkoAyaka\\AppData\\Local\\Android\\Sdk
# For customization when using a Version Control System, please read the
# header note.
#Fri Mar 31 16:17:52 CST 2023
sdk.dir=C\:\\Users\\13474\\AppData\\Local\\Android\\Sdk

Loading…
Cancel
Save