当前位置: 首页>>代码示例>>Java>>正文


Java Announcements类代码示例

本文整理汇总了Java中com.google.android.apps.iosched.provider.ScheduleContract.Announcements的典型用法代码示例。如果您正苦于以下问题:Java Announcements类的具体用法?Java Announcements怎么用?Java Announcements使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Announcements类属于com.google.android.apps.iosched.provider.ScheduleContract包,在下文中一共展示了Announcements类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onLoadFinished

import com.google.android.apps.iosched.provider.ScheduleContract.Announcements; //导入依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    if (getActivity() == null) {
        return;
    }
    if (data != null && data.getCount() > 0) {
        mTitleCol = data.getColumnIndex(Announcements.ANNOUNCEMENT_TITLE);
        mDateCol = data.getColumnIndex(Announcements.ANNOUNCEMENT_DATE);
        mUrlCol = data.getColumnIndex(Announcements.ANNOUNCEMENT_URL);
        showAnnouncements(data);
    } else {
        showNoAnnouncements();
    }
}
 
开发者ID:amardeshbd,项目名称:google-iosched,代码行数:15,代码来源:WhatsOnFragment.java

示例2: setupDuring

import com.google.android.apps.iosched.provider.ScheduleContract.Announcements; //导入依赖的package包/类
private void setupDuring() {
    // Start background query to load announcements
    getLoaderManager().initLoader(ANNOUNCEMENTS_LOADER_ID, null, this);
    getActivity().getContentResolver().registerContentObserver(
            Announcements.CONTENT_URI, true, mObserver);
}
 
开发者ID:amardeshbd,项目名称:google-iosched,代码行数:7,代码来源:WhatsOnFragment.java

示例3: onCreateLoader

import com.google.android.apps.iosched.provider.ScheduleContract.Announcements; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    return new CursorLoader(getActivity(),
            Announcements.CONTENT_URI, null, null, null,
            Announcements.ANNOUNCEMENT_DATE + " DESC");
}
 
开发者ID:amardeshbd,项目名称:google-iosched,代码行数:7,代码来源:WhatsOnFragment.java

示例4: getType

import com.google.android.apps.iosched.provider.ScheduleContract.Announcements; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public String getType(Uri uri) {
    final int match = sUriMatcher.match(uri);
    switch (match) {
        case BLOCKS:
            return Blocks.CONTENT_TYPE;
        case BLOCKS_BETWEEN:
            return Blocks.CONTENT_TYPE;
        case BLOCKS_ID:
            return Blocks.CONTENT_ITEM_TYPE;
        case BLOCKS_ID_SESSIONS:
            return Sessions.CONTENT_TYPE;
        case BLOCKS_ID_SESSIONS_STARRED:
            return Sessions.CONTENT_TYPE;
        case TRACKS:
            return Tracks.CONTENT_TYPE;
        case TRACKS_ID:
            return Tracks.CONTENT_ITEM_TYPE;
        case TRACKS_ID_SESSIONS:
            return Sessions.CONTENT_TYPE;
        case TRACKS_ID_VENDORS:
            return Vendors.CONTENT_TYPE;
        case ROOMS:
            return Rooms.CONTENT_TYPE;
        case ROOMS_ID:
            return Rooms.CONTENT_ITEM_TYPE;
        case ROOMS_ID_SESSIONS:
            return Sessions.CONTENT_TYPE;
        case SESSIONS:
            return Sessions.CONTENT_TYPE;
        case SESSIONS_STARRED:
            return Sessions.CONTENT_TYPE;
        case SESSIONS_WITH_TRACK:
            return Sessions.CONTENT_TYPE;
        case SESSIONS_SEARCH:
            return Sessions.CONTENT_TYPE;
        case SESSIONS_AT:
            return Sessions.CONTENT_TYPE;
        case SESSIONS_ID:
            return Sessions.CONTENT_ITEM_TYPE;
        case SESSIONS_ID_SPEAKERS:
            return Speakers.CONTENT_TYPE;
        case SESSIONS_ID_TRACKS:
            return Tracks.CONTENT_TYPE;
        case SESSIONS_ID_WITH_TRACK:
            return Sessions.CONTENT_TYPE;
        case SPEAKERS:
            return Speakers.CONTENT_TYPE;
        case SPEAKERS_ID:
            return Speakers.CONTENT_ITEM_TYPE;
        case SPEAKERS_ID_SESSIONS:
            return Sessions.CONTENT_TYPE;
        case VENDORS:
            return Vendors.CONTENT_TYPE;
        case VENDORS_STARRED:
            return Vendors.CONTENT_TYPE;
        case VENDORS_SEARCH:
            return Vendors.CONTENT_TYPE;
        case VENDORS_ID:
            return Vendors.CONTENT_ITEM_TYPE;
        case ANNOUNCEMENTS:
            return Announcements.CONTENT_TYPE;
        case ANNOUNCEMENTS_ID:
            return Announcements.CONTENT_ITEM_TYPE;
        default:
            throw new UnsupportedOperationException("Unknown uri: " + uri);
    }
}
 
开发者ID:amardeshbd,项目名称:google-iosched,代码行数:70,代码来源:ScheduleProvider.java

示例5: insert

import com.google.android.apps.iosched.provider.ScheduleContract.Announcements; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public Uri insert(Uri uri, ContentValues values) {
    LOGV(TAG, "insert(uri=" + uri + ", values=" + values.toString() + ")");
    final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
    final int match = sUriMatcher.match(uri);
    boolean syncToNetwork = !ScheduleContract.hasCallerIsSyncAdapterParameter(uri);
    switch (match) {
        case BLOCKS: {
            db.insertOrThrow(Tables.BLOCKS, null, values);
            getContext().getContentResolver().notifyChange(uri, null, syncToNetwork);
            return Blocks.buildBlockUri(values.getAsString(Blocks.BLOCK_ID));
        }
        case TRACKS: {
            db.insertOrThrow(Tables.TRACKS, null, values);
            getContext().getContentResolver().notifyChange(uri, null, syncToNetwork);
            return Tracks.buildTrackUri(values.getAsString(Tracks.TRACK_ID));
        }
        case ROOMS: {
            db.insertOrThrow(Tables.ROOMS, null, values);
            getContext().getContentResolver().notifyChange(uri, null, syncToNetwork);
            return Rooms.buildRoomUri(values.getAsString(Rooms.ROOM_ID));
        }
        case SESSIONS: {
            db.insertOrThrow(Tables.SESSIONS, null, values);
            getContext().getContentResolver().notifyChange(uri, null, syncToNetwork);
            return Sessions.buildSessionUri(values.getAsString(Sessions.SESSION_ID));
        }
        case SESSIONS_ID_SPEAKERS: {
            db.insertOrThrow(Tables.SESSIONS_SPEAKERS, null, values);
            getContext().getContentResolver().notifyChange(uri, null, syncToNetwork);
            return Speakers.buildSpeakerUri(values.getAsString(SessionsSpeakers.SPEAKER_ID));
        }
        case SESSIONS_ID_TRACKS: {
            db.insertOrThrow(Tables.SESSIONS_TRACKS, null, values);
            getContext().getContentResolver().notifyChange(uri, null, syncToNetwork);
            return Tracks.buildTrackUri(values.getAsString(SessionsTracks.TRACK_ID));
        }
        case SPEAKERS: {
            db.insertOrThrow(Tables.SPEAKERS, null, values);
            getContext().getContentResolver().notifyChange(uri, null, syncToNetwork);
            return Speakers.buildSpeakerUri(values.getAsString(Speakers.SPEAKER_ID));
        }
        case VENDORS: {
            db.insertOrThrow(Tables.VENDORS, null, values);
            getContext().getContentResolver().notifyChange(uri, null, syncToNetwork);
            return Vendors.buildVendorUri(values.getAsString(Vendors.VENDOR_ID));
        }
        case ANNOUNCEMENTS: {
            db.insertOrThrow(Tables.ANNOUNCEMENTS, null, values);
            getContext().getContentResolver().notifyChange(uri, null, syncToNetwork);
            return Announcements.buildAnnouncementUri(values
                    .getAsString(Announcements.ANNOUNCEMENT_ID));
        }
        case SEARCH_SUGGEST: {
            db.insertOrThrow(Tables.SEARCH_SUGGEST, null, values);
            getContext().getContentResolver().notifyChange(uri, null, syncToNetwork);
            return SearchSuggest.CONTENT_URI;
        }
        default: {
            throw new UnsupportedOperationException("Unknown uri: " + uri);
        }
    }
}
 
开发者ID:amardeshbd,项目名称:google-iosched,代码行数:65,代码来源:ScheduleProvider.java

示例6: parse

import com.google.android.apps.iosched.provider.ScheduleContract.Announcements; //导入依赖的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;
}
 
开发者ID:amardeshbd,项目名称:google-iosched,代码行数:46,代码来源:AnnouncementsHandler.java

示例7: onCreateLoader

import com.google.android.apps.iosched.provider.ScheduleContract.Announcements; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    return new CursorLoader(getActivity(),
            Announcements.CONTENT_URI, AnnouncementsQuery.PROJECTION, null, null,
            Announcements.DEFAULT_SORT);
}
 
开发者ID:TheDeltaProgram,项目名称:iosched2013,代码行数:7,代码来源:WhatsOnFragment.java

示例8: insert

import com.google.android.apps.iosched.provider.ScheduleContract.Announcements; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public Uri insert(Uri uri, ContentValues values) {
    LOGV(TAG, "insert(uri=" + uri + ", values=" + values.toString() + ")");
    final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
    final int match = sUriMatcher.match(uri);
    boolean syncToNetwork = !ScheduleContract.hasCallerIsSyncAdapterParameter(uri);
    switch (match) {
        case BLOCKS: {
            db.insertOrThrow(Tables.BLOCKS, null, values);
            notifyChange(uri, syncToNetwork);
            return Blocks.buildBlockUri(values.getAsString(Blocks.BLOCK_ID));
        }
        case TRACKS: {
            db.insertOrThrow(Tables.TRACKS, null, values);
            notifyChange(uri, syncToNetwork);
            return Tracks.buildTrackUri(values.getAsString(Tracks.TRACK_ID));
        }
        case ROOMS: {
            db.insertOrThrow(Tables.ROOMS, null, values);
            notifyChange(uri, syncToNetwork);
            return Rooms.buildRoomUri(values.getAsString(Rooms.ROOM_ID));
        }
        case SESSIONS: {
            db.insertOrThrow(Tables.SESSIONS, null, values);
            notifyChange(uri, syncToNetwork);
            return Sessions.buildSessionUri(values.getAsString(Sessions.SESSION_ID));
        }
        case SESSIONS_ID_SPEAKERS: {
            db.insertOrThrow(Tables.SESSIONS_SPEAKERS, null, values);
            notifyChange(uri, syncToNetwork);
            return Speakers.buildSpeakerUri(values.getAsString(SessionsSpeakers.SPEAKER_ID));
        }
        case SESSIONS_ID_TRACKS: {
            db.insertOrThrow(Tables.SESSIONS_TRACKS, null, values);
            notifyChange(uri, syncToNetwork);
            return Tracks.buildTrackUri(values.getAsString(SessionsTracks.TRACK_ID));
        }
        case SPEAKERS: {
            db.insertOrThrow(Tables.SPEAKERS, null, values);
            notifyChange(uri, syncToNetwork);
            return Speakers.buildSpeakerUri(values.getAsString(Speakers.SPEAKER_ID));
        }
        case SANDBOX: {
            db.insertOrThrow(Tables.SANDBOX, null, values);
            notifyChange(uri, syncToNetwork);
            return Sandbox.buildCompanyUri(values.getAsString(Sandbox.COMPANY_ID));
        }
        case ANNOUNCEMENTS: {
            db.insertOrThrow(Tables.ANNOUNCEMENTS, null, values);
            notifyChange(uri, syncToNetwork);
            return Announcements.buildAnnouncementUri(values
                    .getAsString(Announcements.ANNOUNCEMENT_ID));
        }
        case SEARCH_SUGGEST: {
            db.insertOrThrow(Tables.SEARCH_SUGGEST, null, values);
            notifyChange(uri, syncToNetwork);
            return SearchSuggest.CONTENT_URI;
        }
        case MAPMARKERS: {
            db.insertOrThrow(Tables.MAPMARKERS, null, values);
            notifyChange(uri, syncToNetwork);
            return MapMarkers.buildMarkerUri(values.getAsString(MapMarkers.MARKER_ID));
        }
        case MAPTILES: {
            db.insertOrThrow(Tables.MAPTILES, null, values);
            notifyChange(uri, syncToNetwork);
            return MapTiles.buildFloorUri(values.getAsString(MapTiles.TILE_FLOOR));
        }
        case FEEDBACK_FOR_SESSION: {
            db.insertOrThrow(Tables.FEEDBACK, null, values);
            notifyChange(uri, syncToNetwork);
            return Feedback.buildFeedbackUri(values.getAsString(Feedback.SESSION_ID));
        }
        default: {
            throw new UnsupportedOperationException("Unknown uri: " + uri);
        }
    }
}
 
开发者ID:TheDeltaProgram,项目名称:iosched2013,代码行数:80,代码来源:ScheduleProvider.java

示例9: fetchAndParse

import com.google.android.apps.iosched.provider.ScheduleContract.Announcements; //导入依赖的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;
}
 
开发者ID:TheDeltaProgram,项目名称:iosched2013,代码行数:65,代码来源:AnnouncementsFetcher.java


注:本文中的com.google.android.apps.iosched.provider.ScheduleContract.Announcements类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。