订单详情的适配器
来源:互联网 发布:python 函数传递对象 编辑:程序博客网 时间:2024/06/07 03:49
Context context; List<DDanBean.DataBean> list;Handler handler;public MyLvAdapter(Context context, List<DDanBean.DataBean> list, Handler handler) { this.context=context; this.list=list; this.handler=handler;}@Overridepublic int getCount() { return list.size();}@Overridepublic Object getItem(int i) { return list.get(i);}@Overridepublic long getItemId(int i) { return i;}@Overridepublic View getView(final int i, View view, ViewGroup viewGroup) { final Myhole myhole; if (view==null) { myhole=new Myhole(); view = View.inflate(context, R.layout.child_lv_item, null); myhole.jg=view.findViewById(R.id.jg); myhole.title=view.findViewById(R.id.title); myhole.sj=view.findViewById(R.id.sj); myhole.zt=view.findViewById(R.id.zt); myhole.btn=view.findViewById(R.id.btn); view.setTag(myhole); } else{ myhole= (Myhole) view.getTag(); } myhole.title.setText(list.get(i).getTitle()); myhole.jg.setText("价格:"+list.get(i).getPrice()+""); myhole.sj.setText("创建时间:"+list.get(i).getCreatetime()); if (list.get(i).getStatus()==0) { myhole.zt.setText("待支付"); myhole.btn.setText("取消订单"); } else if (list.get(i).getStatus()==1) { myhole.zt.setText("已支付"); myhole.btn.setText("查看订单"); } else if (list.get(i).getStatus()==2) { myhole.zt.setText("已取消"); myhole.btn.setText("查看订单"); } myhole.btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if ("取消订单".equals(myhole.btn.getText())) { AlertDialog.Builder builder = new AlertDialog.Builder(context); // builder.setIcon(R.mipmap.ic_launcher);//设置图标 builder.setTitle("提示");//设置标题 builder.setMessage("确定取消订单吗?"); //设置详细内容 builder.setNegativeButton("否", null);//设置取消按钮 null为按钮的点击事件 builder.setPositiveButton("是", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int q) { setxiugai(i); } });//设置确定按钮 null为按钮的点击事件 AlertDialog loadDialog = builder.create(); loadDialog.show();//显示dialog //setxiugai(i); } } }); return view;}private void setxiugai(int i) { Map<String, String> map=new HashMap<String, String>(); map.put("uid","2785"); map.put("status","2"); map.put("orderId",list.get(i).getOrderid()+""); OkHttp3Util.doPost(Api.xgurl, map, new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { if (response.isSuccessful()) { String string = response.body().string(); if (string.indexOf("订单状态修改成功")>=0) { handler.sendEmptyMessage(2); } } } });}class Myhole{ TextView title; TextView sj; TextView jg; TextView zt; Button btn;}//布局<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/zt" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="right" android:layout_marginRight="15dp" android:text="待支付" /></LinearLayout><TextView android:id="@+id/jg" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="价格" android:padding="15dp" android:textColor="#f00" android:gravity="center_vertical" android:maxLines="2" android:minLines="2"/><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"><TextView android:id="@+id/sj" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:text="创建时间:" android:padding="15dp" android:textColor="#f00" android:gravity="center_vertical" android:maxLines="2" android:minLines="2"/> <Button android:id="@+id/btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="取消订单"/></LinearLayout>
阅读全文
0 0
- 订单详情的适配器
- 订单详情的fragment
- 订单详情
- ECSHOP用户中心的订单详情页显示商品缩略图
- 订单商品详情导出EXCEL
- magento 修改订单详情模版
- ionic2中的订单详情页面
- 商品详情,购物车,订单
- YII中使用CActiveDataProvider、CDbCriteria和CGridView实现订单详情的显示
- Magento后台订单详情页,Items Ordered处, 添加跳转到网站前台的产品url
- Magento 后台订单详情页Items Ordered列表处,添加跳转到编辑产品的url
- ecshop 用户中心里的订单详情页显示商品缩略图
- ECSHOP二次开发,在用户中心的订单详情页显示商品缩略图
- iOS实现时间线列表效果(例如订单详情页面的效果)
- 自定义订单frament和适配器
- 购物车和订单详情(yuekaomoni)
- 购物车与订单详情布局
- tp3.2中每笔订单商品详情分页
- localhost:8080/项目名称
- node使用
- Java中的缓冲流
- WannaCay病毒肆虐 美国竟说北韩是幕后真凶 着又是意欲何为
- recyclerview条目点击事件
- 订单详情的适配器
- 基于Dragonboard 410c进行开发的远程遥控机器人(三)
- Gradle 'xxx' project refresh failed
- unity场景烘焙贴图丢失问题
- Sharedprefres
- 数据结构课程设计【家庭财务管理系统】
- CTF线下防御战 — 让你的靶机变成“铜墙铁壁”
- 视觉SLAM技术及其应用(章国锋--复杂环境下的鲁棒SfM与SLAM)
- 超级实用的Android磁盘缓存工具DiskDataCacher用法以及原理