use of com.google.samples.apps.iosched.io.model.Hashtag in project iosched by google.
the class HashtagsHandler method makeContentProviderOperations.
@Override
public void makeContentProviderOperations(ArrayList<ContentProviderOperation> list) {
LOGD(TAG, "makeContentProviderOperations");
Uri uri = ScheduleContractHelper.setUriAsCalledFromSyncAdapter(ScheduleContract.Hashtags.CONTENT_URI);
// Remove all the current entries
list.add(ContentProviderOperation.newDelete(uri).build());
// Insert hashtags
for (Hashtag hashtag : mHashtags.values()) {
ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(uri);
builder.withValue(ScheduleContract.Hashtags.HASHTAG_NAME, hashtag.name);
builder.withValue(ScheduleContract.Hashtags.HASHTAG_DESCRIPTION, hashtag.description);
try {
builder.withValue(ScheduleContract.Hashtags.HASHTAG_COLOR, Color.parseColor(hashtag.color));
} catch (IllegalArgumentException e) {
builder.withValue(ScheduleContract.Hashtags.HASHTAG_COLOR, Color.BLACK);
}
builder.withValue(ScheduleContract.Hashtags.HASHTAG_ORDER, hashtag.order);
list.add(builder.build());
}
LOGD(TAG, "Hashtags: " + mHashtags.size());
}
Aggregations