use of com.yiw.circledemo.bean.CircleItem in project CircleDemo by Naoki2015.
the class DatasUtil method createCircleDatas.
public static List<CircleItem> createCircleDatas() {
List<CircleItem> circleDatas = new ArrayList<CircleItem>();
for (int i = 0; i < 15; i++) {
CircleItem item = new CircleItem();
User user = getUser();
item.setId(String.valueOf(circleId++));
item.setUser(user);
item.setContent(getContent());
item.setCreateTime("12月24日");
item.setFavorters(createFavortItemList());
item.setComments(createCommentItemList());
int type = getRandomNum(10) % 2;
if (type == 0) {
// 链接
item.setType("1");
item.setLinkImg("http://pics.sc.chinaz.com/Files/pic/icons128/2264/%E8%85%BE%E8%AE%AFQQ%E5%9B%BE%E6%A0%87%E4%B8%8B%E8%BD%BD1.png");
item.setLinkTitle("百度一下,你就知道");
} else if (type == 1) {
// 图片
item.setType("2");
item.setPhotos(createPhotos());
} else {
// 视频
item.setType("3");
String videoUrl = "http://yiwcicledemo.s.qupai.me/v/80c81c19-7c02-4dee-baca-c97d9bbd6607.mp4";
String videoImgUrl = "http://yiwcicledemo.s.qupai.me/v/80c81c19-7c02-4dee-baca-c97d9bbd6607.jpg";
item.setVideoUrl(videoUrl);
item.setVideoImgUrl(videoImgUrl);
}
circleDatas.add(item);
}
return circleDatas;
}
use of com.yiw.circledemo.bean.CircleItem in project CircleDemo by Naoki2015.
the class MainActivity method update2DeleteComment.
@Override
public void update2DeleteComment(int circlePosition, String commentId) {
CircleItem item = (CircleItem) circleAdapter.getDatas().get(circlePosition);
List<CommentItem> items = item.getComments();
for (int i = 0; i < items.size(); i++) {
if (commentId.equals(items.get(i).getId())) {
items.remove(i);
circleAdapter.notifyDataSetChanged();
//circleAdapter.notifyItemChanged(circlePosition+1);
return;
}
}
}
use of com.yiw.circledemo.bean.CircleItem in project CircleDemo by Naoki2015.
the class MainActivity method update2AddFavorite.
@Override
public void update2AddFavorite(int circlePosition, FavortItem addItem) {
if (addItem != null) {
CircleItem item = (CircleItem) circleAdapter.getDatas().get(circlePosition);
item.getFavorters().add(addItem);
circleAdapter.notifyDataSetChanged();
//circleAdapter.notifyItemChanged(circlePosition+1);
}
}
use of com.yiw.circledemo.bean.CircleItem in project CircleDemo by Naoki2015.
the class MainActivity method update2DeleteFavort.
@Override
public void update2DeleteFavort(int circlePosition, String favortId) {
CircleItem item = (CircleItem) circleAdapter.getDatas().get(circlePosition);
List<FavortItem> items = item.getFavorters();
for (int i = 0; i < items.size(); i++) {
if (favortId.equals(items.get(i).getId())) {
items.remove(i);
circleAdapter.notifyDataSetChanged();
//circleAdapter.notifyItemChanged(circlePosition+1);
return;
}
}
}
Aggregations