use of com.abewy.android.apps.klyph.adapter.holder.VideoHolder 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);
}
}
Aggregations