/** * 合辑Adapter * <p/> * Created by Administrator on 2016/6/27. */public class HomeHeJiAdapter extends BaseAdapter { private Context context; private List<HomeHeJi> lt; private ImageLoader imageLoader; private FastCallBack fastCallBack; public static HashMap<Integer, View> holderMap = new HashMap<Integer, View>(); //add gandy public HomeHeJiAdapter(Context context, List<HomeHeJi> lt, ImageLoader imageLoader, FastCallBack back) { this.context = context; this.lt = lt; this.imageLoader = imageLoader; fastCallBack = back; } @Override public int getCount() { return lt.size(); } @Override public Object getItem(int position) { return lt.get(position); } @Override public long getItemId(int position) { return position; } public static class ViewHolder { TextView describe; TextView tv_replenish; TextView tv_like_num; TextView tv_award_num; TextView tv_comment_num; TextView tv_time; TextView tv_name; CircleNetworkImage iv_head; LinearLayout ll_share; LinearLayout ll_comments; LinearLayout ll_award; //打赏 LinearLayout ll_like; //赞 NetworkImageView iv_content; //视频图片 ImageView iv_play; //播放按钮 RelativeLayout app_video_box; ImageView iv_attention; //是否关注 ImageView iv_grade; //等级 ImageView iv_like; } @Override public View getView(final int position, View view, ViewGroup parent) { LayoutInflater layout = LayoutInflater.from(context); ViewHolder holderTemp; final ViewHolder holder; if (holderMap.size() == 0 || !holderMap.containsKey(position)) { holderTemp = new ViewHolder(); view = layout.inflate(R.layout.heji_list, null); holderTemp.describe = (TextView) view.findViewById(R.id.describe); holderTemp.tv_like_num = (TextView) view.findViewById(R.id.tv_like_num); holderTemp.tv_award_num = (TextView) view.findViewById(R.id.tv_award_num); holderTemp.tv_comment_num = (TextView) view.findViewById(R.id.tv_comment_num); holderTemp.tv_time = (TextView) view.findViewById(R.id.tv_time); holderTemp.tv_name = (TextView) view.findViewById(R.id.tv_name); holderTemp.iv_head = (CircleNetworkImage) view.findViewById(R.id.iv_head); holderTemp.iv_content = (NetworkImageView) view.findViewById(R.id.iv_content); holderTemp.ll_share = (LinearLayout) view.findViewById(R.id.ll_share); holderTemp.ll_comments = (LinearLayout) view.findViewById(R.id.ll_comments); holderTemp.ll_award = (LinearLayout) view.findViewById(R.id.ll_award); holderTemp.tv_replenish = (TextView) view.findViewById(R.id.tv_replenish); holderTemp.iv_play = (ImageView) view.findViewById(R.id.iv_play); holderTemp.app_video_box = (RelativeLayout) view.findViewById(R.id.app_video_box); holderTemp.iv_attention = (ImageView) view.findViewById(R.id.iv_attention); holderTemp.iv_grade = (ImageView) view.findViewById(R.id.iv_grade); holderTemp.ll_like = (LinearLayout) view.findViewById(R.id.ll_like); holderTemp.iv_like = (ImageView) view.findViewById(R.id.iv_like); holder = holderTemp; view.setTag(holder); holderMap.put(position, view); } else { View view1 =holderMap.get(position); holder = (ViewHolder) view1.getTag(); } holder.describe.setText(lt.get(position).getVideoDescription()); //说明 holder.tv_like_num.setText(lt.get(position).getLikeCount()); //点赞数 holder.tv_name.setText(lt.get(position).getNickname());//姓名 holder.tv_award_num.setText(lt.get(position).getRewardCount()); //打赏数 holder.tv_comment_num.setText(lt.get(position).getCommentCount()); //评论数 holder.tv_time.setText(lt.get(position).getVideoTime()); //时间View callBackView = viewholder..setOnClickListener(View.OnClickListener() {
(View v) { ..setVisibility(View.)..setVisibility(View.).callback(.get().getVideoURL())LogUtils.(+ + + .toString())}
}) return view; }}
- 2 回答
- 0 关注
- 1846 浏览
添加回答
举报
0/150
提交
取消