/** 取消收藏 */ public void DelCollectionRequest( String userid, String id, String collectionType, final ImageView isColl, final List<Orderinfoinfo> mDatas, final int position, final int finalI) { DelCollectionRequest request = new DelCollectionRequest( new Response.Listener<DelCollectionResponse>() { @Override public void onResponse(DelCollectionResponse response) { Utils.closeDialog(); if (response != null && response.getStatus() == 0) { // success Utils.makeToastAndShow(context, "取消收藏"); isColl.setBackgroundResource(R.drawable.un_coll); mDatas .get(position) .getOrderItemDTOList() .get(finalI) .getProductComboGroupDTO() .setIsColl("0"); MineOrderObligationPageAdapter.this.notifyDataSetChanged(); } else { // failed Log.e("error", "error"); } } }, (BaseActivity) context); request.setUserid(userid); request.setCollectionId(id); request.setCollectionType(collectionType); Utils.showProgressDialog(context); WebUtils.doPost(request); }
@Override public View getView(final int position, View convertView, ViewGroup parent) { View view = inflater.inflate(R.layout.lv_page_order_obligation, null); TextView tv_left = (TextView) view.findViewById(R.id.tv_left); tv_left.setText(context.getString(R.string.str_mine_order_cancle)); tv_left.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Logger.d(tag, "你单击了" + context.getString(R.string.str_mine_order_cancle)); } }); TextView tv_right = (TextView) view.findViewById(R.id.tv_right); tv_right.setText(context.getString(R.string.str_mine_order_pay)); tv_right.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Logger.d(tag, "你单击了" + context.getString(R.string.str_mine_order_pay)); } }); // 创建时间 TextView tv_createTime = (TextView) view.findViewById(R.id.tv_createTime); tv_createTime.setText(mListData.get(position).getCreateTime()); // 代付款 TextView tv_order_state = (TextView) view.findViewById(R.id.tv_order_state); tv_order_state.setText( Utils.intToOrderString(Integer.parseInt(mListData.get(position).getOrderStatus()))); // 订单内容 LinearLayout LinearLayout ll_content = (LinearLayout) view.findViewById(R.id.ll_content); int datasize = mListData.get(position).getOrderItemDTOList().size(); for (int i = 0; i < datasize; i++) { View ordercontentview = inflater.inflate(R.layout.lv_order_detail_item, null); // 收藏 final ImageView isColl = (ImageView) ordercontentview.findViewById(R.id.isColl); if ("1" .equals( mListData .get(position) .getOrderItemDTOList() .get(i) .getProductComboGroupDTO() .getIsColl())) { // 是否被当前用户收藏,0:未收藏,1:已收藏 isColl.setBackgroundResource(R.drawable.coll); } else { isColl.setBackgroundResource(R.drawable.un_coll); } final int finalI = i; isColl.setTag( R.id.isColl, mListData .get(position) .getOrderItemDTOList() .get(i) .getProductComboGroupDTO() .getIsColl()); Logger.d(tag, "你单击了收藏"); isColl.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { String flag = String.valueOf(v.getTag(R.id.isColl)); if ("1".equals(flag)) { // bu shoucang String userid = YbbApplication.getInstance().getMyUserInfo().getUserId(); String id = mListData .get(position) .getOrderItemDTOList() .get(finalI) .getProductComboGroupDTO() .getId(); DelCollectionRequest( userid, id, CollectionType, isColl, mListData, position, finalI); } else { String userid = YbbApplication.getInstance().getMyUserInfo().getUserId(); String id = mListData .get(position) .getOrderItemDTOList() .get(finalI) .getProductComboGroupDTO() .getId(); CollectionRequest(userid, id, CollectionType, isColl, mListData, position, finalI); } } }); // 图片 ImageView iv_image_bg_item_1 = (ImageView) ordercontentview.findViewById(R.id.iv_image_bg_item_1); // Glide.with(context) // // .load(mListData.get(position).getOrderItemDTOList().get(i).getProductComboGroupDTO().get) // .into(iv_image_bg_item_1); // 紫署庄园 TextView tv_search_item_item_1 = (TextView) ordercontentview.findViewById(R.id.tv_search_item_item_1); tv_search_item_item_1.setText( mListData .get(position) .getOrderItemDTOList() .get(i) .getProductComboGroupDTO() .getComboName()); // 星级评价 RatingBar rb_comment_item_1 = (RatingBar) ordercontentview.findViewById(R.id.rb_comment_item_1); rb_comment_item_1.setRating( Float.parseFloat( mListData .get(position) .getOrderItemDTOList() .get(i) .getProductComboGroupDTO() .getCommentStar())); // 18条评价 TextView commentCount_item_1 = (TextView) ordercontentview.findViewById(R.id.commentCount_item_1); commentCount_item_1.setText( "(" + mListData .get(position) .getOrderItemDTOList() .get(i) .getProductComboGroupDTO() .getCommentCount() + "条评价)"); // 20.00 TextView tv_charge_item_1 = (TextView) ordercontentview.findViewById(R.id.tv_charge_item_1); tv_charge_item_1.setText( "¥" + mListData .get(position) .getOrderItemDTOList() .get(i) .getProductComboGroupDTO() .getCustomer_price()); // X3 TextView tv_num_item_1 = (TextView) ordercontentview.findViewById(R.id.tv_num_item_1); tv_num_item_1.setText( "X" + mListData.get(position).getOrderItemDTOList().get(i).getProductNum()); ll_content.addView(ordercontentview); } return view; }