Android Open Source - PicPosterComplete Pic Poster Model List






From Project

Back to project page PicPosterComplete.

License

The source code is released under:

Apache License

If you think the Android project PicPosterComplete listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package ca.ualberta.cs.picposter.model;
/*from  w w w. j  av  a 2  s .  c  o  m*/
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;

import android.graphics.Bitmap;
import android.widget.ArrayAdapter;
import ca.ualberta.cs.picposter.network.ElasticSearchOperations;

/**
 * Represents a list of all Pic Posts.
 * @author zjullion
 */
public class PicPosterModelList {


  private List<PicPostModel> list;
  private ArrayAdapter<PicPostModel> adapter;


  public PicPosterModelList() {
    this.list = new ArrayList<PicPostModel>();
  }


  public void addPicPost(Bitmap pic, String text, Date timestamp) {
    PicPostModel picPost = new PicPostModel(pic, text, timestamp);
    this.list.add(picPost);
    this.adapter.notifyDataSetChanged();

    ElasticSearchOperations.pushPicPostModel(picPost);
  }
  
  
  public void addPicPostCollection(Collection<PicPostModel> posts) {
    this.list.addAll(posts);
    this.adapter.notifyDataSetChanged();
  }


  public void clear() {
    this.list.clear();
    this.adapter.notifyDataSetChanged();
  }


  public List<PicPostModel> getList() {
    return Collections.unmodifiableList(this.list);
  }


  public void setAdapter(ArrayAdapter<PicPostModel> adapter) {
    this.adapter = adapter;
  }
}




Java Source Code List

ca.ualberta.cs.picposter.PicPosterActivity.java
ca.ualberta.cs.picposter.controller.PicPosterController.java
ca.ualberta.cs.picposter.model.PicPostModel.java
ca.ualberta.cs.picposter.model.PicPosterModelList.java
ca.ualberta.cs.picposter.network.BitmapJsonConverter.java
ca.ualberta.cs.picposter.network.ElasticSearchOperations.java
ca.ualberta.cs.picposter.network.ElasticSearchResponse.java
ca.ualberta.cs.picposter.network.ElasticSearchSearchResponse.java
ca.ualberta.cs.picposter.network.Hits.java
ca.ualberta.cs.picposter.view.PicPostModelAdapter.java