Search in sources :

Example 1 with AdapterView

use of it.sephiroth.android.library.widget.AdapterView in project Klyph by jonathangerbaud.

the class StreamAlbum method mergeData.

public void mergeData(StreamHolder holder, Stream stream) {
    Attachment attachment = stream.getAttachment();
    final List<Media> medias = attachment.getMedia();
    int n = medias.size();
    final ArrayList<String> imageIds = new ArrayList<String>();
    for (int i = 0; i < n; i++) {
        String pid = medias.get(i).getPhoto().getPid();
        if (pid != null && pid.length() > 0) {
            imageIds.add(pid);
        }
    }
    PhotoAdapter adapter = new PhotoAdapter(medias, maxHeight);
    holder.getStreamAlbum().setAdapter(adapter);
    holder.getStreamAlbum().setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> list, View view, int position, long arg3) {
            Intent intent = new Intent(view.getContext(), AlbumActivity.class);
            intent.putExtra(KlyphBundleExtras.PHOTO_ID, medias.get(position).getPhoto().getPid());
            intent.putStringArrayListExtra(KlyphBundleExtras.PHOTO_LIST_ID, imageIds);
            view.getContext().startActivity(intent);
        }
    });
    holder.getStreamAlbum().setVisibility(View.VISIBLE);
}
Also used : AlbumActivity(com.abewy.android.apps.klyph.app.AlbumActivity) Media(com.abewy.android.apps.klyph.core.fql.Media) ArrayList(java.util.ArrayList) Attachment(com.abewy.android.apps.klyph.core.fql.Attachment) Intent(android.content.Intent) AdapterView(it.sephiroth.android.library.widget.AdapterView) View(android.view.View) RatioImageView(com.abewy.android.extended.widget.RatioImageView) AdapterView(it.sephiroth.android.library.widget.AdapterView)

Aggregations

Intent (android.content.Intent)1 View (android.view.View)1 AlbumActivity (com.abewy.android.apps.klyph.app.AlbumActivity)1 Attachment (com.abewy.android.apps.klyph.core.fql.Attachment)1 Media (com.abewy.android.apps.klyph.core.fql.Media)1 RatioImageView (com.abewy.android.extended.widget.RatioImageView)1 AdapterView (it.sephiroth.android.library.widget.AdapterView)1 ArrayList (java.util.ArrayList)1