Search in sources :

Example 1 with Video

use of com.abewy.android.apps.klyph.core.fql.Video in project Klyph by jonathangerbaud.

the class VideoAdapter method mergeViewWithData.

@Override
protected void mergeViewWithData(View view, GraphObject data) {
    VideoHolder holder = (VideoHolder) view.getTag();
    //holder.getPhoto().setImageDrawable(null);
    Video video = (Video) data;
    Collections.sort(video.getFormat(), new Comparator<Format>() {

        @Override
        public int compare(Format lhs, Format rhs) {
            if (lhs.getWidth() > rhs.getWidth())
                return 1;
            else if (lhs.getWidth() < rhs.getWidth())
                return -1;
            return 0;
        }
    });
    Format selectedFormat = video.getFormat().get(0);
    for (Format format : video.getFormat()) {
        if (format.getWidth() > columnWidth) {
            selectedFormat = format;
            break;
        }
    }
    if (placeHolder == -1)
        placeHolder = AttrUtil.getResourceId(getContext(holder.getName()), R.attr.squarePlaceHolderIcon);
    loadImage(holder.getPhoto(), selectedFormat.getPicture(), placeHolder, data);
    if (video.getTitle().length() == 0) {
        holder.getName().setVisibility(View.GONE);
    } else {
        holder.getName().setText(video.getTitle());
        holder.getName().setVisibility(View.VISIBLE);
    }
}
Also used : VideoHolder(com.abewy.android.apps.klyph.adapter.holder.VideoHolder) Format(com.abewy.android.apps.klyph.core.fql.Video.Format) Video(com.abewy.android.apps.klyph.core.fql.Video)

Example 2 with Video

use of com.abewy.android.apps.klyph.core.fql.Video in project Klyph by jonathangerbaud.

the class VideoDeserializer method deserializeObject.

@Override
public GraphObject deserializeObject(JSONObject data) {
    Video video = new Video();
    deserializePrimitives(video, data);
    video.setFormat(new FormatDeserializer().deserializeArray(getJsonArray(data, "format"), Format.class));
    return video;
}
Also used : Format(com.abewy.android.apps.klyph.core.fql.Video.Format) Video(com.abewy.android.apps.klyph.core.fql.Video)

Example 3 with Video

use of com.abewy.android.apps.klyph.core.fql.Video in project Klyph by jonathangerbaud.

the class AlbumVideos method populate.

@Override
protected void populate(List<GraphObject> data) {
    super.populate(data);
    if (data.size() > 0 && requestHasMoreData()) {
        setNoMoreData(false);
        Video lastPhoto = (Video) data.get(data.size() - 1);
        setOffset(lastPhoto.getCreated_time());
    } else {
        setNoMoreData(true);
    }
    Log.d("AlbumVideos", "empty view " + getGridView().getEmptyView());
}
Also used : Video(com.abewy.android.apps.klyph.core.fql.Video)

Example 4 with Video

use of com.abewy.android.apps.klyph.core.fql.Video in project Klyph by jonathangerbaud.

the class AlbumVideos method downloadAlbum.

private void downloadAlbum(List<GraphObject> videos) {
    int n = videos.size();
    for (int i = 0; i < n; i++) {
        Video video = (Video) videos.get(i);
        String url = video.getSrc_hq();
        if (url != null) {
            boolean notifOnComplete = i == n - 1;
            KlyphDownloadManager.downloadPhoto(KlyphApplication.getInstance(), url, video.getVid(), video.getDescription(), true, notifOnComplete);
        }
    }
}
Also used : Video(com.abewy.android.apps.klyph.core.fql.Video)

Example 5 with Video

use of com.abewy.android.apps.klyph.core.fql.Video in project Klyph by jonathangerbaud.

the class PostShare method onVideoRequestSuccess.

private void onVideoRequestSuccess(List<GraphObject> result) {
    if (result.size() > 0) {
        Video video = (Video) result.get(0);
        fillViews(video.getAlbum_name(), video.getOwner_name(), video.getThumbnail_link());
    } else {
        displayError("Video list size = 0");
    }
}
Also used : Video(com.abewy.android.apps.klyph.core.fql.Video)

Aggregations

Video (com.abewy.android.apps.klyph.core.fql.Video)9 Intent (android.content.Intent)2 Attachment (com.abewy.android.apps.klyph.core.fql.Attachment)2 Link (com.abewy.android.apps.klyph.core.fql.Link)2 Photo (com.abewy.android.apps.klyph.core.fql.Photo)2 Format (com.abewy.android.apps.klyph.core.fql.Video.Format)2 ActivityNotFoundException (android.content.ActivityNotFoundException)1 VideoHolder (com.abewy.android.apps.klyph.adapter.holder.VideoHolder)1 Media (com.abewy.android.apps.klyph.core.fql.Media)1 JSONException (org.json.JSONException)1 JSONObject (org.json.JSONObject)1