use of com.android.contacts.common.model.RawContactDeltaList in project packages_apps_Contacts by AOKP.
the class AttachPhotoActivity method saveContact.
/**
* If prerequisites have been met, attach the photo to a raw-contact and save.
* The prerequisites are:
* - photo has been cropped
* - contact has been loaded
*/
private void saveContact(Contact contact) {
if (contact.getRawContacts() == null) {
Log.w(TAG, "No raw contacts found for contact");
finish();
return;
}
// Obtain the raw-contact that we will save to.
RawContactDeltaList deltaList = contact.createRawContactDeltaList();
RawContactDelta raw = deltaList.getFirstWritableRawContact(this);
if (raw == null) {
// We can't directly insert this photo since no raw contacts exist in the contact.
selectAccountAndCreateContact();
return;
}
saveToContact(contact, deltaList, raw);
}
use of com.android.contacts.common.model.RawContactDeltaList in project packages_apps_Contacts by AOKP.
the class ContactEditorBaseFragment method onCreate.
@Override
public void onCreate(Bundle savedState) {
if (savedState != null) {
// Restore mUri before calling super.onCreate so that onInitializeLoaders
// would already have a uri and an action to work with
mAction = savedState.getString(KEY_ACTION);
mLookupUri = savedState.getParcelable(KEY_URI);
}
super.onCreate(savedState);
if (savedState == null) {
mViewIdGenerator = new ViewIdGenerator();
} else {
mViewIdGenerator = savedState.getParcelable(KEY_VIEW_ID_GENERATOR);
mAutoAddToDefaultGroup = savedState.getBoolean(KEY_AUTO_ADD_TO_DEFAULT_GROUP);
mDisableDeleteMenuOption = savedState.getBoolean(KEY_DISABLE_DELETE_MENU_OPTION);
mNewLocalProfile = savedState.getBoolean(KEY_NEW_LOCAL_PROFILE);
mMaterialPalette = savedState.getParcelable(KEY_MATERIAL_PALETTE);
mPhotoId = savedState.getLong(KEY_PHOTO_ID);
mRawContacts = ImmutableList.copyOf(savedState.<RawContact>getParcelableArrayList(KEY_RAW_CONTACTS));
// NOTE: mGroupMetaData is not saved/restored
// Read state from savedState. No loading involved here
mState = savedState.<RawContactDeltaList>getParcelable(KEY_EDIT_STATE);
mStatus = savedState.getInt(KEY_STATUS);
mRawContactDisplayAloneIsReadOnly = savedState.getBoolean(KEY_RAW_CONTACT_DISPLAY_ALONE_IS_READ_ONLY);
mHasNewContact = savedState.getBoolean(KEY_HAS_NEW_CONTACT);
mNewContactDataReady = savedState.getBoolean(KEY_NEW_CONTACT_READY);
mIsEdit = savedState.getBoolean(KEY_IS_EDIT);
mExistingContactDataReady = savedState.getBoolean(KEY_EXISTING_CONTACT_READY);
mIsUserProfile = savedState.getBoolean(KEY_IS_USER_PROFILE);
// Phone specific options menus
mSendToVoicemailState = savedState.getBoolean(KEY_SEND_TO_VOICE_MAIL_STATE);
mArePhoneOptionsChangable = savedState.getBoolean(KEY_ARE_PHONE_OPTIONS_CHANGEABLE);
mCustomRingtone = savedState.getString(KEY_CUSTOM_RINGTONE);
mEnabled = savedState.getBoolean(KEY_ENABLED);
// Aggregation PopupWindow
mAggregationSuggestionsRawContactId = savedState.getLong(KEY_AGGREGATION_SUGGESTIONS_RAW_CONTACT_ID);
// Join Activity
mContactIdForJoin = savedState.getLong(KEY_CONTACT_ID_FOR_JOIN);
mReadOnlyDisplayName = savedState.getString(KEY_READ_ONLY_DISPLAY_NAME);
}
// onSaveInstanceState was called.
if (mState == null) {
mState = new RawContactDeltaList();
}
}
Aggregations