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);
}
}
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;
}
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());
}
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);
}
}
}
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");
}
}
Aggregations