本文整理汇总了Java中com.google.android.apps.iosched.provider.ScheduleContract.SyncColumns类的典型用法代码示例。如果您正苦于以下问题:Java SyncColumns类的具体用法?Java SyncColumns怎么用?Java SyncColumns使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SyncColumns类属于com.google.android.apps.iosched.provider.ScheduleContract包,在下文中一共展示了SyncColumns类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import com.google.android.apps.iosched.provider.ScheduleContract.SyncColumns; //导入依赖的package包/类
public ArrayList<ContentProviderOperation> parse(String json)
throws IOException {
final ArrayList<ContentProviderOperation> batch = Lists.newArrayList();
SpeakersResponse response = new Gson().fromJson(json, SpeakersResponse.class);
int numEvents = 0;
if (response.speakers != null) {
numEvents = response.speakers.length;
}
if (numEvents > 0) {
LOGI(TAG, "Updating speakers data");
// Clear out existing speakers
batch.add(ContentProviderOperation
.newDelete(ScheduleContract.addCallerIsSyncAdapterParameter(
Speakers.CONTENT_URI))
.build());
for (Speaker speaker : response.speakers) {
String speakerId = speaker.user_id;
// Insert speaker info
batch.add(ContentProviderOperation
.newInsert(ScheduleContract
.addCallerIsSyncAdapterParameter(Speakers.CONTENT_URI))
.withValue(SyncColumns.UPDATED, System.currentTimeMillis())
.withValue(Speakers.SPEAKER_ID, speakerId)
.withValue(Speakers.SPEAKER_NAME, speaker.display_name)
.withValue(Speakers.SPEAKER_ABSTRACT, speaker.bio)
.withValue(Speakers.SPEAKER_IMAGE_URL, speaker.thumbnail_url)
.withValue(Speakers.SPEAKER_URL, speaker.plusone_url)
.build());
}
}
return batch;
}
示例2: doMigration2013RM2
import com.google.android.apps.iosched.provider.ScheduleContract.SyncColumns; //导入依赖的package包/类
private void doMigration2013RM2(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + Tables.FEEDBACK + " ("
+ BaseColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT,"
+ SyncColumns.UPDATED + " INTEGER NOT NULL,"
+ Sessions.SESSION_ID + " TEXT " + References.SESSION_ID + ","
+ FeedbackColumns.SESSION_RATING + " INTEGER NOT NULL,"
+ FeedbackColumns.ANSWER_RELEVANCE + " INTEGER NOT NULL,"
+ FeedbackColumns.ANSWER_CONTENT + " INTEGER NOT NULL,"
+ FeedbackColumns.ANSWER_SPEAKER + " INTEGER NOT NULL,"
+ FeedbackColumns.ANSWER_WILLUSE + " INTEGER NOT NULL,"
+ FeedbackColumns.COMMENTS + " TEXT)");
db.execSQL("CREATE TRIGGER " + Triggers.SESSIONS_FEEDBACK_DELETE + " AFTER DELETE ON "
+ Tables.SESSIONS + " BEGIN DELETE FROM " + Tables.FEEDBACK + " "
+ " WHERE " + Qualified.FEEDBACK_SESSION_ID + "=old." + Sessions.SESSION_ID
+ ";" + " END;");
db.execSQL("CREATE TABLE " + Tables.MAPMARKERS + " ("
+ BaseColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT,"
+ MapMarkerColumns.MARKER_ID+ " TEXT NOT NULL,"
+ MapMarkerColumns.MARKER_TYPE+ " TEXT NOT NULL,"
+ MapMarkerColumns.MARKER_LATITUDE+ " DOUBLE NOT NULL,"
+ MapMarkerColumns.MARKER_LONGITUDE+ " DOUBLE NOT NULL,"
+ MapMarkerColumns.MARKER_LABEL+ " TEXT,"
+ MapMarkerColumns.MARKER_FLOOR+ " INTEGER NOT NULL,"
+ MapMarkerColumns.MARKER_TRACK+ " TEXT,"
+ "UNIQUE (" + MapMarkerColumns.MARKER_ID + ") ON CONFLICT REPLACE)");
}
示例3: buildContentProviderOperations
import com.google.android.apps.iosched.provider.ScheduleContract.SyncColumns; //导入依赖的package包/类
private ArrayList<ContentProviderOperation> buildContentProviderOperations(
PresentersResponse presenters) {
final ArrayList<ContentProviderOperation> batch = Lists.newArrayList();
if (presenters != null) {
List<PresenterResponse> presenterList = presenters.getPresenters();
int numSpeakers = presenterList.size();
if (numSpeakers > 0) {
LOGI(TAG, "Updating presenters data");
// Clear out existing speakers
batch.add(ContentProviderOperation.newDelete(
ScheduleContract.addCallerIsSyncAdapterParameter(
Speakers.CONTENT_URI))
.build());
// Insert latest speaker data
for (PresenterResponse presenter : presenterList) {
// Hack: Fix speaker URL so that it's not being resized
// Depends on thumbnail URL being exactly in the format we want
String thumbnail = presenter.getThumbnailUrl();
if (thumbnail != null) {
thumbnail = thumbnail.replace("?sz=50", "?sz=100");
}
batch.add(ContentProviderOperation.newInsert(ScheduleContract
.addCallerIsSyncAdapterParameter(Speakers.CONTENT_URI))
.withValue(SyncColumns.UPDATED, System.currentTimeMillis())
.withValue(Speakers.SPEAKER_ID, presenter.getId())
.withValue(Speakers.SPEAKER_NAME, presenter.getName())
.withValue(Speakers.SPEAKER_ABSTRACT, presenter.getBio())
.withValue(Speakers.SPEAKER_IMAGE_URL, thumbnail)
.withValue(Speakers.SPEAKER_URL, presenter.getPlusoneUrl())
.build());
}
}
}
return batch;
}
示例4: parse
import com.google.android.apps.iosched.provider.ScheduleContract.SyncColumns; //导入依赖的package包/类
public ArrayList<ContentProviderOperation> parse(String json)
throws IOException {
final ArrayList<ContentProviderOperation> batch = Lists.newArrayList();
SandboxCompany[] companies = new Gson().fromJson(json, SandboxCompany[].class);
if (companies.length > 0) {
LOGI(TAG, "Updating developer sandbox data");
// Clear out existing sandbox companies
batch.add(ContentProviderOperation
.newDelete(ScheduleContract.addCallerIsSyncAdapterParameter(
Vendors.CONTENT_URI))
.build());
StringBuilder companyDescription = new StringBuilder();
String exhibitorsPrefix = mContext.getString(R.string.vendor_exhibitors_prefix);
for (SandboxCompany company : companies) {
// Insert sandbox company info
String website = company.website;
if (!TextUtils.isEmpty(website) && !website.startsWith("http")) {
website = "http://" + website;
}
companyDescription.setLength(0);
if (company.exhibitors != null && company.exhibitors.length > 0) {
companyDescription.append(exhibitorsPrefix);
companyDescription.append(" ");
for (int i = 0; i < company.exhibitors.length; i++) {
companyDescription.append(company.exhibitors[i]);
if (i >= company.exhibitors.length - 1) {
break;
}
companyDescription.append(", ");
}
companyDescription.append("\n\n");
}
if (!TextUtils.isEmpty(company.company_description)) {
companyDescription.append(company.company_description);
companyDescription.append("\n\n");
}
if (!TextUtils.isEmpty(company.product_description)) {
companyDescription.append(company.product_description);
}
// Clean up logo URL
String logoUrl = null;
if (!TextUtils.isEmpty(company.logo_img)) {
logoUrl = company.logo_img.replaceAll(" ", "%20");
if (!logoUrl.startsWith("http")) {
logoUrl = BASE_LOGO_URL + logoUrl;
}
}
batch.add(ContentProviderOperation
.newInsert(ScheduleContract
.addCallerIsSyncAdapterParameter(Vendors.CONTENT_URI))
.withValue(SyncColumns.UPDATED, System.currentTimeMillis())
.withValue(Vendors.VENDOR_ID,
Vendors.generateVendorId(company.company_name))
.withValue(Vendors.VENDOR_NAME, company.company_name)
.withValue(Vendors.VENDOR_DESC, companyDescription.toString())
.withValue(Vendors.VENDOR_PRODUCT_DESC, null) // merged into company desc
.withValue(Vendors.VENDOR_LOGO_URL, logoUrl)
.withValue(Vendors.VENDOR_URL, website)
.withValue(Vendors.TRACK_ID,
ScheduleContract.Tracks.generateTrackId(company.product_pod))
.build());
}
}
return batch;
}
示例5: parse
import com.google.android.apps.iosched.provider.ScheduleContract.SyncColumns; //导入依赖的package包/类
public ArrayList<ContentProviderOperation> parse(String json)
throws IOException {
final ArrayList<ContentProviderOperation> batch = Lists.newArrayList();
AnnouncementsResponse response = new Gson().fromJson(json, AnnouncementsResponse.class);
int numAnnouncements = 0;
if (response.announcements != null) {
numAnnouncements = response.announcements.length;
}
if (numAnnouncements > 0) {
LOGI(TAG, "Updating announcements data");
// Clear out existing announcements
batch.add(ContentProviderOperation
.newDelete(ScheduleContract.addCallerIsSyncAdapterParameter(
Announcements.CONTENT_URI))
.build());
for (Announcement announcement : response.announcements) {
// Save tracks as a json array
final String tracks =
(announcement.tracks != null && announcement.tracks.length > 0)
? new Gson().toJson(announcement.tracks)
: null;
// Insert announcement info
batch.add(ContentProviderOperation
.newInsert(ScheduleContract
.addCallerIsSyncAdapterParameter(Announcements.CONTENT_URI))
.withValue(SyncColumns.UPDATED, System.currentTimeMillis())
// TODO: better announcements ID heuristic
.withValue(Announcements.ANNOUNCEMENT_ID,
(announcement.date + announcement.title).hashCode())
.withValue(Announcements.ANNOUNCEMENT_DATE, announcement.date)
.withValue(Announcements.ANNOUNCEMENT_TITLE, announcement.title)
.withValue(Announcements.ANNOUNCEMENT_SUMMARY, announcement.summary)
.withValue(Announcements.ANNOUNCEMENT_URL, announcement.link)
.withValue(Announcements.ANNOUNCEMENT_TRACKS, tracks)
.build());
}
}
return batch;
}
示例6: fetchAndParse
import com.google.android.apps.iosched.provider.ScheduleContract.SyncColumns; //导入依赖的package包/类
public ArrayList<ContentProviderOperation> fetchAndParse() throws IOException {
final ArrayList<ContentProviderOperation> batch = Lists.newArrayList();
// Set up the HTTP transport and JSON factory
HttpTransport httpTransport = new NetHttpTransport();
JsonFactory jsonFactory = new AndroidJsonFactory();
// Set up the main Google+ class
Plus plus = new Plus.Builder(httpTransport, jsonFactory, null)
.setApplicationName(NetUtils.getUserAgent(mContext))
.setGoogleClientRequestInitializer(
new CommonGoogleClientRequestInitializer(Config.API_KEY))
.build();
ActivityFeed activities;
try {
activities = plus.activities().list(Config.ANNOUNCEMENTS_PLUS_ID, "public")
.setMaxResults(100l)
.execute();
if (activities == null || activities.getItems() == null) {
throw new IOException("Activities list was null.");
}
} catch (IOException e) {
LOGE(TAG, "Error fetching announcements", e);
return batch;
}
LOGI(TAG, "Updating announcements data");
// Clear out existing announcements
batch.add(ContentProviderOperation
.newDelete(ScheduleContract.addCallerIsSyncAdapterParameter(
Announcements.CONTENT_URI))
.build());
StringBuilder sb = new StringBuilder();
for (Activity activity : activities.getItems()) {
// Filter out anything not including the conference hashtag.
sb.setLength(0);
appendIfNotEmpty(sb, activity.getAnnotation());
if (activity.getObject() != null) {
appendIfNotEmpty(sb, activity.getObject().getContent());
}
if (!sb.toString().contains(UIUtils.CONFERENCE_HASHTAG)) {
continue;
}
// Insert announcement info
batch.add(ContentProviderOperation
.newInsert(ScheduleContract
.addCallerIsSyncAdapterParameter(Announcements.CONTENT_URI))
.withValue(SyncColumns.UPDATED, System.currentTimeMillis())
.withValue(Announcements.ANNOUNCEMENT_ID, activity.getId())
.withValue(Announcements.ANNOUNCEMENT_DATE, activity.getUpdated().getValue())
.withValue(Announcements.ANNOUNCEMENT_TITLE, activity.getTitle())
.withValue(Announcements.ANNOUNCEMENT_ACTIVITY_JSON, activity.toPrettyString())
.withValue(Announcements.ANNOUNCEMENT_URL, activity.getUrl())
.build());
}
return batch;
}