public String getEmailLabel() { return getAsString(ContactsContract.CommonDataKinds.Email.LABEL); } }
public String getPhoneticFamilyName() { return getAsString(ContactsContract.CommonDataKinds.StructuredName.PHONETIC_FAMILY_NAME); }
public String getEmailData() { return getAsString(ContactsContract.CommonDataKinds.Email.DATA); }
public String getPhoneNormalizedNumber() { return getAsString(ContactsContract.CommonDataKinds.Phone.NORMALIZED_NUMBER); }
public String getPhoneticMiddleName() { return getAsString(ContactsContract.CommonDataKinds.StructuredName.PHONETIC_MIDDLE_NAME); }
public String getPhoneNumber() { return getAsString(ContactsContract.CommonDataKinds.Phone.NUMBER); }
public String getMimetype() { return getAsString(ContactsContract.Data.MIMETYPE); }
public String getPhoneticGivenName() { return getAsString(ContactsContract.CommonDataKinds.StructuredName.PHONETIC_GIVEN_NAME); }
public String getDisplayName() { return getAsString(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME); }
public String getPhoneLabel() { return getAsString(ContactsContract.CommonDataKinds.Phone.LABEL); }
/** * Check if the given {@link ValuesDelta} is both a subset of this * object, and any defined keys have equal values. */ public boolean subsetEquals(ValuesDelta other) { for (String key : this.keySet()) { final String ourValue = this.getAsString(key); final String theirValue = other.getAsString(key); if (ourValue == null) { // If they have value when we're null, no match if (theirValue != null) return false; } else { // If both values defined and aren't equal, no match if (!ourValue.equals(theirValue)) return false; } } // All values compared and matched return true; }
public String getAccountName() { return getValues().getAsString(RawContacts.ACCOUNT_NAME); }
public String getAccountType() { return getValues().getAsString(RawContacts.ACCOUNT_TYPE); }
public String getDataSet() { return getValues().getAsString(RawContacts.DATA_SET); }
/** * Compares corresponding fields in values1 and values2. Only the fields * declared by the DataKind are taken into consideration. */ protected static boolean areEqual(ValuesDelta values1, ContentValues values2, DataKind kind) { if (kind.fieldList == null) return false; for (EditField field : kind.fieldList) { final String value1 = values1.getAsString(field.column); final String value2 = values2.getAsString(field.column); if (!TextUtils.equals(value1, value2)) { return false; } } return true; }
/** * Helper for building string representation, leveraging the given * {@link StringBuilder} to minimize allocations. */ public void toString(StringBuilder builder) { builder.append("{ "); builder.append("IdColumn="); builder.append(mIdColumn); builder.append(", FromTemplate="); builder.append(mFromTemplate); builder.append(", "); for (String key : this.keySet()) { builder.append(key); builder.append("="); builder.append(this.getAsString(key)); builder.append(", "); } builder.append("}"); }
/** * Processing to trim any empty {@link ValuesDelta} and {@link RawContactDelta} * from the given {@link RawContactDeltaList}, assuming the given {@link AccountTypeManager} * dictates the structure for various fields. This method ignores rows not * described by the {@link AccountType}. */ public static void trimEmpty(RawContactDeltaList set, AccountTypeManager accountTypes) { for (RawContactDelta state : set) { ValuesDelta values = state.getValues(); final String accountType = values.getAsString(RawContacts.ACCOUNT_TYPE); final String dataSet = values.getAsString(RawContacts.DATA_SET); final AccountType type = accountTypes.getAccountType(accountType, dataSet); trimEmpty(state, type); } }
/** * Test if the given {@link ValuesDelta} would be considered "empty" in * terms of {@link DataKind#fieldList}. */ public static boolean isEmpty(ValuesDelta values, DataKind kind) { if (Photo.CONTENT_ITEM_TYPE.equals(kind.mimeType)) { return values.isInsert() && values.getAsByteArray(Photo.PHOTO) == null; } // No defined fields mean this row is always empty if (kind.fieldList == null) return true; for (EditField field : kind.fieldList) { // If any field has values, we're not empty final String value = values.getAsString(field.column); if (ContactsUtils.isGraphic(value)) { return false; } } return true; }
public static boolean hasChanges(RawContactDeltaList set, AccountTypeManager accountTypes, Set<String> excludedMimeTypes) { if (set.isMarkedForSplitting() || set.isMarkedForJoining()) { return true; } for (RawContactDelta state : set) { ValuesDelta values = state.getValues(); final String accountType = values.getAsString(RawContacts.ACCOUNT_TYPE); final String dataSet = values.getAsString(RawContacts.DATA_SET); final AccountType type = accountTypes.getAccountType(accountType, dataSet); if (hasChanges(state, type, excludedMimeTypes)) { return true; } } return false; }
public void copyStringFrom(ValuesDelta from, String key) { ensureUpdate(); if (containsKey(key) || from.containsKey(key)) { put(key, from.getAsString(key)); } }