예제 #1
0
  public void addFeed(
      int num, String name, String content, Bitmap image, Bitmap profilePic, String time) {
    FeedListData addInfo = new FeedListData();
    addInfo.setNum(num);
    addInfo.setName(name);
    addInfo.setContent(content);
    addInfo.setImage(image);
    addInfo.setProfilePic(profilePic);
    addInfo.setTime(time);

    feedListDatas.add(addInfo);
  }
예제 #2
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    if (inflater == null)
      inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    if (convertView == null) convertView = inflater.inflate(R.layout.listview_memoryitem, null);

    TextView name = (TextView) convertView.findViewById(R.id.name);
    TextView content = (TextView) convertView.findViewById(R.id.content);
    TextView time = (TextView) convertView.findViewById(R.id.time);
    ImageView profilePic = (ImageView) convertView.findViewById(R.id.profilePic);
    ImageView feedImageView = (ImageView) convertView.findViewById(R.id.feedImage1);

    FeedListData item = feedListDatas.get(position);

    name.setText(item.getName());
    time.setText(item.getTime());

    // Chcek for empty content message
    if (!TextUtils.isEmpty(item.getContent())) {
      content.setText(item.getContent());
      content.setVisibility(View.VISIBLE);
    } else {
      // status is empty, remove from view
      content.setVisibility(View.GONE);
    }

    // user profile pic
    profilePic.setImageBitmap(item.getProfilePic());
    profilePic.setVisibility(View.VISIBLE);

    // Feed image
    if (item.getImage() != null) {
      feedImageView.setImageBitmap(item.getImage());
      feedImageView.setVisibility(View.VISIBLE);

    } else {
      Log.e(TAG, "F**K!!");
      feedImageView.setVisibility(View.GONE);
    }

    return convertView;
  }