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


Java Video类代码示例

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


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

示例1: process

import com.google.samples.apps.iosched.io.model.Video; //导入依赖的package包/类
@Override
public void process(JsonElement element) {
    for (Video video : new Gson().fromJson(element, Video[].class)) {
        if (TextUtils.isEmpty(video.id)) {
            LOGW(TAG, "Video without valid ID. Using VID instead: " + video.vid);
            video.id = video.vid;
        }
        mVideos.put(video.id, video);
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:11,代码来源:VideosHandler.java

示例2: process

import com.google.samples.apps.iosched.io.model.Video; //导入依赖的package包/类
@Override
public void process(@NonNull Gson gson, @NonNull JsonElement element) {
    for (Video video : gson.fromJson(element, Video[].class)) {
        if (TextUtils.isEmpty(video.id)) {
            LOGW(TAG, "Video without valid ID. Using VID instead: " + video.vid);
            video.id = video.vid;
        }
        mVideos.put(video.id, video);
    }
}
 
开发者ID:google,项目名称:iosched,代码行数:11,代码来源:VideosHandler.java

示例3: makeContentProviderOperations

import com.google.samples.apps.iosched.io.model.Video; //导入依赖的package包/类
@Override
public void makeContentProviderOperations(ArrayList<ContentProviderOperation> list) {
    Uri uri = ScheduleContractHelper.setUriAsCalledFromSyncAdapter(
            ScheduleContract.Videos.CONTENT_URI);
    HashMap<String, String> videoHashcodes = loadVideoHashcodes();
    HashSet<String> videosToKeep = new HashSet<String>();
    boolean isIncrementalUpdate = videoHashcodes != null && videoHashcodes.size() > 0;

    if (isIncrementalUpdate) {
        LOGD(TAG, "Doing incremental update for videos.");
    } else {
        LOGD(TAG, "Doing FULL (non incremental) update for videos.");
        list.add(ContentProviderOperation.newDelete(uri).build());
    }

    int updatedVideos = 0;
    for (Video video : mVideos.values()) {
        String hashCode = video.getImportHashcode();
        videosToKeep.add(video.id);

        // add video, if necessary
        if (!isIncrementalUpdate || !videoHashcodes.containsKey(video.id) ||
                !videoHashcodes.get(video.id).equals(hashCode)) {
            ++updatedVideos;
            boolean isNew = !isIncrementalUpdate || !videoHashcodes.containsKey(video.id);
            buildVideo(isNew, video, list);
        }
    }

    int deletedVideos = 0;
    if (isIncrementalUpdate) {
        for (String videoId : videoHashcodes.keySet()) {
            if (!videosToKeep.contains(videoId)) {
                buildDeleteOperation(videoId, list);
                ++deletedVideos;
            }
        }
    }

    LOGD(TAG, "Videos: " + (isIncrementalUpdate ? "INCREMENTAL" : "FULL") + " update. " +
            updatedVideos + " to update, " + deletedVideos + " to delete. New total: " +
            mVideos.size());
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:44,代码来源:VideosHandler.java

示例4: buildVideo

import com.google.samples.apps.iosched.io.model.Video; //导入依赖的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());
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:43,代码来源:VideosHandler.java

示例5: makeContentProviderOperations

import com.google.samples.apps.iosched.io.model.Video; //导入依赖的package包/类
@Override
public void makeContentProviderOperations(ArrayList<ContentProviderOperation> list) {
    Uri uri = ScheduleContract.addCallerIsSyncAdapterParameter(
            ScheduleContract.Videos.CONTENT_URI);
    HashMap<String, String> videoHashcodes = loadVideoHashcodes();
    HashSet<String> videosToKeep = new HashSet<String>();
    boolean isIncrementalUpdate = videoHashcodes != null && videoHashcodes.size() > 0;

    if (isIncrementalUpdate) {
        LOGD(TAG, "Doing incremental update for videos.");
    } else {
        LOGD(TAG, "Doing FULL (non incremental) update for videos.");
        list.add(ContentProviderOperation.newDelete(uri).build());
    }

    int updatedVideos = 0;
    for (Video video : mVideos.values()) {
        String hashCode = video.getImportHashcode();
        videosToKeep.add(video.id);

        // add video, if necessary
        if (!isIncrementalUpdate || !videoHashcodes.containsKey(video.id) ||
                !videoHashcodes.get(video.id).equals(hashCode)) {
            ++updatedVideos;
            boolean isNew = !isIncrementalUpdate || !videoHashcodes.containsKey(video.id);
            buildVideo(isNew, video, list);
        }
    }

    int deletedVideos = 0;
    if (isIncrementalUpdate) {
        for (String videoId : videoHashcodes.keySet()) {
            if (!videosToKeep.contains(videoId)) {
                buildDeleteOperation(videoId, list);
                ++deletedVideos;
            }
        }
    }

    LOGD(TAG, "Videos: " + (isIncrementalUpdate ? "INCREMENTAL" : "FULL") + " update. " +
            updatedVideos + " to update, " + deletedVideos + " to delete. New total: " +
            mVideos.size());
}
 
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:44,代码来源:VideosHandler.java

示例6: buildVideo

import com.google.samples.apps.iosched.io.model.Video; //导入依赖的package包/类
private void buildVideo(boolean isInsert, Video video,
                          ArrayList<ContentProviderOperation> list) {
    Uri allVideosUri = ScheduleContract.addCallerIsSyncAdapterParameter(
            ScheduleContract.Videos.CONTENT_URI);
    Uri thisVideoUri = ScheduleContract.addCallerIsSyncAdapterParameter(
            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());
}
 
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:43,代码来源:VideosHandler.java

示例7: makeContentProviderOperations

import com.google.samples.apps.iosched.io.model.Video; //导入依赖的package包/类
@Override
public void makeContentProviderOperations(ArrayList<ContentProviderOperation> list) {
    Uri uri = ScheduleContractHelper.setUriAsCalledFromSyncAdapter(
            ScheduleContract.Videos.CONTENT_URI);
    HashMap<String, String> videoHashcodes = loadVideoHashcodes();
    HashSet<String> videosToKeep = new HashSet<>();
    boolean isIncrementalUpdate = videoHashcodes != null && videoHashcodes.size() > 0;

    if (isIncrementalUpdate) {
        LOGD(TAG, "Doing incremental update for videos.");
    } else {
        LOGD(TAG, "Doing FULL (non incremental) update for videos.");
        list.add(ContentProviderOperation.newDelete(uri).build());
    }

    int updatedVideos = 0;
    for (Video video : mVideos.values()) {
        String hashCode = video.getImportHashcode();
        videosToKeep.add(video.id);

        // add video, if necessary
        if (!isIncrementalUpdate || !videoHashcodes.containsKey(video.id) ||
                !videoHashcodes.get(video.id).equals(hashCode)) {
            ++updatedVideos;
            boolean isNew = !isIncrementalUpdate || !videoHashcodes.containsKey(video.id);
            buildVideo(isNew, video, list);
        }
    }

    int deletedVideos = 0;
    if (isIncrementalUpdate) {
        for (String videoId : videoHashcodes.keySet()) {
            if (!videosToKeep.contains(videoId)) {
                buildDeleteOperation(videoId, list);
                ++deletedVideos;
            }
        }
    }

    LOGD(TAG, "Videos: " + (isIncrementalUpdate ? "INCREMENTAL" : "FULL") + " update. " +
            updatedVideos + " to update, " + deletedVideos + " to delete. New total: " +
            mVideos.size());
}
 
开发者ID:google,项目名称:iosched,代码行数:44,代码来源:VideosHandler.java


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