use of com.android.contacts.common.model.RawContact in project packages_apps_Contacts by AOKP.
the class ImageViewDrawableSetter method setupContactPhoto.
public Bitmap setupContactPhoto(Contact contactData, ImageView photoView) {
Account account = null;
mContact = contactData;
setTarget(photoView);
RawContact rawContact = contactData.getRawContacts().get(0);
final String accountType = rawContact.getAccountTypeString();
final String accountName = rawContact.getAccountName();
if (!TextUtils.isEmpty(accountType) && !TextUtils.isEmpty(accountName)) {
account = new Account(accountName, accountType);
}
return setCompressedImage(contactData.getPhotoBinaryData(), photoView.getContext(), account);
}
use of com.android.contacts.common.model.RawContact 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();
}
}
use of com.android.contacts.common.model.RawContact in project packages_apps_Contacts by AOKP.
the class ContactEditorBaseFragment method createLocalRawContactDelta.
/**
* Returns a {@link RawContactDelta} for a local contact suitable for addition into
* {@link #mState}.
*/
private static RawContactDelta createLocalRawContactDelta() {
final RawContact rawContact = new RawContact();
rawContact.setAccountToLocal();
final RawContactDelta result = new RawContactDelta(ValuesDelta.fromAfter(rawContact.getValues()));
result.setProfileQueryUri();
return result;
}
Aggregations