Search in sources :

Example 1 with TimeLine

use of com.rideread.rideread.bean.TimeLine 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 TimeLine

use of com.rideread.rideread.bean.TimeLine in project ride-read-android by Ride-Read.

the class AttentionFragment method initData.

private void initData() {
    lists = new ArrayList<TimeLine>();
    List<Integer> imgsL = new ArrayList<Integer>();
    for (int i = 0; i < imgs.length; i++) {
        imgsL.add(imgs[i]);
    }
    lists.add(new TimeLine("涨小明", "56", "10km", true, false, false, imgsL, "广州", "", "6分钟前", null, "10"));
    lists.add(new TimeLine("涨小明", "56", "10km", false, true, true, null, "广州", "", "6分钟前", "今天风景很美,我先去看看", "10"));
    lists.add(new TimeLine("涨小明", "56", "10km", true, true, false, imgsL, "广州", "", "6分钟前", "哈哈,我到这里了,过来看看", "10"));
    lists.add(new TimeLine("涨小明", "56", "10km", false, true, true, null, "广州", "", "6分钟前", "不知道说什么,随便写写", "10"));
    lists.add(new TimeLine("涨小明", "56", "10km", false, true, false, null, "广州", "", "6分钟前", "今天风景很美,我先去看看", "10"));
    lists.add(new TimeLine("涨小明", "56", "10km", true, true, false, imgsL, "广州", "", "6分钟前", "哈哈,我到这里了,过来看看", "10"));
}
Also used : TimeLine(com.rideread.rideread.bean.TimeLine) ArrayList(java.util.ArrayList)

Example 3 with TimeLine

use of com.rideread.rideread.bean.TimeLine in project ride-read-android by Ride-Read.

the class AttentionFragment method initView.

private void initView(View mView) {
    listview = (ListView) mView.findViewById(R.id.timeline_attention_listview);
    View v = LayoutInflater.from(getActivity().getApplicationContext()).inflate(R.layout.timeline_newmsg_headview, null);
    listview.addHeaderView(v);
    AttentionListAdapter adapter = new AttentionListAdapter(lists, R.layout.timeline_attention_listitem, getContext());
    listview.setAdapter(adapter);
    listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (position == 0) {
                Toast.makeText(getContext(), "点击了消息提示", Toast.LENGTH_SHORT).show();
            } else {
                Intent intent = new Intent(AttentionFragment.this.getActivity(), TimelineDetailsActivity.class);
                intent.putExtra("timeline", (TimeLine) parent.getAdapter().getItem(position));
                startActivity(intent);
            }
        }
    });
}
Also used : AttentionListAdapter(com.rideread.rideread.adapter.AttentionListAdapter) TimeLine(com.rideread.rideread.bean.TimeLine) AdapterView(android.widget.AdapterView) Intent(android.content.Intent) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) TimelineDetailsActivity(com.rideread.rideread.activity.TimelineDetailsActivity)

Aggregations

TimeLine (com.rideread.rideread.bean.TimeLine)3 Intent (android.content.Intent)2 View (android.view.View)2 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 NineGridImageView (com.jaeger.ninegridimageview.NineGridImageView)1 SelfTimelineActivity (com.rideread.rideread.activity.SelfTimelineActivity)1 TimelineDetailsActivity (com.rideread.rideread.activity.TimelineDetailsActivity)1 AttentionListAdapter (com.rideread.rideread.adapter.AttentionListAdapter)1 VideoTextureView (com.rideread.rideread.widget.VideoTextureView)1 ArrayList (java.util.ArrayList)1