Search in sources :

Example 1 with Photo

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

the class PhotoAlbumAdapter method mergeViewWithData.

@Override
protected void mergeViewWithData(View view, GraphObject data) {
    super.mergeViewWithData(view, data);
    final RatioImageView rImageView = (RatioImageView) view;
    Photo photo = (Photo) data;
    Collections.sort(photo.getImages(), new Comparator<Image>() {

        @Override
        public int compare(Image lhs, Image rhs) {
            if (lhs.getWidth() > rhs.getWidth())
                return 1;
            else if (lhs.getWidth() < rhs.getWidth())
                return -1;
            return 0;
        }
    });
    Image selectedImage = photo.getImages().get(0);
    rImageView.setImageSize(selectedImage.getWidth(), selectedImage.getHeight());
    if (placeHolder == -1)
        placeHolder = AttrUtil.getResourceId(getContext(view), R.attr.squarePlaceHolderIcon);
    loadImage(rImageView, selectedImage.getSrc(), placeHolder, data);
}
Also used : RatioImageView(com.abewy.android.extended.widget.RatioImageView) Photo(com.abewy.android.apps.klyph.core.fql.Media.Photo) Image(com.abewy.android.apps.klyph.core.fql.Media.Image)

Aggregations

Image (com.abewy.android.apps.klyph.core.fql.Media.Image)1 Photo (com.abewy.android.apps.klyph.core.fql.Media.Photo)1 RatioImageView (com.abewy.android.extended.widget.RatioImageView)1