Search in sources :

Example 11 with RawContact

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);
}
Also used : Account(android.accounts.Account) RawContact(com.android.contacts.common.model.RawContact)

Example 12 with RawContact

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();
    }
}
Also used : RawContact(com.android.contacts.common.model.RawContact) RawContactDeltaList(com.android.contacts.common.model.RawContactDeltaList)

Example 13 with RawContact

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;
}
Also used : RawContact(com.android.contacts.common.model.RawContact) RawContactDelta(com.android.contacts.common.model.RawContactDelta)

Aggregations

RawContact (com.android.contacts.common.model.RawContact)13 DataItem (com.android.contacts.common.model.dataitem.DataItem)5 SpannableString (android.text.SpannableString)4 RawContactDelta (com.android.contacts.common.model.RawContactDelta)4 AccountType (com.android.contacts.common.model.account.AccountType)4 GroupMembershipDataItem (com.android.contacts.common.model.dataitem.GroupMembershipDataItem)4 OrganizationDataItem (com.android.contacts.common.model.dataitem.OrganizationDataItem)4 EmailDataItem (com.android.contacts.common.model.dataitem.EmailDataItem)3 EventDataItem (com.android.contacts.common.model.dataitem.EventDataItem)3 ImDataItem (com.android.contacts.common.model.dataitem.ImDataItem)3 NicknameDataItem (com.android.contacts.common.model.dataitem.NicknameDataItem)3 NoteDataItem (com.android.contacts.common.model.dataitem.NoteDataItem)3 PhoneDataItem (com.android.contacts.common.model.dataitem.PhoneDataItem)3 RelationDataItem (com.android.contacts.common.model.dataitem.RelationDataItem)3 SipAddressDataItem (com.android.contacts.common.model.dataitem.SipAddressDataItem)3 StructuredNameDataItem (com.android.contacts.common.model.dataitem.StructuredNameDataItem)3 StructuredPostalDataItem (com.android.contacts.common.model.dataitem.StructuredPostalDataItem)3 WebsiteDataItem (com.android.contacts.common.model.dataitem.WebsiteDataItem)3 AccountWithDataSet (com.android.contacts.common.model.account.AccountWithDataSet)2 ArrayList (java.util.ArrayList)2