Merge change 20621
* changes: Delete rows that are unused when changes are synced down
This commit is contained in:
commit
b3df387094
@ -104,6 +104,8 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter {
|
|||||||
return p.parse();
|
return p.parse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// YomiFirstName, YomiLastName, and YomiCompanyName are the names of EAS fields
|
||||||
|
// Yomi is a shortened form of yomigana, which is a Japanese phonetic rendering.
|
||||||
public static final class Yomi {
|
public static final class Yomi {
|
||||||
private Yomi() {}
|
private Yomi() {}
|
||||||
|
|
||||||
@ -494,6 +496,17 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter {
|
|||||||
if (companyName != null) {
|
if (companyName != null) {
|
||||||
ops.addOrganization(entity, Organization.TYPE_WORK, companyName, title);
|
ops.addOrganization(entity, Organization.TYPE_WORK, companyName, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (entity != null) {
|
||||||
|
// We've been removing rows from the list as they've been found in the xml
|
||||||
|
// Any that are left must have been deleted on the server
|
||||||
|
ArrayList<NamedContentValues> ncvList = entity.getSubValues();
|
||||||
|
for (NamedContentValues ncv: ncvList) {
|
||||||
|
// These rows need to be deleted...
|
||||||
|
Uri u = dataUriFromNamedContentValues(ncv);
|
||||||
|
ops.add(ContentProviderOperation.newDelete(u).build());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void categoriesParser(ContactOperations ops, Entity entity) throws IOException {
|
private void categoriesParser(ContactOperations ops, Entity entity) throws IOException {
|
||||||
@ -776,17 +789,6 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate the uri for the data row associated with this NamedContentValues object
|
|
||||||
* @param ncv the NamedContentValues object
|
|
||||||
* @return a uri that can be used to refer to this row
|
|
||||||
*/
|
|
||||||
private Uri dataUriFromNamedContentValues(NamedContentValues ncv) {
|
|
||||||
long id = ncv.values.getAsLong(RawContacts._ID);
|
|
||||||
Uri dataUri = ContentUris.withAppendedId(ncv.uri, id);
|
|
||||||
return dataUri;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given the list of NamedContentValues for an entity, a mime type, and a subtype,
|
* Given the list of NamedContentValues for an entity, a mime type, and a subtype,
|
||||||
* tries to find a match, returning it
|
* tries to find a match, returning it
|
||||||
@ -1116,6 +1118,17 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the uri for the data row associated with this NamedContentValues object
|
||||||
|
* @param ncv the NamedContentValues object
|
||||||
|
* @return a uri that can be used to refer to this row
|
||||||
|
*/
|
||||||
|
public Uri dataUriFromNamedContentValues(NamedContentValues ncv) {
|
||||||
|
long id = ncv.values.getAsLong(RawContacts._ID);
|
||||||
|
Uri dataUri = ContentUris.withAppendedId(ncv.uri, id);
|
||||||
|
return dataUri;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cleanup(EasSyncService service) {
|
public void cleanup(EasSyncService service) {
|
||||||
// Mark the changed contacts dirty = 0
|
// Mark the changed contacts dirty = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user