本文整理汇总了Java中android.content.ContentProviderOperation.newUpdate方法的典型用法代码示例。如果您正苦于以下问题:Java ContentProviderOperation.newUpdate方法的具体用法?Java ContentProviderOperation.newUpdate怎么用?Java ContentProviderOperation.newUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.ContentProviderOperation
的用法示例。
在下文中一共展示了ContentProviderOperation.newUpdate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildSpeaker
import android.content.ContentProviderOperation; //导入方法依赖的package包/类
private void buildSpeaker(boolean isInsert, Speaker speaker,
ArrayList<ContentProviderOperation> list) {
Uri allSpeakersUri = ScheduleContractHelper.setUriAsCalledFromSyncAdapter(
ScheduleContract.Speakers.CONTENT_URI);
Uri thisSpeakerUri = ScheduleContractHelper.setUriAsCalledFromSyncAdapter(
ScheduleContract.Speakers.buildSpeakerUri(speaker.id));
ContentProviderOperation.Builder builder;
if (isInsert) {
builder = ContentProviderOperation.newInsert(allSpeakersUri);
} else {
builder = ContentProviderOperation.newUpdate(thisSpeakerUri);
}
list.add(builder.withValue(ScheduleContract.SyncColumns.UPDATED, System.currentTimeMillis())
.withValue(ScheduleContract.Speakers.SPEAKER_ID, speaker.id)
.withValue(ScheduleContract.Speakers.SPEAKER_NAME, speaker.name)
.withValue(ScheduleContract.Speakers.SPEAKER_ABSTRACT, speaker.bio)
.withValue(ScheduleContract.Speakers.SPEAKER_COMPANY, speaker.company)
.withValue(ScheduleContract.Speakers.SPEAKER_IMAGE_URL, speaker.thumbnailUrl)
.withValue(ScheduleContract.Speakers.SPEAKER_PLUSONE_URL, speaker.plusoneUrl)
.withValue(ScheduleContract.Speakers.SPEAKER_TWITTER_URL, speaker.twitterUrl)
.withValue(ScheduleContract.Speakers.SPEAKER_IMPORT_HASHCODE,
speaker.getImportHashcode())
.build());
}
示例2: buildVideo
import android.content.ContentProviderOperation; //导入方法依赖的package包/类
private void buildVideo(boolean isInsert, Video video,
ArrayList<ContentProviderOperation> list) {
Uri allVideosUri = ScheduleContractHelper.setUriAsCalledFromSyncAdapter(
ScheduleContract.Videos.CONTENT_URI);
Uri thisVideoUri = ScheduleContractHelper.setUriAsCalledFromSyncAdapter(
ScheduleContract.Videos.buildVideoUri(video.id));
ContentProviderOperation.Builder builder;
if (isInsert) {
builder = ContentProviderOperation.newInsert(allVideosUri);
} else {
builder = ContentProviderOperation.newUpdate(thisVideoUri);
}
if (TextUtils.isEmpty(video.vid)) {
LOGW(TAG, "Ignoring video with missing video ID.");
return;
}
String thumbUrl = video.thumbnailUrl;
if (TextUtils.isEmpty(thumbUrl)) {
// Oops, missing thumbnail URL. Let's improvise.
// NOTE: this method of obtaining a thumbnail URL from the video ID
// is unofficial and might not work in the future; that's why we use
// it only as a fallback in case we don't get a thumbnail URL in the incoming data.
thumbUrl = String.format(Locale.US, Config.VIDEO_LIBRARY_FALLBACK_THUMB_URL_FMT, video.vid);
LOGW(TAG, "Video with missing thumbnail URL: " + video.vid
+ ". Using fallback: " + thumbUrl);
}
list.add(builder.withValue(ScheduleContract.Videos.VIDEO_ID, video.id)
.withValue(ScheduleContract.Videos.VIDEO_YEAR, video.year)
.withValue(ScheduleContract.Videos.VIDEO_TITLE, video.title.trim())
.withValue(ScheduleContract.Videos.VIDEO_DESC, video.desc)
.withValue(ScheduleContract.Videos.VIDEO_VID, video.vid)
.withValue(ScheduleContract.Videos.VIDEO_TOPIC, video.topic)
.withValue(ScheduleContract.Videos.VIDEO_SPEAKERS, video.speakers)
.withValue(ScheduleContract.Videos.VIDEO_THUMBNAIL_URL, thumbUrl)
.withValue(ScheduleContract.Videos.VIDEO_IMPORT_HASHCODE,
video.getImportHashcode())
.build());
}
示例3: contentOperationBuilder
import android.content.ContentProviderOperation; //导入方法依赖的package包/类
@NonNull
@Override
public ContentProviderOperation.Builder contentOperationBuilder(@NonNull TransactionContext transactionContext) throws UnsupportedOperationException
{
return ContentProviderOperation.newUpdate(mUri);
}
示例4: putOperationBuilder
import android.content.ContentProviderOperation; //导入方法依赖的package包/类
@NonNull
@Override
public ContentProviderOperation.Builder putOperationBuilder(@NonNull TransactionContext transactionContext)
{
return ContentProviderOperation.newUpdate(mRowUri);
}
示例5: addUpdate
import android.content.ContentProviderOperation; //导入方法依赖的package包/类
public void addUpdate(FileScanInfo update, long fileId) {
Builder builder = ContentProviderOperation.newUpdate(VideoStoreInternal.FILES_SCANNED);
builder.withValues(update.toContentValues());
builder.withSelection(SELECT_ID, new String[]{ String.valueOf(fileId) });
mUpdateExecutor.add(builder.build());
}