Search in sources :

Example 1 with VideoTextureView

use of com.rideread.rideread.widget.VideoTextureView 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)

Aggregations

Intent (android.content.Intent)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 NineGridImageView (com.jaeger.ninegridimageview.NineGridImageView)1 SelfTimelineActivity (com.rideread.rideread.activity.SelfTimelineActivity)1 TimeLine (com.rideread.rideread.bean.TimeLine)1 VideoTextureView (com.rideread.rideread.widget.VideoTextureView)1