Java Code Examples for android.content.ContentProviderOperation.Builder

The following are Jave code examples for showing how to use Builder of the android.content.ContentProviderOperation class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: ContentPal   File: Composite.java   Source Code and License Vote up 5 votes
@NonNull
@Override
public ContentProviderOperation.Builder updatedBuilder(TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder)
{
    for (RowData<T> rowData : mDelegates)
    {
        rowData.updatedBuilder(transactionContext, builder);
    }
    return builder;
}
 
Example 2
Project: ContentPal   File: NameData.java   Source Code and License Vote up 5 votes
@NonNull
@Override
public ContentProviderOperation.Builder updatedBuilder(TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder)
{
    return mDelegate.updatedBuilder(transactionContext, builder)
            .withValue(ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME, mFirstName == null ? null : mFirstName.toString())
            .withValue(ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME, mLastName == null ? null : mLastName.toString());
}
 
Example 3
Project: ContentPal   File: Typed.java   Source Code and License Vote up 5 votes
@NonNull
@Override
public ContentProviderOperation.Builder updatedBuilder(TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder)
{
    // note that all data types use the same column for TYPE
    return mDelegate.updatedBuilder(transactionContext, builder).withValue(ContactsContract.CommonDataKinds.Phone.TYPE, mType);
}
 
Example 4
Project: ContentPal   File: JobData.java   Source Code and License Vote up 5 votes
@NonNull
@Override
public ContentProviderOperation.Builder updatedBuilder(TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder)
{
    return mDelegate.updatedBuilder(transactionContext, builder)
            .withValue(ContactsContract.CommonDataKinds.Organization.JOB_DESCRIPTION, mJobDescription == null ? null : mJobDescription.toString());
}
 
Example 5
Project: ContentPal   File: PhotoData.java   Source Code and License Vote up 5 votes
@NonNull
@Override
public ContentProviderOperation.Builder updatedBuilder(TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder)
{
    return builder
            .withValue(ContactsContract.CommonDataKinds.Photo.MIMETYPE, ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE)
            .withValue(ContactsContract.CommonDataKinds.Photo.PHOTO, mPhotoData);
}
 
Example 6
Project: ContentPal   File: Custom.java   Source Code and License Vote up 5 votes
@NonNull
@Override
public ContentProviderOperation.Builder updatedBuilder(TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder)
{
    return mDelegate.updatedBuilder(transactionContext, builder)
            // note this is universal, because all supported data types use the same type and label column for custom labels
            .withValue(ContactsContract.CommonDataKinds.Phone.TYPE, ContactsContract.CommonDataKinds.BaseTypes.TYPE_CUSTOM)
            .withValue(ContactsContract.CommonDataKinds.Phone.LABEL, mLabel.toString());

}
 
Example 7
Project: ContentPal   File: PhoneticNameData.java   Source Code and License Vote up 5 votes
@NonNull
@Override
public ContentProviderOperation.Builder updatedBuilder(TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder)
{
    return mDelegate.updatedBuilder(transactionContext, builder)
            .withValue(ContactsContract.CommonDataKinds.StructuredName.PHONETIC_GIVEN_NAME, mFirstName == null ? null : mFirstName.toString())
            .withValue(ContactsContract.CommonDataKinds.StructuredName.PHONETIC_MIDDLE_NAME, mMiddleName == null ? null : mMiddleName.toString())
            .withValue(ContactsContract.CommonDataKinds.StructuredName.PHONETIC_FAMILY_NAME, mLastName == null ? null : mLastName.toString());
}
 
Example 8
Project: ContentPal   File: RegionData.java   Source Code and License Vote up 5 votes
@NonNull
@Override
public ContentProviderOperation.Builder updatedBuilder(TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder)
{
    return mDelegate.updatedBuilder(transactionContext, builder)
            .withValue(ContactsContract.CommonDataKinds.StructuredPostal.REGION, mRegion == null ? null : mRegion.toString());
}
 
Example 9
Project: ContentPal   File: OperationType.java   Source Code and License Vote up 5 votes
@Override
protected boolean matchesSafely(ContentProviderOperation.Builder builder, Description mismatchDescription)
{
    Integer typeValue = new Field<Integer>(builder, "mType").value();
    if (mExpectedType.ordinal() + 1 /* 1-based */ != typeValue)
    {
        mismatchDescription.appendText(String.format(Locale.ENGLISH, "was an %s operation", Type.values()[typeValue - 1]));
        return false;
    }
    return true;
}
 
Example 10
Project: ContentPal   File: WithYieldAllowed.java   Source Code and License Vote up 5 votes
@Override
protected boolean matchesSafely(ContentProviderOperation.Builder builder, Description mismatchDescription)
{
    boolean yieldable = new Field<Boolean>(builder, "mYieldAllowed").value();
    if (mYieldable != yieldable)
    {
        mismatchDescription.appendText(String.format(Locale.ENGLISH, "yieldable was %s", Boolean.toString(yieldable)));
        return false;
    }
    return true;
}
 
Example 11
Project: ContentPal   File: NoteData.java   Source Code and License Vote up 5 votes
@NonNull
@Override
public ContentProviderOperation.Builder updatedBuilder(TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder)
{
    return builder
            .withValue(ContactsContract.CommonDataKinds.Note.MIMETYPE, ContactsContract.CommonDataKinds.Note.CONTENT_ITEM_TYPE)
            .withValue(ContactsContract.CommonDataKinds.Note.NOTE, mNote.toString());
}
 
Example 12
Project: ContentPal   File: EmptyNameData.java   Source Code and License Vote up 5 votes
@NonNull
@Override
public ContentProviderOperation.Builder updatedBuilder(TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder)
{
    // add content item type here, so other name data can just delegate this part
    return builder.withValue(ContactsContract.CommonDataKinds.StructuredName.MIMETYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE);
}
 
Example 13
Project: ContentPal   File: CharSequenceRowData.java   Source Code and License Vote up 4 votes
@NonNull
@Override
public ContentProviderOperation.Builder updatedBuilder(TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder)
{
    return builder.withValue(mKey, mValue == null ? null : mValue.toString());
}
 
Example 14
Project: ContentPal   File: BackReference.java   Source Code and License Vote up 4 votes
@NonNull
@Override
public ContentProviderOperation.Builder putOperationBuilder(@NonNull TransactionContext transactionContext)
{
    return withSelection(ContentProviderOperation.newUpdate(mUri), BaseColumns._ID);
}
 
Example 15
Project: ContentPal   File: AccountScoped.java   Source Code and License Vote up 4 votes
@NonNull
@Override
public ContentProviderOperation.Builder contentOperationBuilder(@NonNull TransactionContext transactionContext) throws UnsupportedOperationException
{
    return mDelegate.contentOperationBuilder(transactionContext).withValue("account_type", mAccount.type).withValue("account_name", mAccount.name);
}
 
Example 16
Project: ContentPal   File: RowSnapshotReference.java   Source Code and License Vote up 4 votes
@NonNull
@Override
public ContentProviderOperation.Builder assertOperationBuilder(@NonNull TransactionContext transactionContext)
{
    return transactionContext.resolved(mRowSnapshot.reference()).assertOperationBuilder(transactionContext);
}
 
Example 17
Project: ContentPal   File: Colored.java   Source Code and License Vote up 4 votes
@NonNull
@Override
public ContentProviderOperation.Builder updatedBuilder(TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder)
{
    return mDelegate.updatedBuilder(transactionContext, builder).withValue(CalendarContract.Events.EVENT_COLOR, mColor);
}
 
Example 18
Project: ContentPal   File: Visible.java   Source Code and License Vote up 4 votes
@NonNull
@Override
public ContentProviderOperation.Builder updatedBuilder(TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder)
{
    return mDelegate.updatedBuilder(transactionContext, builder).withValue(CalendarContract.Calendars.VISIBLE, mVisible ? 1 : 0);
}
 
Example 19
Project: ContentPal   File: CalendarEvent.java   Source Code and License Vote up 4 votes
@NonNull
@Override
public ContentProviderOperation.Builder contentOperationBuilder(@NonNull TransactionContext transactionContext) throws UnsupportedOperationException
{
    return mDelegate.contentOperationBuilder(transactionContext);
}
 
Example 20
Project: ContentPal   File: RowReference.java   Source Code and License Vote up 2 votes
/**
 * Creates an {@link ContentProviderOperation.Builder} that will assert on the referred row.
 *
 * @param transactionContext
 *         A {@link TransactionContext} of the {@link Transaction} this is being executed in.
 *
 * @return A {@link ContentProviderOperation.Builder}.
 *
 * @throws IllegalStateException
 *         if the {@link RowReference} doesn't refer to an existing row.
 */
@NonNull
ContentProviderOperation.Builder assertOperationBuilder(@NonNull TransactionContext transactionContext);