Search in sources :

Example 1 with NineGridImageView

use of com.jaeger.ninegridimageview.NineGridImageView in project ride-read-android by Ride-Read.

the class AttentionListAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final TimeLine timeline = (TimeLine) getItem(position);
    ViewHolder viewHolder = null;
    if (convertView == null) {
        viewHolder = new ViewHolder();
        convertView = inflate.inflate(resId, null);
        viewHolder.text = (TextView) convertView.findViewById(R.id.timeline_text);
        viewHolder.gridView = (NineGridImageView) convertView.findViewById(R.id.timeline_imgs);
        viewHolder.videoTextureView = (VideoTextureView) convertView.findViewById(R.id.timeline_videotextureview);
        viewHolder.iv_play = (ImageView) convertView.findViewById(R.id.iv_play);
        viewHolder.author = (TextView) convertView.findViewById(R.id.timeline_nickname);
        viewHolder.commentnum = (TextView) convertView.findViewById(R.id.timeline_comment_num);
        viewHolder.zannum = (TextView) convertView.findViewById(R.id.timeline_like_num);
        viewHolder.diasance = (TextView) convertView.findViewById(R.id.timeline_distance);
        viewHolder.location = (TextView) convertView.findViewById(R.id.timeline_destinnation);
        viewHolder.pushTime = (TextView) convertView.findViewById(R.id.timeline_time);
        viewHolder.timeline_head = (ImageView) convertView.findViewById(R.id.timeline_head);
        convertView.setTag(viewHolder);
    } else {
        viewHolder = (ViewHolder) convertView.getTag();
    }
    viewHolder.timeline_head.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(context, SelfTimelineActivity.class);
            intent.putExtra("userName", timeline.getAuthor());
            context.startActivity(intent);
        }
    });
    if (timeline.isHasText()) {
        viewHolder.text.setText(timeline.getText());
        viewHolder.text.setVisibility(View.VISIBLE);
    } else {
        viewHolder.text.setVisibility(View.GONE);
    }
    if (timeline.isHasImg()) {
        viewHolder.gridView.setAdapter(adapter);
        viewHolder.gridView.setImagesData(timeline.getImgs());
        viewHolder.gridView.setVisibility(View.VISIBLE);
    } else {
        viewHolder.gridView.setVisibility(View.GONE);
    }
    if (timeline.isHasVideo()) {
        Log.e("lllllll", "hhh");
        viewHolder.videoTextureView.setVisibility(View.VISIBLE);
        viewHolder.iv_play.setVisibility(View.VISIBLE);
        viewHolder.videoTextureView.setIvTip(viewHolder.iv_play);
        setOnClickListener(viewHolder);
    } else {
        viewHolder.videoTextureView.setVisibility(View.GONE);
        viewHolder.iv_play.setVisibility(View.GONE);
    }
    viewHolder.author.setText(timeline.getAuthor());
    viewHolder.pushTime.setText(timeline.getPushTime());
    viewHolder.commentnum.setText(timeline.getCommentnum());
    viewHolder.zannum.setText(timeline.getZanNum());
    viewHolder.diasance.setText("距离我" + timeline.getDistance());
    viewHolder.location.setText(timeline.getLocation());
    return convertView;
}
Also used : TimeLine(com.rideread.rideread.bean.TimeLine) SelfTimelineActivity(com.rideread.rideread.activity.SelfTimelineActivity) Intent(android.content.Intent) ImageView(android.widget.ImageView) NineGridImageView(com.jaeger.ninegridimageview.NineGridImageView) TextView(android.widget.TextView) VideoTextureView(com.rideread.rideread.widget.VideoTextureView) View(android.view.View)

Example 2 with NineGridImageView

use of com.jaeger.ninegridimageview.NineGridImageView in project ride-read-android by Ride-Read.

the class CommentListFragment method initView.

private void initView() {
    List<Comment> comments = new ArrayList<Comment>();
    comments.add(new Comment("12:29", "拍的真好", "", "陈晓村"));
    comments.add(new Comment("11:20", "世界那么大,我想去看看", "", "镇一间"));
    comments.add(new Comment("10:29", "我也想去", "", "黄花话"));
    List<String> face_urls = new ArrayList<String>();
    for (int i = 88; i > 0; i--) {
        face_urls.add("" + i);
    }
    ListView listView = (ListView) mView.findViewById(R.id.timeline_detail_commentlist);
    View v = LayoutInflater.from(getActivity().getApplicationContext()).inflate(R.layout.timeline_detail_headerview, null);
    LikeLinearLayout linearLayout = (LikeLinearLayout) v.findViewById(R.id.likes_linearlayout);
    for (int i = 0; i < face_urls.size(); i++) {
        if (linearLayout.canAddView()) {
            CircleImageView circleImageView = new CircleImageView(getContext());
            circleImageView.setImageResource(R.mipmap.me);
            circleImageView.setPadding(0, 0, 8, 0);
            linearLayout.addView(circleImageView);
        }
        if (!linearLayout.canAddView()) {
            break;
        }
    }
    TextView like_nums = (TextView) v.findViewById(R.id.like_nums);
    like_nums.setText(face_urls.size() + "");
    TextView text = (TextView) v.findViewById(R.id.timeline_text);
    NineGridImageView gridView = (NineGridImageView) v.findViewById(R.id.timeline_imgs);
    //final VideoTextureView videoTextureView=(VideoTextureView)v.findViewById(R.id.timeline_videotextureview);
    //ImageView iv_play=(ImageView)v.findViewById(R.id.iv_play);
    TextView author = (TextView) v.findViewById(R.id.timeline_nickname);
    TextView pushTime = (TextView) v.findViewById(R.id.timeline_time);
    ImageView timeline_head = (ImageView) v.findViewById(R.id.timeline_head);
    listView.addHeaderView(v);
    if (timeline.isHasText() == true) {
        text.setText(timeline.getText());
        text.setVisibility(View.VISIBLE);
    } else {
        text.setVisibility(View.GONE);
    }
    NineGridImageViewAdapter<String> adapter = new NineGridImageViewAdapter<String>() {

        @Override
        protected void onDisplayImage(Context context, ImageView imageView, String imageurl) {
            Glide.with(CommentListFragment.this).load(imageurl).fitCenter().into(imageView);
        }

        @Override
        protected void onItemImageClick(Context context, ImageView imageView, int index, List<String> list) {
            Intent intent = new Intent(getActivity(), ImageShowActivity.class);
            ArrayList<String> arrayList = new ArrayList<String>();
            arrayList.addAll(list);
            intent.putStringArrayListExtra("imgurls", arrayList);
            intent.putExtra("index", index);
            startActivity(intent);
        }
    };
    //这里模拟传入图片链接列表
    List<String> images = new ArrayList<String>();
    images.add("http://img4.duitang.com/uploads/item/201407/27/20140727091026_GmVRQ.jpeg");
    images.add("http://img.anzow.com/picture/2015719/2015071916305142.jpg");
    images.add("http://image.tianjimedia.com/uploadImages/2012/244/RXDM27FT4601.jpg");
    images.add("http://img1.gamedog.cn/2013/07/30/44-130I00ZU50-50.jpg");
    images.add("http://www.33lc.com/article/UploadPic/2012-9/20129417163151547.jpg");
    images.add("http://bizhi.cnanzhi.com/upload/bizhi/2014/1210/14181737602209.jpg");
    images.add("http://image.tianjimedia.com/uploadImages/2012/244/P53844A81OPA.jpg");
    images.add("http://img02.tooopen.com/images/20150527/tooopen_sy_126598151923.jpg");
    images.add("http://k.zol-img.com.cn/sjbbs/7161/a7160286_s.jpg");
    if (timeline.isHasImg() == true) {
        gridView.setAdapter(adapter);
        gridView.setImagesData(images);
        gridView.setVisibility(View.VISIBLE);
    } else {
        gridView.setVisibility(View.GONE);
    }
    author.setText(timeline.getAuthor());
    pushTime.setText(timeline.getPushTime());
    timeline_head.setImageResource(R.mipmap.me);
    listView.setAdapter(new CommentListAdapter(comments, getContext(), R.layout.timline_detail_comment_listitem));
    listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            if (deleteDialogFragment == null) {
                deleteDialogFragment = new DeleteDialogFragment();
            }
            deleteDialogFragment.show(CommentListFragment.this.getActivity().getSupportFragmentManager(), "deleteDialogFragment");
            return true;
        }
    });
}
Also used : ArrayList(java.util.ArrayList) CommentListAdapter(com.rideread.rideread.adapter.CommentListAdapter) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) ListView(android.widget.ListView) NineGridImageViewAdapter(com.jaeger.ninegridimageview.NineGridImageViewAdapter) TextView(android.widget.TextView) ArrayList(java.util.ArrayList) List(java.util.List) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) NineGridImageView(com.jaeger.ninegridimageview.NineGridImageView) DeleteDialogFragment(com.rideread.rideread.widget.DeleteDialogFragment) Context(android.content.Context) Comment(com.rideread.rideread.bean.Comment) NineGridImageView(com.jaeger.ninegridimageview.NineGridImageView) LikeLinearLayout(com.rideread.rideread.widget.LikeLinearLayout) Intent(android.content.Intent) GridView(android.widget.GridView) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) NineGridImageView(com.jaeger.ninegridimageview.NineGridImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) AdapterView(android.widget.AdapterView)

Aggregations

Intent (android.content.Intent)2 View (android.view.View)2 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 NineGridImageView (com.jaeger.ninegridimageview.NineGridImageView)2 Context (android.content.Context)1 AdapterView (android.widget.AdapterView)1 GridView (android.widget.GridView)1 ListView (android.widget.ListView)1 NineGridImageViewAdapter (com.jaeger.ninegridimageview.NineGridImageViewAdapter)1 SelfTimelineActivity (com.rideread.rideread.activity.SelfTimelineActivity)1 CommentListAdapter (com.rideread.rideread.adapter.CommentListAdapter)1 Comment (com.rideread.rideread.bean.Comment)1 TimeLine (com.rideread.rideread.bean.TimeLine)1 DeleteDialogFragment (com.rideread.rideread.widget.DeleteDialogFragment)1 LikeLinearLayout (com.rideread.rideread.widget.LikeLinearLayout)1 VideoTextureView (com.rideread.rideread.widget.VideoTextureView)1 CircleImageView (de.hdodenhof.circleimageview.CircleImageView)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1