if (!hasChild && kind != null) {
// Create child when none exists and valid kind
- insertChild(state, kind);
+ final ValuesDelta child = insertChild(state, kind);
+ if (kind.mimeType.equals(Photo.CONTENT_ITEM_TYPE)) {
+ child.setFromTemplate(true);
+ }
}
}
public static ValuesDelta insertChild(EntityDelta state, DataKind kind, EditType type) {
// Bail early if invalid kind
if (kind == null) return null;
-
final ContentValues after = new ContentValues();
// Our parent CONTACT_ID is provided later
}
final ValuesDelta child = ValuesDelta.fromAfter(after);
- state.addEntry(child);
+ state.addEntry(child);
return child;
}
state.getValues().getAsString(RawContacts.ACCOUNT_TYPE));
final boolean isPhoto = TextUtils.equals(Photo.CONTENT_ITEM_TYPE, kind.mimeType);
final boolean isGooglePhoto = isPhoto && isGoogleSource;
+
if (EntityModifier.isEmpty(entry, kind) && !isGooglePhoto) {
// TODO: remove this verbose logging
Log.w(TAG, "Trimming: " + entry.toString());
}
}
}
-
if (!hasValues) {
// Trim overall entity if no children exist
state.markDeleted();
setImageBitmap(photo);
setEnabled(!readOnly);
mHasSetPhoto = true;
+ mEntry.setFromTemplate(false);
} else {
resetDefault();
}
mEntry.put(Photo.PHOTO, out.toByteArray());
setImageBitmap(photo);
mHasSetPhoto = true;
+ mEntry.setFromTemplate(false);
} catch (IOException e) {
Log.w(TAG, "Unable to serialize photo: " + e.toString());
}
setScaleType(ImageView.ScaleType.CENTER);
setImageResource(R.drawable.ic_menu_add_picture);
mHasSetPhoto = false;
+ mEntry.setFromTemplate(true);
}
/** {@inheritDoc} */