Search in sources :

Example 6 with CircleItem

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;
}
Also used : User(com.yiw.circledemo.bean.User) CircleItem(com.yiw.circledemo.bean.CircleItem) ArrayList(java.util.ArrayList)

Example 7 with CircleItem

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;
        }
    }
}
Also used : CommentItem(com.yiw.circledemo.bean.CommentItem) CircleItem(com.yiw.circledemo.bean.CircleItem) SuppressLint(android.annotation.SuppressLint)

Example 8 with CircleItem

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);
    }
}
Also used : CircleItem(com.yiw.circledemo.bean.CircleItem)

Example 9 with CircleItem

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;
        }
    }
}
Also used : CircleItem(com.yiw.circledemo.bean.CircleItem) FavortItem(com.yiw.circledemo.bean.FavortItem) SuppressLint(android.annotation.SuppressLint)

Aggregations

CircleItem (com.yiw.circledemo.bean.CircleItem)9 SuppressLint (android.annotation.SuppressLint)3 CommentItem (com.yiw.circledemo.bean.CommentItem)2 FavortItem (com.yiw.circledemo.bean.FavortItem)2 ArrayList (java.util.ArrayList)2 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ImagePagerActivity (com.yiw.circledemo.activity.ImagePagerActivity)1 CircleViewHolder (com.yiw.circledemo.adapter.viewholder.CircleViewHolder)1 ImageViewHolder (com.yiw.circledemo.adapter.viewholder.ImageViewHolder)1 URLViewHolder (com.yiw.circledemo.adapter.viewholder.URLViewHolder)1 VideoViewHolder (com.yiw.circledemo.adapter.viewholder.VideoViewHolder)1 CommentConfig (com.yiw.circledemo.bean.CommentConfig)1 PhotoInfo (com.yiw.circledemo.bean.PhotoInfo)1 User (com.yiw.circledemo.bean.User)1 GlideCircleTransform (com.yiw.circledemo.utils.GlideCircleTransform)1 CircleVideoView (com.yiw.circledemo.widgets.CircleVideoView)1 CommentListView (com.yiw.circledemo.widgets.CommentListView)1 ExpandTextView (com.yiw.circledemo.widgets.ExpandTextView)1 MultiImageView (com.yiw.circledemo.widgets.MultiImageView)1