依赖
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' compile 'com.squareup.okhttp3:okhttp:3.9.1' compile 'com.squareup.okio:okio:1.13.0' compile 'com.android.support:recyclerview-v7:26.0.0-alpha1' compile 'com.jcodecraeer:xrecyclerview:1.5.2' compile 'com.xhb:xbanner:1.2.2' testCompile 'junit:junit:4.12' compile 'com.google.code.gson:gson:2.8.2' compile 'com.github.bumptech.glide:glide:3.7.0' compile 'com.android.support:design:26.+' compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.4-7' compile 'com.scwang.smartrefresh:SmartRefreshHeader:1.0.4-7'//没有使用特殊Header,可以不加这行 compile 'com.android.support:appcompat-v7:26.+'//版本随意(必须)
权限
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />android:name=".application.DashApplication" //动画Acitivitypublic class SplashActivity extends AppCompatActivity { int time=5; Handler handler=new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); time--; if(time==0){ //跳转页面 Intent intent=new Intent(SplashActivity.this,GoodsActivity.class); startActivity(intent); finish(); } handler.sendEmptyMessageDelayed(0,1000); } }; private ImageView imageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); imageView = (ImageView) findViewById(R.id.main_image); ObjectAnimator moveIn = ObjectAnimator.ofFloat(imageView, "translationY", -500f, 0f);//从上移动到下 ObjectAnimator rotate = ObjectAnimator.ofFloat(imageView, "rotation", 0f, 360f);//旋转一周 ObjectAnimator fadeInOut = ObjectAnimator.ofFloat(imageView, "alpha", 0f, 1f);//从完全透明到完全不透明 ObjectAnimator scaleX = ObjectAnimator.ofFloat(imageView, "scaleX", 2f, 1f);//从 ObjectAnimator scaleY = ObjectAnimator.ofFloat(imageView, "scaleY", 2f, 1f); AnimatorSet animSet = new AnimatorSet(); animSet.play(rotate).with(fadeInOut).with(moveIn).with(scaleX).with(scaleY); animSet.setDuration(5000); animSet.start(); handler.sendEmptyMessageDelayed(0,1000); } }//购物车Activitypublic class GoodsActivity extends AppCompatActivity { private TextView title2; private TextView price2; private TextView branprice2; private GoodsBean xiangQingBean; private XBanner shangpin; private List<String> imageList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_goods); title2 = (TextView) findViewById(R.id.title2); price2 = (TextView) findViewById(R.id.price2); branprice2 = (TextView) findViewById(R.id.branprice2); shangpin = (XBanner) findViewById(R.id.shangpin); //在字中间画条线 branprice2.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG ); //Lunbo OkHttp3Util.doGet("https://www.zhaoapi.cn/product/getProductDetail?pid=14", new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { if (response.isSuccessful()){ final String string = response.body().string(); Log.d("qqqq",string); CommonUtils.runOnUIThread(new Runnable() { @Override public void run() { Gson gson=new Gson(); GoodsBean goodsBean = gson.fromJson(string, GoodsBean.class); GoodsBean.DataBean list = goodsBean.getData(); imageList = new ArrayList<>(); String images = list.getImages(); String[] split = images.split("\\|"); for(String imgurl:split){ imageList.add(imgurl); } //设置图片 shangpin.setPointsIsVisible(false); shangpin.setmAutoPlayAble(false); shangpin.setmAdapter(new XBanner.XBannerAdapter() { @Override public void loadBanner(XBanner banner, View view, int position) { Glide.with(GoodsActivity.this).load(imageList.get(position)).into((ImageView) view); } }); shangpin.setData(imageList,null); title2.setText(list.getTitle()); price2.setText("打折后¥:"+list.getBargainPrice()); branprice2.setText("原价:¥"+list.getPrice()); branprice2.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG); } }); } } }); } public void gouwuche(View view) { Intent intent=new Intent(GoodsActivity.this,MainActivity.class); startActivity(intent); } public void jiaru(View view) { OkHttp3Util.doGet("https://www.zhaoapi.cn/product/addCart?uid=2845&pid=14&source=android", new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { if (response.isSuccessful()){ CommonUtils.runOnUIThread(new Runnable() { @Override public void run() { Toast.makeText(GoodsActivity.this,"加购成功",Toast.LENGTH_SHORT).show(); Intent intent=new Intent(GoodsActivity.this,MainActivity.class); startActivity(intent); } }); } } }); } }
//购物车创建订单public class MainActivity extends AppCompatActivity implements View.OnClickListener,CartView { private CartExpanableListview expanableListview; private CartPresenter cartPresenter; private CheckBox check_all; private TextView text_total; private TextView text_buy; private CartBean cartBean; private RelativeLayout relative_progress; boolean flag=false; private LinearLayout linear_bottom; private CountPriceBean countPriceBean; private Handler handler = new Handler(){ @Override public void handleMessage(Message msg) { if (msg.what == 0){//更改价钱和数量的消息 countPriceBean = (CountPriceBean) msg.obj; text_total.setText("合计:¥"+ countPriceBean.getPrice()); text_buy.setText("去计算("+ countPriceBean.getCount()+")"); } } }; private MyAdapter myAdapter; private TextView bianji; private LinearLayout linear8; private LinearLayout liner1; private Button btn3del; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); check_all = (CheckBox) findViewById(R.id.check_all); text_total = (TextView) findViewById(R.id.text_total); text_buy = (TextView) findViewById(R.id.text_buy); expanableListview = (CartExpanableListview) findViewById(R.id.expanable_listview); relative_progress = (RelativeLayout) findViewById(R.id.relative_progress); linear_bottom = (LinearLayout) findViewById(R.id.linear_layout); bianji = (TextView) findViewById(R.id.bianji); linear8 = (LinearLayout) findViewById(R.id.linear8); // liner1 = (LinearLayout) findViewById(R.id.linear_layout); btn3del = (Button) findViewById(R.id.but3); //去掉默认的指示器 expanableListview.setGroupIndicator(null); cartPresenter=new CartPresenter(this); //1.点击全选:选中/未选中...调用适配器中的方法...myAdapter.setIsCheckAll(true);来设置所有的一级和二级是否选中,计算 check_all.setOnClickListener(this); text_buy.setOnClickListener(this); bianji.setOnClickListener(this); btn3del.setOnClickListener(this); } @Override protected void onResume() { super.onResume(); relative_progress.setVisibility(View.VISIBLE); //请求数据 cartPresenter.getCartData(ApiUtil.cartUrl); } @Override public void onClick(View view) { switch (view.getId()){ case R.id.check_all: myAdapter.setAllCheck(check_all.isChecked()); break; case R.id.text_buy://去结算...试一下创建订单 final String price = countPriceBean.getPrice(); Map<String, String> params = new HashMap<>(); params.put("uid","2845"); params.put("price", String.valueOf(price)); OkHttp3Util.doPost(ApiUtil.createCartUrl, params, new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { if (response.isSuccessful()){ final String json = response.body().string(); runOnUiThread(new Runnable() { @Override public void run() { // Toast.makeText(MainActivity.this,json,Toast.LENGTH_SHORT).show(); CountPriceBean countPriceBean=new CountPriceBean( price,1); Intent intent = new Intent(MainActivity.this, Main2Activity.class); // intent.putExtra("toux",chachebean.getData().get(0).getList().g) intent.putExtra("order",countPriceBean); startActivity(intent); } }); } } }); break; case R.id.bianji: if (flag){ bianji.setText("编辑"); flag=false; linear8.setVisibility(View.VISIBLE); linear_bottom.setVisibility(View.INVISIBLE); }else { bianji.setText("完成"); flag=true; linear8.setVisibility(View.INVISIBLE); linear_bottom.setVisibility(View.VISIBLE); } break; case R.id.but3: for (int i= 0;i<cartBean.getData().size();i++){ if (cartBean.getData().get(i).isGroupChecked()==true){ for (int j=0;j<cartBean.getData().get(i).getList().size();j++){ if (cartBean.getData().get(i).getList().get(j).getSelected() == 1) { Log.d("ggg",cartBean.getData().get(i).getList().get(j).getPid()+""); OkHttp3Util.doGet("https://www.zhaoapi.cn/product/deleteCart?uid=2845&pid=" + cartBean.getData().get(i).getList().get(j).getPid(), 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(); Log.d("cccc", string); CommonUtils.runOnUIThread(new Runnable() { @Override public void run() { Toast.makeText(MainActivity.this, "删除成功", Toast.LENGTH_SHORT).show(); cartPresenter.getCartData(ApiUtil.cartUrl); } }); } } }); } } } } break; } } @Override public void getSuccessCartJson(CartBean cartBean) { relative_progress.setVisibility(View.GONE); this.cartBean = cartBean; if (cartBean != null){ //显示下面的 //linear_bottom.setVisibility(View.VISIBLE); //初始化数据....根据子条目是否全部选中决定 是否选中组和全选 for (int i= 0;i<cartBean.getData().size();i++){ if (isAllChildInGroupSelected(i)){ cartBean.getData().get(i).setGroupChecked(true); } } //初始化是否全选的数据 changeAllState(isAllGroupChecked()); //设置适配器 myAdapter = new MyAdapter(MainActivity.this, cartBean,handler,relative_progress,cartPresenter); expanableListview.setAdapter(myAdapter); //展开 for (int i= 0;i<cartBean.getData().size();i++){ expanableListview.expandGroup(i); } //初始化价格 myAdapter.sendPriceAndCount(); }else { //隐藏下面的全选.... 等 // linear_bottom.setVisibility(View.GONE); //显示去逛逛,,,添加购物车 Toast.makeText(MainActivity.this,"购物车为空,去逛逛",Toast.LENGTH_SHORT).show(); } } /** * 全选是否选中 * @param allGroupChecked */ private void changeAllState(boolean allGroupChecked) { check_all.setChecked(allGroupChecked); } /** * 是否所有的组选中 * @return */ private boolean isAllGroupChecked() { for (int i =0;i<cartBean.getData().size();i++){ if (! cartBean.getData().get(i).isGroupChecked()){//代表一级列表有没选中的 return false; } } return true; } /** * 一个组中所有的子条目是否选中 * @param groupPosition * @return */ private boolean isAllChildInGroupSelected(int groupPosition) { for (int i= 0;i<cartBean.getData().get(groupPosition).getList().size();i++){ //只要有一个没选中就返回false if (cartBean.getData().get(groupPosition).getList().get(i).getSelected() ==0){ return false; } } return true; } @Override protected void onDestroy() { super.onDestroy(); if (cartPresenter!=null){ cartPresenter.destory(); } } }
//订单Activitypublic class Main2Activity extends AppCompatActivity { private TextView text_order; private TextView text_kuan; private ImageView tu; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); Intent intent=getIntent(); final CountPriceBean countPriceBean= (CountPriceBean) intent.getSerializableExtra("order"); text_kuan = (TextView) findViewById(R.id.text_kuan); text_order = (TextView) findViewById(R.id.text_order); tu = (ImageView) findViewById(R.id.maidongxidetupian); text_kuan.setText("实付款:¥:"+countPriceBean.getPrice()); text_order.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { OkHttp3Util.doGet("https://www.zhaoapi.cn/product/createOrder?uid=2845&price=" + countPriceBean.getPrice(), new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { final String string = response.body().string(); CommonUtils.runOnUIThread(new Runnable() { @Override public void run() { Toast.makeText(Main2Activity.this, string,Toast.LENGTH_SHORT).show(); Intent intent = new Intent(Main2Activity.this, LieBiaoActivity.class); startActivity(intent); } }); } }); } }); } public void huiqu2(View view) { AlertDialog.Builder ab=new AlertDialog.Builder(Main2Activity.this); ab.setTitle("请你再考虑一下,亲!~~~~"); ab.setPositiveButton("去意已决", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { finish(); } }); ab.setNegativeButton("再看看",null); ab.show(); } public void dingdanzhongxin(View view) { Intent intent = new Intent(Main2Activity.this, LieBiaoActivity.class); startActivity(intent); } }
//订单的三层页面public class LieBiaoActivity extends AppCompatActivity implements View.OnClickListener { private ImageView iv; private TabLayout tab; private ViewPager vp; private List<String> list; private View contentView; private PopupWindow popupWindow; private View parent; private TextView tv1; private TextView tv2; private TextView tv3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_lie_biao); iv = (ImageView) findViewById(R.id.iv); tab = (TabLayout) findViewById(R.id.tab); vp = (ViewPager) findViewById(R.id.vp); iv.setOnClickListener(this); contentView = View.inflate(LieBiaoActivity.this, R.layout.pop_layout, null); //父窗体 parent = View.inflate(LieBiaoActivity.this, R.layout.activity_main, null); //通过构造方法创建一个popupWindown popupWindow = new PopupWindow(contentView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); /** * 出现的问题,,,点击周围不消失,,点击返回键直接退出这个activity...里面的editText控件不能输入 */ popupWindow.setTouchable(true);//设置窗体可以触摸,,,默认就是true popupWindow.setFocusable(true);//让窗体获取到焦点...一般情况下窗体里面的控件都能获取到焦点,但是editText特殊 popupWindow.setOutsideTouchable(true);//设置窗体外部可以触摸 // popupWindow.setBackgroundDrawable(new BitmapDrawable());//设置背景 tv1 = contentView.findViewById(R.id.tv1); tv2 = contentView.findViewById(R.id.tv2); tv3 = contentView.findViewById(R.id.tv3); tv1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { vp.setCurrentItem(0); Toast.makeText(LieBiaoActivity.this, "点击了待支付!", Toast.LENGTH_SHORT).show(); popupWindow.dismiss(); } }); tv2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(LieBiaoActivity.this, "点击了已支付!", Toast.LENGTH_SHORT).show(); vp.setCurrentItem(1); popupWindow.dismiss(); } }); tv3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { vp.setCurrentItem(2); Toast.makeText(LieBiaoActivity.this, "点击了已取消!", Toast.LENGTH_SHORT).show(); popupWindow.dismiss(); } }); list = new ArrayList<>(); list.add("待支付"); list.add("已支付"); list.add("已取消"); vp.setOffscreenPageLimit(list.size()); vp.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) { @Override public CharSequence getPageTitle(int position) { return list.get(position); } @Override public int getCount() { return list.size(); } @Override public Fragment getItem(int position) { if (list.get(position) == "待支付") { //得到子条目 因为子条目是Fragment,所以要new一个Fragment FragmentDaiZhifu fragmentDaiZhifu = new FragmentDaiZhifu(); return fragmentDaiZhifu; } else if (list.get(position)== "已支付") { FragmentYiZhiFu fragmentYiZhiFu = new FragmentYiZhiFu(); return fragmentYiZhiFu; } else if (list.get(position) == "已取消") { FragmentYiQuXiao fragmentYiQuXiao = new FragmentYiQuXiao(); return fragmentYiQuXiao; } return null; } }); //将ViewPager关联到TabLayout上 tab.setupWithViewPager(vp); } @Override public void onClick(View view) { popupWindow.showAsDropDown(iv); } } 购物车的M层数据public class CarModel { ICartPresenter iCartPresenter; public CarModel(ICartPresenter iCartPresenter) { this.iCartPresenter = iCartPresenter; } public void getCartData(String carUrl) { //获取数据 OkHttp3Util.doGet(carUrl, new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { if (response.isSuccessful()) { final String json=response.body().string(); CommonUtils.runOnUIThread(new Runnable() { @Override public void run() { Gson gson = new Gson(); CartBean cartBean = gson.fromJson(json,CartBean.class); Log.e("zz", "P层数据 "+json ); iCartPresenter.getSuccessCartJson(cartBean); } }); } } }); } }
购物车P成实体类public class CartPresenter implements ICartPresenter { CartView cartView; CarModel carModel; public CartPresenter(CartView cartView) { this.cartView = cartView; carModel=new CarModel(this); } @Override public void getSuccessCartJson(CartBean cartBean) { cartView.getSuccessCartJson(cartBean); } public void getCartData(String cartUrl) { carModel.getCartData(cartUrl); } public void destory(){ if (cartView!=null){ cartView=null; } } }
购物车的P层接口public interface ICartPresenter { void getSuccessCartJson(CartBean cartBean); }购物车的V层接口public interface CartView { void getSuccessCartJson(CartBean cartBean); }
购物车的适配器public class MyAdapter extends BaseExpandableListAdapter{ private CartPresenter cartPresenter; private RelativeLayout relative_progress; private Handler handler; private CartBean cartBean; private Context context; private int allSize; private int ai; public MyAdapter(Context context, CartBean cartBean, Handler handler, RelativeLayout relative_progress, CartPresenter cartPresenter) { this.context = context; this.cartBean = cartBean; this.handler = handler; this.relative_progress = relative_progress; this.cartPresenter = cartPresenter; } @Override public int getGroupCount() { return cartBean.getData().size(); } @Override public int getChildrenCount(int groupPosition) { return cartBean.getData().get(groupPosition).getList().size(); } @Override public Object getGroup(int groupPosition) { return cartBean.getData().get(groupPosition); } @Override public Object getChild(int groupPosition, int childPosition) { return cartBean.getData().get(groupPosition).getList().get(childPosition); } @Override public long getGroupId(int groupPosition) { return groupPosition; } @Override public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Override public boolean hasStableIds() { return true; } @Override public View getGroupView(int groupPosition, boolean b, View view, ViewGroup viewGroup) { final GroupHolder holder; if (view == null){ view = View.inflate(context, R.layout.group_item_layout,null); holder = new GroupHolder(); holder.check_group = view.findViewById(R.id.check_group); holder.text_group = view.findViewById(R.id.text_group); view.setTag(holder); }else { holder = (GroupHolder) view.getTag(); } final CartBean.DataBean dataBean = cartBean.getData().get(groupPosition); //赋值 holder.check_group.setChecked(dataBean.isGroupChecked()); holder.text_group.setText(dataBean.getSellerName()); //点击事件 holder.check_group.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { relative_progress.setVisibility(View.VISIBLE); size = dataBean.getList().size();//0,1,2 i = 0; //递归 执行.......根据groupPosition updateChildInGroup(dataBean,holder.check_group.isChecked()); } }); return view; } /** * 根据组的状态 更改组中 子条目的状态 * @param dataBean * @param checked */ private int i; private int size; private void updateChildInGroup(final CartBean.DataBean dataBean, final boolean checked) { CartBean.DataBean.ListBean listBean = dataBean.getList().get(i); //?uid=71&sellerid=1&pid=1&selected=0&num=10 Map<String, String> params = new HashMap<>(); params.put("uid","2845"); params.put("sellerid", String.valueOf(listBean.getSellerid())); params.put("pid", String.valueOf(listBean.getPid())); params.put("selected", String.valueOf(checked? 1:0)); params.put("num", String.valueOf(listBean.getNum())); OkHttp3Util.doPost("https://www.zhaoapi.cn/product/updateCarts", params, new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { if (response.isSuccessful()){ i = i+1; if (i<size){ updateChildInGroup(dataBean,checked); }else { cartPresenter.getCartData(ApiUtil.cartUrl); } } } }); } @Override public View getChildView(int groupPosition, int childPosition, boolean b, View view, ViewGroup viewGroup) { ChildHolder holder; if (view == null){ view = View.inflate(context, R.layout.child_item_layout,null); holder = new ChildHolder(); holder.text_add = view.findViewById(R.id.text_add); holder.text_num = view.findViewById(R.id.text_num); holder.text_jian = view.findViewById(R.id.text_jian); holder.text_title = view.findViewById(R.id.text_title); holder.text_price = view.findViewById(R.id.text_price); holder.image_good = view.findViewById(R.id.image_good); holder.check_child = view.findViewById(R.id.check_child); holder.text_delete = view.findViewById(R.id.text_delete); view.setTag(holder); }else { holder = (ChildHolder) view.getTag(); } //赋值 final CartBean.DataBean.ListBean listBean = cartBean.getData().get(groupPosition).getList().get(childPosition); holder.text_num.setText(listBean.getNum()+"");//......注意 holder.text_price.setText("¥"+listBean.getBargainPrice()); holder.text_title.setText(listBean.getTitle()); //listBean.getSelected().....0false,,,1true //设置checkBox选中状态 holder.check_child.setChecked(listBean.getSelected()==0? false:true); /*implementation 'com.github.bumptech.glide:glide:4.4.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'*/ Glide.with(context).load(listBean.getImages().split("\\|")[0]).into(holder.image_good); //点击事件 holder.check_child.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //点击改变网络上状态,,,,再去请求网络数据,,,刷新界面显示 updateCart(listBean,true,false); } }); //加号 holder.text_add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { 网络加一 updateCart(listBean,false,true); } }); //减号 holder.text_jian.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { int num = listBean.getNum(); if (num == 1){ return; } //网络减一 updateCart(listBean,false,false); } }); //删除 holder.text_delete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { deleteCart(listBean); } }); return view; } /** * 删除购物车 * @param listBean */ private void deleteCart(CartBean.DataBean.ListBean listBean) { relative_progress.setVisibility(View.VISIBLE); Map<String, String> params = new HashMap<>(); params.put("uid","2845"); params.put("pid", String.valueOf(listBean.getPid())); OkHttp3Util.doPost(ApiUtil.deleteCartUrl, params, new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { if (response.isSuccessful()){ cartPresenter.getCartData(ApiUtil.cartUrl); } } }); } /** * 更新购物车的方法.....isUpdateCheck true表示更新选中状态,,,false表示更改数量...isAdd表示数量是否增加,false表示数量减少 * @param listBean * @param isUpdateCheck */ private void updateCart(CartBean.DataBean.ListBean listBean, boolean isUpdateCheck, boolean isAdd) { relative_progress.setVisibility(View.VISIBLE); //?uid=71&sellerid=1&pid=1&selected=0&num=10 Map<String, String> params = new HashMap<>(); params.put("uid","2845"); params.put("sellerid", String.valueOf(listBean.getSellerid())); params.put("pid", String.valueOf(listBean.getPid())); params.put("selected", String.valueOf(listBean.getSelected())); params.put("num", String.valueOf(listBean.getNum())); if (isUpdateCheck){ //修改....状态 params.put("selected", String.valueOf(listBean.getSelected() == 1?0:1)); }else { if (isAdd){ params.put("num", String.valueOf(listBean.getNum()+1)); }else { params.put("num", String.valueOf(listBean.getNum()-1)); } } OkHttp3Util.doPost("https://www.zhaoapi.cn/product/updateCarts", params, new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { if (response.isSuccessful()){ //重新请求数据,,,,展示 cartPresenter.getCartData(ApiUtil.cartUrl); } } }); } @Override public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } /** * 计算价格 */ public void sendPriceAndCount() { double price = 0; int count = 0; //通过判断二级列表是否勾选,,,,计算价格数量 for (int i=0;i<cartBean.getData().size();i++){ for (int j = 0;j<cartBean.getData().get(i).getList().size();j++){ if (cartBean.getData().get(i).getList().get(j).getSelected() == 1){ price += cartBean.getData().get(i).getList().get(j).getNum() * cartBean.getData().get(i).getList().get(j).getBargainPrice(); count += cartBean.getData().get(i).getList().get(j).getNum(); } } } //精准的保留double的两位小数 DecimalFormat decimalFormat = new DecimalFormat("#.00"); String priceString = decimalFormat.format(price); CountPriceBean countPriceBean = new CountPriceBean(priceString, count); //传给activity进行显示 Message msg = Message.obtain(); msg.what = 0; msg.obj = countPriceBean; handler.sendMessage(msg); } /** * 根据全选状态 改变网络上所有的子条目 * @param checked */ public void setAllCheck(boolean checked) { //全部装到一个集合 List<CartBean.DataBean.ListBean> listAll = new ArrayList<>(); for (int i=0;i<cartBean.getData().size();i++){ for (int j = 0;j<cartBean.getData().get(i).getList().size();j++){ listAll.add(cartBean.getData().get(i).getList().get(j)); } } //递归 更改每一个子条目 allSize = listAll.size(); ai = 0; updateAllItem(listAll,checked); } /** * 使用递归 更改所有的子条目状态 * @param list * @param checked */ private void updateAllItem(final List<CartBean.DataBean.ListBean> list, final boolean checked) { relative_progress.setVisibility(View.VISIBLE); CartBean.DataBean.ListBean listBean = list.get(ai); //?uid=71&sellerid=1&pid=1&selected=0&num=10 Map<String, String> params = new HashMap<>(); params.put("uid","2845"); params.put("sellerid", String.valueOf(listBean.getSellerid())); params.put("pid", String.valueOf(listBean.getPid())); params.put("selected", String.valueOf(checked ? 1:0)); params.put("num", String.valueOf(listBean.getNum())); OkHttp3Util.doPost("https://www.zhaoapi.cn/product/updateCarts", params, new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { if (response.isSuccessful()){ ai = ai +1; if (ai <allSize){ updateAllItem(list,checked); }else { cartPresenter.getCartData(ApiUtil.cartUrl); } } } }); } private class GroupHolder{ CheckBox check_group; TextView text_group; } private class ChildHolder{ CheckBox check_child; ImageView image_good; TextView text_title; TextView text_price; TextView text_jian; TextView text_num; TextView text_add; TextView text_delete; } } 主线程的调用public class DashApplication extends Application { private static Context context; private static Handler handler; private static int mainId; public static boolean isLoginSuccess;//是否已经登录的状态 @Override public void onCreate() { super.onCreate(); //关于context----http://blog.csdn.net/lmj623565791/article/details/40481055 context = getApplicationContext(); //初始化handler handler = new Handler(); //主线程的id mainId = Process.myTid(); } /** * 对外提供了context * @return */ public static Context getAppContext() { return context; } /** * 得到全局的handler * @return */ public static Handler getAppHanler() { return handler; } /** * 获取主线程id * @return */ public static int getMainThreadId() { return mainId; } }
二级列表public class CartExpanableListview extends ExpandableListView { public CartExpanableListview(Context context) { super(context); } public CartExpanableListview(Context context, AttributeSet attrs) { super(context, attrs); } public CartExpanableListview(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int height = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE>>2,MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, height); } } 线程工具类public class CommonUtils { public static final String TAG = "Dash";//sp文件的xml名称 private static SharedPreferences sharedPreferences; /** * DashApplication.getAppContext()可以使用,但是会使用系统默认的主题样式,如果你自定义了某些样式可能不会被使用 * @param layoutId * @return */ public static View inflate(int layoutId) { View view = View.inflate(DashApplication.getAppContext(), layoutId, null); return view; } /** * dip---px * * @param dip 设备独立像素device independent px....1dp = 3px 1dp = 2px 1dp = 1.5px * @return */ public static int dip2px(int dip) { //获取像素密度 float density = DashApplication.getAppContext().getResources().getDisplayMetrics().density; // int px = (int) (dip * density + 0.5f);//100.6 return px; } /** * px-dip * * @param px * @return */ public static int px2dip(int px) { //获取像素密度 float density = DashApplication.getAppContext().getResources().getDisplayMetrics().density; // int dip = (int) (px / density + 0.5f); return dip; } /** * 获取资源中的字符串 * @param stringId * @return */ public static String getString(int stringId) { return DashApplication.getAppContext().getResources().getString(stringId); } public static Drawable getDrawable(int did) { return DashApplication.getAppContext().getResources().getDrawable(did); } public static int getDimens(int id) { return DashApplication.getAppContext().getResources().getDimensionPixelSize(id); } /** * sp存入字符串类型的值 * @param flag * @param str */ public static void saveSp(String flag, String str) { if (sharedPreferences == null) { sharedPreferences = DashApplication.getAppContext().getSharedPreferences(TAG, DashApplication.getAppContext().MODE_PRIVATE); } SharedPreferences.Editor edit = sharedPreferences.edit(); edit.putString(flag, str); edit.commit(); } public static String getSp(String flag) { if (sharedPreferences == null) { sharedPreferences = DashApplication.getAppContext().getSharedPreferences(TAG, DashApplication.getAppContext().MODE_PRIVATE); } return sharedPreferences.getString(flag, ""); } public static boolean getBoolean(String tag) { if (sharedPreferences == null) { sharedPreferences = DashApplication.getAppContext().getSharedPreferences(TAG, DashApplication.getAppContext().MODE_PRIVATE); } return sharedPreferences.getBoolean(tag, false); } public static void putBoolean(String tag, boolean content) { if (sharedPreferences == null) { sharedPreferences = DashApplication.getAppContext().getSharedPreferences(TAG, DashApplication.getAppContext().MODE_PRIVATE); } SharedPreferences.Editor edit = sharedPreferences.edit(); edit.putBoolean(tag, content); edit.commit(); } /** * 清除sp数据 * @param tag */ public static void clearSp(String tag) { if (sharedPreferences == null) { sharedPreferences = DashApplication.getAppContext().getSharedPreferences(TAG, DashApplication.getAppContext().MODE_PRIVATE); } SharedPreferences.Editor edit = sharedPreferences.edit(); edit.remove(tag); edit.commit(); } /** * 自己写的运行在主线程的方法 * 如果是主线程,执行任务,否则使用handler发送到主线程中去执行 * * * @param runable */ public static void runOnUIThread(Runnable runable) { //先判断当前属于子线程还是主线程 if (android.os.Process.myTid() == DashApplication.getMainThreadId()) { runable.run(); } else { //子线程 DashApplication.getAppHanler().post(runable); } } }
OkHttp二次封装工具类public class OkHttp3Util { /** * 懒汉 安全 加同步 * 私有的静态成员变量 只声明不创建 * 私有的构造方法 * 提供返回实例的静态方法 */ private static OkHttpClient okHttpClient = null; private OkHttp3Util() { } public static OkHttpClient getInstance() { if (okHttpClient == null) { //加同步安全 synchronized (OkHttp3Util.class) { if (okHttpClient == null) { //okhttp可以缓存数据....指定缓存路径 File sdcache = new File(Environment.getExternalStorageDirectory(), "cache"); //指定缓存大小 int cacheSize = 10 * 1024 * 1024; okHttpClient = new OkHttpClient.Builder()//构建器 .connectTimeout(15, TimeUnit.SECONDS)//连接超时 .writeTimeout(20, TimeUnit.SECONDS)//写入超时 .readTimeout(20, TimeUnit.SECONDS)//读取超时 //.addInterceptor(new CommonParamsInterceptor())//添加的是应用拦截器...公共参数 //.addNetworkInterceptor(new CacheInterceptor())//添加的网络拦截器 .cache(new Cache(sdcache.getAbsoluteFile(), cacheSize))//设置缓存 .build(); } } } return okHttpClient; } /** * get请求 * 参数1 url * 参数2 回调Callback */ public static void doGet(String oldUrl, Callback callback) { //要添加的公共参数...map Map<String,String> map = new HashMap<>(); map.put("source","android"); StringBuilder stringBuilder = new StringBuilder();//创建一个stringBuilder stringBuilder.append(oldUrl); if (oldUrl.contains("?")){ //?在最后面....2类型 if (oldUrl.indexOf("?") == oldUrl.length()-1){ }else { //3类型...拼接上& stringBuilder.append("&"); } }else { //不包含? 属于1类型,,,先拼接上?号 stringBuilder.append("?"); } //添加公共参数.... for (Map.Entry<String,String> entry: map.entrySet()) { //拼接 stringBuilder.append(entry.getKey()) .append("=") .append(entry.getValue()) .append("&"); } //删掉最后一个&符号 if (stringBuilder.indexOf("&") != -1){ stringBuilder.deleteCharAt(stringBuilder.lastIndexOf("&")); } String newUrl = stringBuilder.toString();//新的路径 //创建OkHttpClient请求对象 OkHttpClient okHttpClient = getInstance(); //创建Request Request request = new Request.Builder().url(newUrl).build(); //得到Call对象 Call call = okHttpClient.newCall(request); //执行异步请求 call.enqueue(callback); } /** * post请求 * 参数1 url * 参数2 Map<String, String> params post请求的时候给服务器传的数据 * add..("","") * add() */ public static void doPost(String url, Map<String, String> params, Callback callback) { //要添加的公共参数...map Map<String,String> map = new HashMap<>(); map.put("source","android"); //创建OkHttpClient请求对象 OkHttpClient okHttpClient = getInstance(); //3.x版本post请求换成FormBody 封装键值对参数 FormBody.Builder builder = new FormBody.Builder(); //遍历集合 for (String key : params.keySet()) { builder.add(key, params.get(key)); } //添加公共参数 for (Map.Entry<String,String> entry: map.entrySet()) { builder.add(entry.getKey(),entry.getValue()); } //创建Request Request request = new Request.Builder().url(url).post(builder.build()).build(); Call call = okHttpClient.newCall(request); call.enqueue(callback); } /** * post请求上传文件....包括图片....流的形式传任意文件... * 参数1 url * file表示上传的文件 * fileName....文件的名字,,例如aaa.jpg * params ....传递除了file文件 其他的参数放到map集合 * */ public static void uploadFile(String url, File file, String fileName,Map<String,String> params) { //创建OkHttpClient请求对象 OkHttpClient okHttpClient = getInstance(); MultipartBody.Builder builder = new MultipartBody.Builder(); builder.setType(MultipartBody.FORM); //参数 if (params != null){ for (String key : params.keySet()){ builder.addFormDataPart(key,params.get(key)); } } //文件...参数name指的是请求路径中所接受的参数...如果路径接收参数键值是fileeeee,此处应该改变 builder.addFormDataPart("file",fileName,RequestBody.create(MediaType.parse("application/octet-stream"),file)); //构建 MultipartBody multipartBody = builder.build(); //创建Request Request request = new Request.Builder().url(url).post(multipartBody).build(); //得到Call Call call = okHttpClient.newCall(request); //执行请求 call.enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { Log.e("upload",e.getLocalizedMessage()); } @Override public void onResponse(Call call, Response response) throws IOException { //上传成功回调 目前不需要处理 if (response.isSuccessful()){ String s = response.body().string(); Log.e("upload","上传--"+s); } } }); } /** * Post请求发送JSON数据....{"name":"zhangsan","pwd":"123456"} * 参数一:请求Url * 参数二:请求的JSON * 参数三:请求回调 */ public static void doPostJson(String url, String jsonParams, Callback callback) { RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), jsonParams); Request request = new Request.Builder().url(url).post(requestBody).build(); Call call = getInstance().newCall(request); call.enqueue(callback); } /** * 下载文件 以流的形式把apk写入的指定文件 得到file后进行安装 * 参数er:请求Url * 参数san:保存文件的文件夹....download */ public static void download(final Activity context, final String url, final String saveDir) { Request request = new Request.Builder().url(url).build(); Call call = getInstance().newCall(request); call.enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { //com.orhanobut.logger.Logger.e(e.getLocalizedMessage()); } @Override public void onResponse(Call call, final Response response) throws IOException { InputStream is = null; byte[] buf = new byte[2048]; int len = 0; FileOutputStream fos = null; try { is = response.body().byteStream();//以字节流的形式拿回响应实体内容 //apk保存路径 final String fileDir = isExistDir(saveDir); //文件 File file = new File(fileDir, getNameFromUrl(url)); fos = new FileOutputStream(file); while ((len = is.read(buf)) != -1) { fos.write(buf, 0, len); } fos.flush(); context.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, "下载成功:" + fileDir + "," + getNameFromUrl(url), Toast.LENGTH_SHORT).show(); } }); //apk下载完成后 调用系统的安装方法 Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); context.startActivity(intent); } catch (IOException e) { e.printStackTrace(); } finally { if (is != null) is.close(); if (fos != null) fos.close(); } } }); } /** * 判断下载目录是否存在......并返回绝对路径 * * @param saveDir * @return * @throws IOException */ public static String isExistDir(String saveDir) throws IOException { // 下载位置 if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { File downloadFile = new File(Environment.getExternalStorageDirectory(), saveDir); if (!downloadFile.mkdirs()) { downloadFile.createNewFile(); } String savePath = downloadFile.getAbsolutePath(); Log.e("savePath", savePath); return savePath; } return null; } /** * @param url * @return 从下载连接中解析出文件名 */ private static String getNameFromUrl(String url) { return url.substring(url.lastIndexOf("/") + 1); } /** * 公共参数拦截器 */ private static class CommonParamsInterceptor implements Interceptor{ //拦截的方法 @Override public Response intercept(Chain chain) throws IOException { //获取到请求 Request request = chain.request(); //获取请求的方式 String method = request.method(); //获取请求的路径 String oldUrl = request.url().toString(); Log.e("---拦截器",request.url()+"---"+request.method()+"--"+request.header("User-agent")); //要添加的公共参数...map Map<String,String> map = new HashMap<>(); map.put("source","android"); if ("GET".equals(method)){ // 1.http://www.baoidu.com/login --------? key=value&key=value // 2.http://www.baoidu.com/login? --------- key=value&key=value // 3.http://www.baoidu.com/login?mobile=11111 -----&key=value&key=value StringBuilder stringBuilder = new StringBuilder();//创建一个stringBuilder stringBuilder.append(oldUrl); if (oldUrl.contains("?")){ //?在最后面....2类型 if (oldUrl.indexOf("?") == oldUrl.length()-1){ }else { //3类型...拼接上& stringBuilder.append("&"); } }else { //不包含? 属于1类型,,,先拼接上?号 stringBuilder.append("?"); } //添加公共参数.... for (Map.Entry<String,String> entry: map.entrySet()) { //拼接 stringBuilder.append(entry.getKey()) .append("=") .append(entry.getValue()) .append("&"); } //删掉最后一个&符号 if (stringBuilder.indexOf("&") != -1){ stringBuilder.deleteCharAt(stringBuilder.lastIndexOf("&")); } String newUrl = stringBuilder.toString();//新的路径 //拿着新的路径重新构建请求 request = request.newBuilder() .url(newUrl) .build(); }else if ("POST".equals(method)){ //先获取到老的请求的实体内容 RequestBody oldRequestBody = request.body();//....之前的请求参数,,,需要放到新的请求实体内容中去 //如果请求调用的是上面doPost方法 if (oldRequestBody instanceof FormBody){ FormBody oldBody = (FormBody) oldRequestBody; //构建一个新的请求实体内容 FormBody.Builder builder = new FormBody.Builder(); //1.添加老的参数 for (int i=0;i<oldBody.size();i++){ builder.add(oldBody.name(i),oldBody.value(i)); } //2.添加公共参数 for (Map.Entry<String,String> entry:map.entrySet()) { builder.add(entry.getKey(),entry.getValue()); } FormBody newBody = builder.build();//新的请求实体内容 //构建一个新的请求 request = request.newBuilder() .url(oldUrl) .post(newBody) .build(); } } Response response = chain.proceed(request); return response; } } /** * 网络缓存的拦截器......注意在这里更改cache-control头是很危险的,一般客户端不进行更改,,,,服务器端直接指定 * * 没网络取缓存的时候,一般都是在数据库或者sharedPerfernce中取出来的 * * * */ /*private static class CacheInterceptor implements Interceptor{ @Override public Response intercept(Chain chain) throws IOException { //老的响应 Response oldResponse = chain.proceed(chain.request()); *//*if (NetUtils.isNetworkConnected(DashApplication.getAppContext())){ int maxAge = 120; // 在线缓存在2分钟内可读取 return oldResponse.newBuilder() .removeHeader("Pragma") .removeHeader("Cache-Control") .header("Cache-Control", "public, max-age=" + maxAge) .build(); }else { int maxStale = 60 * 60 * 24 * 14; // 离线时缓存保存2周 return oldResponse.newBuilder() .removeHeader("Pragma") .removeHeader("Cache-Control") .header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale) .build(); }*//* } }*/ }
接口调用的总工具类public class ApiUtil { public static final String cartUrl = "https://www.zhaoapi.cn/product/getCarts?uid=2845"; public static final String addCartUrl = "https://www.zhaoapi.cn/product/addCart";//uid,pid public static final String deleteCartUrl = "https://www.zhaoapi.cn/product/deleteCart";//uid,pid //?uid=71&sellerid=1&pid=1&selected=0&num=10 public static final String updateCartUrl = "https://www.zhaoapi.cn/product/updateCarts"; public static final String createCartUrl = "https://www.zhaoapi.cn/product/createOrder"; }解析购物车的数据CarBeanpublic class CartBean { /** * msg : 请求成功 * code : 0 * data : [{"list":[{"bargainPrice":111.99,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":1,"pid":22,"price":799,"pscid":1,"selected":0,"sellerid":15,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家15","sellerid":"15"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":1,"pid":1,"price":118,"pscid":1,"selected":0,"sellerid":17,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家17","sellerid":"17"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":1,"pid":2,"price":299,"pscid":1,"selected":0,"sellerid":18,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家18","sellerid":"18"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":1,"pid":4,"price":999,"pscid":1,"selected":0,"sellerid":20,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家20","sellerid":"20"}] */ private String msg; private String code; private List<DataBean> data; public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public List<DataBean> getData() { return data; } public void setData(List<DataBean> data) { this.data = data; } public static class DataBean { public boolean isGroupChecked() { return isGroupChecked; } public void setGroupChecked(boolean groupChecked) { isGroupChecked = groupChecked; } /** * list : [{"bargainPrice":111.99,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":1,"pid":22,"price":799,"pscid":1,"selected":0,"sellerid":15,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}] * sellerName : 商家15 * sellerid : 15 */ private boolean isGroupChecked;//一级列表是否选中 private String sellerName; private String sellerid; private List<ListBean> list; public String getSellerName() { return sellerName; } public void setSellerName(String sellerName) { this.sellerName = sellerName; } public String getSellerid() { return sellerid; } public void setSellerid(String sellerid) { this.sellerid = sellerid; } public List<ListBean> getList() { return list; } public void setList(List<ListBean> list) { this.list = list; } public static class ListBean { /** * bargainPrice : 111.99 * createtime : 2017-10-14T21:48:08 * detailUrl : https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends * images : https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg * num : 1 * pid : 22 * price : 799.0 * pscid : 1 * selected : 0 * sellerid : 15 * subhead : 每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下 * title : 北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g */ private double bargainPrice; private String createtime; private String detailUrl; private String images; private int num; private int pid; private double price; private int pscid; private int selected;//判断二级是否选中,,,1选中,0未选中 private int sellerid; private String subhead; private String title; public double getBargainPrice() { return bargainPrice; } public void setBargainPrice(double bargainPrice) { this.bargainPrice = bargainPrice; } public String getCreatetime() { return createtime; } public void setCreatetime(String createtime) { this.createtime = createtime; } public String getDetailUrl() { return detailUrl; } public void setDetailUrl(String detailUrl) { this.detailUrl = detailUrl; } public String getImages() { return images; } public void setImages(String images) { this.images = images; } public int getNum() { return num; } public void setNum(int num) { this.num = num; } public int getPid() { return pid; } public void setPid(int pid) { this.pid = pid; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public int getPscid() { return pscid; } public void setPscid(int pscid) { this.pscid = pscid; } public int getSelected() { return selected; } public void setSelected(int selected) { this.selected = selected; } public int getSellerid() { return sellerid; } public void setSellerid(int sellerid) { this.sellerid = sellerid; } public String getSubhead() { return subhead; } public void setSubhead(String subhead) { this.subhead = subhead; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } } } }
解析详情的数据GoodsBeanpublic class GoodsBean { /** * msg : * seller : {"description":"我是商家18","icon":"http://120.27.23.105/images/icon.png","name":"商家18","productNums":999,"score":5,"sellerid":18} * code : 0 * data : {"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","itemtype":1,"pid":2,"price":299,"pscid":1,"salenum":999,"sellerid":18,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"} */ private String msg; private SellerBean seller; private String code; private DataBean data; public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public SellerBean getSeller() { return seller; } public void setSeller(SellerBean seller) { this.seller = seller; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public DataBean getData() { return data; } public void setData(DataBean data) { this.data = data; } public static class SellerBean { /** * description : 我是商家18 * icon : http://120.27.23.105/images/icon.png * name : 商家18 * productNums : 999 * score : 5.0 * sellerid : 18 */ private String description; private String icon; private String name; private int productNums; private double score; private int sellerid; public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getProductNums() { return productNums; } public void setProductNums(int productNums) { this.productNums = productNums; } public double getScore() { return score; } public void setScore(double score) { this.score = score; } public int getSellerid() { return sellerid; } public void setSellerid(int sellerid) { this.sellerid = sellerid; } } public static class DataBean { /** * bargainPrice : 111.99 * createtime : 2017-10-14T21:39:05 * detailUrl : https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends * images : https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg * itemtype : 1 * pid : 2 * price : 299.0 * pscid : 1 * salenum : 999 * sellerid : 18 * subhead : 每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下 * title : 北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g */ private double bargainPrice; private String createtime; private String detailUrl; private String images; private int itemtype; private int pid; private double price; private int pscid; private int salenum; private int sellerid; private String subhead; private String title; public double getBargainPrice() { return bargainPrice; } public void setBargainPrice(double bargainPrice) { this.bargainPrice = bargainPrice; } public String getCreatetime() { return createtime; } public void setCreatetime(String createtime) { this.createtime = createtime; } public String getDetailUrl() { return detailUrl; } public void setDetailUrl(String detailUrl) { this.detailUrl = detailUrl; } public String getImages() { return images; } public void setImages(String images) { this.images = images; } public int getItemtype() { return itemtype; } public void setItemtype(int itemtype) { this.itemtype = itemtype; } public int getPid() { return pid; } public void setPid(int pid) { this.pid = pid; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public int getPscid() { return pscid; } public void setPscid(int pscid) { this.pscid = pscid; } public int getSalenum() { return salenum; } public void setSalenum(int salenum) { this.salenum = salenum; } public int getSellerid() { return sellerid; } public void setSellerid(int sellerid) { this.sellerid = sellerid; } public String getSubhead() { return subhead; } public void setSubhead(String subhead) { this.subhead = subhead; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } } }
总价格CountPriceBeanpublic class CountPriceBean implements Serializable{ private String price; private int count; private List<Integer> integers; public List<Integer> getIntegers() { return integers; } public void setIntegers(List<Integer> integers) { this.integers = integers; } public CountPriceBean(String price, int count, List<Integer> integers) { this.price = price; this.count = count; this.integers = integers; } public CountPriceBean(String price, int count) { this.price = price; this.count = count; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } }
待支付的FragmentDaiZhifupublic class FragmentDaiZhifu extends Fragment implements IDaiZhifu { private RecyclerView rv; private int page=1; Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); if (msg.what == 1) { String a = (String) msg.obj; daiZhiFuAdapter.notifyDataSetChanged(); Toast.makeText(getActivity(), "订单已取消" + a, Toast.LENGTH_SHORT).show(); }else if (msg.what==2){ daiZhiFuAdapter.notifyDataSetChanged(); } } }; private DaiZhiFuPresenter daiZhiFuPresenter; private DingDanLieBiaoBean dingDanLieBiaoBean; private DaiZhiFuAdapter daiZhiFuAdapter; private SmartRefreshLayout refreshLayout; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view=inflater.inflate(R.layout.fragment_dingdan,container,false); rv = view.findViewById(R.id.rv); refreshLayout = view.findViewById(R.id.refreshLayout); return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); daiZhiFuPresenter = new DaiZhiFuPresenter(this); } @Override public void onResume() { super.onResume(); daiZhiFuPresenter.getData("https://www.zhaoapi.cn/product/getOrders",page); refreshLayout.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh(RefreshLayout refreshlayout) { daiZhiFuPresenter.getData("https://www.zhaoapi.cn/product/getOrders",1); refreshlayout.finishRefresh(); } }); refreshLayout.setOnLoadmoreListener(new OnLoadmoreListener() { @Override public void onLoadmore(RefreshLayout refreshlayout) { page++; //加载 daiZhiFuPresenter.getData("https://www.zhaoapi.cn/product/getOrders",page); refreshlayout.finishLoadmore(); } }); } @Override public void getSuccess(final DingDanLieBiaoBean dingDanLieBiaoBean) { this.dingDanLieBiaoBean=dingDanLieBiaoBean; getActivity().runOnUiThread(new Runnable() { @Override public void run() { List<DingDanLieBiaoBean.DataBean> data = dingDanLieBiaoBean.getData(); daiZhiFuAdapter = new DaiZhiFuAdapter(getActivity(),data,handler); rv.setAdapter(daiZhiFuAdapter); rv.setLayoutManager(new LinearLayoutManager(getActivity())); } }); } }
已支付的FragmentYiZhifupublic class FragmentYiZhiFu extends Fragment implements IDaiZhifu { private RecyclerView rv; private int page=1; Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); if (msg.what == 1) { String a = (String) msg.obj; yiZhiFuAdapter.notifyDataSetChanged(); Toast.makeText(getActivity(), "跳转,查看订单" + a, Toast.LENGTH_SHORT).show(); } } }; private DaiZhiFuPresenter daiZhiFuPresenter; private YiZhiFuAdapter yiZhiFuAdapter; private DingDanLieBiaoBean dingDanLieBiaoBean; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view=inflater.inflate(R.layout.fragment_dingdan,container,false); rv = view.findViewById(R.id.rv); return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); daiZhiFuPresenter = new DaiZhiFuPresenter(this); } @Override public void onResume() { super.onResume(); daiZhiFuPresenter.getData("https://www.zhaoapi.cn/product/getOrders",page); } @Override public void getSuccess(final DingDanLieBiaoBean dingDanLieBiaoBean) { this.dingDanLieBiaoBean=dingDanLieBiaoBean; getActivity().runOnUiThread(new Runnable() { @Override public void run() { List<DingDanLieBiaoBean.DataBean> data = dingDanLieBiaoBean.getData(); yiZhiFuAdapter = new YiZhiFuAdapter(getActivity(), data, handler); rv.setAdapter(yiZhiFuAdapter); rv.setLayoutManager(new LinearLayoutManager(getActivity())); } }); } }已取消的FragmentYiQuXiaopublic class FragmentYiQuXiao extends Fragment implements IDaiZhifu { private RecyclerView rv; private int page=1; Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); if (msg.what == 1) { String a = (String) msg.obj; yiQuXiaoAdapter.notifyDataSetChanged(); Toast.makeText(getActivity(), "订单已取消" + a, Toast.LENGTH_SHORT).show(); } } }; private DaiZhiFuPresenter daiZhiFuPresenter; private DingDanLieBiaoBean dingDanLieBiaoBean; private YiQuXiaoAdapter yiQuXiaoAdapter; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view=inflater.inflate(R.layout.fragment_dingdan,container,false); rv = view.findViewById(R.id.rv); return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); daiZhiFuPresenter = new DaiZhiFuPresenter(this); } @Override public void onResume() { super.onResume(); daiZhiFuPresenter.getData("https://www.zhaoapi.cn/product/getOrders",page); } @Override public void getSuccess(final DingDanLieBiaoBean dingDanLieBiaoBean) { this.dingDanLieBiaoBean=dingDanLieBiaoBean; getActivity().runOnUiThread(new Runnable() { @Override public void run() { List<DingDanLieBiaoBean.DataBean> data = dingDanLieBiaoBean.getData(); yiQuXiaoAdapter = new YiQuXiaoAdapter(getActivity(), data, handler); rv.setAdapter(yiQuXiaoAdapter); rv.setLayoutManager(new LinearLayoutManager(getActivity())); } }); } }
待支付M层DaiZhifuModelpublic class DaiZhifuModel { private IDaiZhiFuPresenter iDaiZhiFuPresenter; public DaiZhifuModel(IDaiZhiFuPresenter iDaiZhiFuPresenter) { this.iDaiZhiFuPresenter=iDaiZhiFuPresenter; } public void getData(String url,int page){ Map<String, String> params=new HashMap<>(); params.put("uid", "2845"); params.put("status", "0"); params.put("page", page + ""); OkHttp3Util.doPost(url, params, new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { if (response.isSuccessful()){ String json = response.body().string(); DingDanLieBiaoBean dingDanLieBiaoBean = new Gson().fromJson(json, DingDanLieBiaoBean.class); iDaiZhiFuPresenter.getSuccess(dingDanLieBiaoBean); } } }); } }待支付P层DaiZhiFuPresenter
public class DaiZhiFuPresenter implements IDaiZhiFuPresenter { private final IDaiZhifu iDaiZhifu; private final DaiZhifuModel daiZhifuModel; public DaiZhiFuPresenter(IDaiZhifu iDaiZhifu) { this.iDaiZhifu =iDaiZhifu; daiZhifuModel = new DaiZhifuModel(this); } public void getData(String url,int page){ daiZhifuModel.getData(url,page); } @Override public void getSuccess(DingDanLieBiaoBean dingDanLieBiaoBean) { iDaiZhifu.getSuccess(dingDanLieBiaoBean); } }
待支付实体类IDaiZhiFuPresenterpublic interface IDaiZhiFuPresenter { void getSuccess(DingDanLieBiaoBean dingDanLieBiaoBean); }
待支付V层public interface IDaiZhifu { void getSuccess(DingDanLieBiaoBean dingDanLieBiaoBean); }待支付适配器DaiZhiFuAdapterpublic class DaiZhiFuAdapter extends RecyclerView.Adapter<DaiZhiFuAdapter.ViewHolder>{ Context context; List<DingDanLieBiaoBean.DataBean> data; Handler handler; public DaiZhiFuAdapter(Context context, List<DingDanLieBiaoBean.DataBean> data, Handler handler) { this.context=context; this.data=data; this.handler=handler; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view=View.inflate(context, R.layout.daizhifu_items,null); ViewHolder holder=new ViewHolder(view); return holder; } @Override public int getItemCount() { return data.size(); } @Override public void onBindViewHolder(ViewHolder holder, final int position) { holder.text_title.setText(data.get(position).getTitle()); holder.text_state.setText("待支付"); holder.text_price.setText(data.get(position).getPrice()+""); holder.text_time.setText(data.get(position).getCreatetime()); if (data.get(position).getStatus()==0){ holder.bt.setText("取消订单"); holder.bt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { final AlertDialog.Builder ab=new AlertDialog.Builder(context); ab.setTitle("确认取消订单吗?"); ab.setPositiveButton("是", new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialogInterface, final int j) { OkHttp3Util.doGet("https://www.zhaoapi.cn/product/updateOrder?uid=4427&orderId="+data.get(position).getOrderid(), new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { if (response.isSuccessful()){ final String string = response.body().string(); CommonUtils.runOnUIThread(new Runnable() { @Override public void run() { Toast.makeText(context, string,Toast.LENGTH_SHORT).show(); // page++; OkHttp3Util.doGet("https://www.zhaoapi.cn/product/getOrders?uid=2845&page=3", new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { final String string = response.body().string(); if (response.isSuccessful()){ CommonUtils.runOnUIThread(new Runnable() { @Override public void run() { Gson gson=new Gson(); DingDanLieBiaoBean dingDanLieBiaoBean = gson.fromJson(string, DingDanLieBiaoBean.class); data.clear(); data.addAll(dingDanLieBiaoBean.getData()); // holder.zt.setTextColor(Color.GRAY); notifyDataSetChanged(); // List<Dingbean.DataBean> data = dingDanLieBiaoBean.getData(); Message message= Message.obtain(); message.obj=data; message.what=2; handler.sendMessage(message); } }); } } }); } }); } } }); } }); ab.setNegativeButton("否",null); ab.show(); } }); } } public class ViewHolder extends RecyclerView.ViewHolder { TextView text_title; TextView text_state; TextView text_price; TextView text_time; Button bt; public ViewHolder(View itemView) { super(itemView); text_title=itemView.findViewById(R.id.text_title); text_state=itemView.findViewById(R.id.text_state); text_price=itemView.findViewById(R.id.text_price); text_time=itemView.findViewById(R.id.text_time); bt=itemView.findViewById(R.id.bt); } } }
已支付适配器YiZhiFuAdapterpublic class YiZhiFuAdapter extends RecyclerView.Adapter<YiZhiFuAdapter.ViewHolder>{ Context context; List<DingDanLieBiaoBean.DataBean> data; Handler handler; public YiZhiFuAdapter(Context context, List<DingDanLieBiaoBean.DataBean> data, Handler handler) { this.context=context; this.data=data; this.handler=handler; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view=View.inflate(context, R.layout.yizhifu_items,null); ViewHolder holder=new ViewHolder(view); return holder; } @Override public int getItemCount() { return data.size(); } @Override public void onBindViewHolder(ViewHolder holder, final int position) { holder.text_title.setText(data.get(position).getTitle()); holder.text_state.setText("已支付"); holder.text_price.setText(data.get(position).getPrice()+""); holder.text_time.setText(data.get(position).getCreatetime()); holder.bt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Message msg = new Message(); msg.what = 1; msg.obj = position + ""; handler.sendMessage(msg); } }); } public class ViewHolder extends RecyclerView.ViewHolder { TextView text_title; TextView text_state; TextView text_price; TextView text_time; Button bt; public ViewHolder(View itemView) { super(itemView); text_title=itemView.findViewById(R.id.text_title); text_state=itemView.findViewById(R.id.text_state); text_price=itemView.findViewById(R.id.text_price); text_time=itemView.findViewById(R.id.text_time); bt=itemView.findViewById(R.id.bt); } } }
已取消适配器YiQuXiaoAdapterpublic class YiQuXiaoAdapter extends RecyclerView.Adapter<YiQuXiaoAdapter.ViewHolder>{ Context context; List<DingDanLieBiaoBean.DataBean> data; Handler handler; public YiQuXiaoAdapter(Context context, List<DingDanLieBiaoBean.DataBean> data, Handler handler) { this.context=context; this.data=data; this.handler=handler; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view=View.inflate(context, R.layout.yiquxiao_items,null); ViewHolder holder=new ViewHolder(view); return holder; } @Override public int getItemCount() { return data.size(); } @Override public void onBindViewHolder(ViewHolder holder, final int position) { holder.text_title.setText(data.get(position).getTitle()); holder.text_state.setText("已取消"); holder.text_price.setText(data.get(position).getPrice() + ""); holder.text_time.setText(data.get(position).getCreatetime()); holder.bt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Message msg = new Message(); msg.what = 1; msg.obj = position + ""; handler.sendMessage(msg); } }); } public class ViewHolder extends RecyclerView.ViewHolder { TextView text_title; TextView text_state; TextView text_price; TextView text_time; Button bt; public ViewHolder(View itemView) { super(itemView); text_title=itemView.findViewById(R.id.text_title); text_state=itemView.findViewById(R.id.text_state); text_price=itemView.findViewById(R.id.text_price); text_time=itemView.findViewById(R.id.text_time); bt=itemView.findViewById(R.id.bt); } } }订单解析DingDanLieBiaoBeanpublic class DingDanLieBiaoBean { /** * msg : 请求成功 * code : 0 * data : [{"createtime":"2017-12-21T18:06:53","orderid":6140,"price":12,"status":0,"title":"订单测试标题2797","uid":2797},{"createtime":"2018-01-13T17:16:29","orderid":6848,"price":18577.99,"status":0,"title":"订单测试标题2797","uid":2797},{"createtime":"2018-01-13T17:16:32","orderid":6849,"price":18577.99,"status":0,"title":"订单测试标题2797","uid":2797}] * page : 1 */ private String msg; private String code; private String page; private List<DataBean> data; public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getPage() { return page; } public void setPage(String page) { this.page = page; } public List<DataBean> getData() { return data; } public void setData(List<DataBean> data) { this.data = data; } public static class DataBean { /** * createtime : 2017-12-21T18:06:53 * orderid : 6140 * price : 12 * status : 0 * title : 订单测试标题2797 * uid : 2797 */ private String createtime; private int orderid; private double price; private int status; private String title; private int uid; public String getCreatetime() { return createtime; } public void setCreatetime(String createtime) { this.createtime = createtime; } public int getOrderid() { return orderid; } public void setOrderid(int orderid) { this.orderid = orderid; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getUid() { return uid; } public void setUid(int uid) { this.uid = uid; } } }
布局splash布局
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".Activity.SplashActivity"> <ImageView android:id="@+id/main_image" android:layout_width="100dp" android:layout_height="100dp" android:src="@mipmap/ic_launcher" android:layout_centerVertical="true" android:layout_centerHorizontal="true" /> </RelativeLayout>
goods<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".Activity.GoodsActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:id="@+id/lll3" android:layout_above="@+id/ll" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="<" android:textSize="20dp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="20dp" android:text="商品详情" android:gravity="center" android:textColor="#000" /> </LinearLayout> <TextView android:layout_width="match_parent" android:layout_height="1dp" android:background="#000" /> <com.stx.xhb.xbanner.XBanner android:layout_width="match_parent" android:layout_height="200dp" android:id="@+id/shangpin"> </com.stx.xhb.xbanner.XBanner> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/title2" android:textSize="24dp" android:layout_marginLeft="10dp" android:layout_marginTop="5dp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/price2" android:textSize="20dp" android:layout_marginLeft="10dp" android:layout_marginTop="5dp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/branprice2" android:textSize="20dp" android:layout_marginLeft="10dp" android:layout_marginTop="5dp" android:textColor="#f00" /> </LinearLayout> <LinearLayout android:layout_alignParentBottom="true" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:id="@+id/ll" > <Button android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:text="购物车" android:gravity="center" android:background="#f00" android:textColor="#fff" android:onClick="gouwuche" /> <Button android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:text="加入购物车" android:gravity="center" android:background="#f00" android:textColor="#fff" android:onClick="jiaru" /> </LinearLayout> </RelativeLayout>
main布局<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".Activity.V.MainActivity"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="编辑" android:id="@+id/bianji" android:paddingLeft="380dp" android:textSize="24dp" android:layout_alignParentTop="true" /> <ScrollView android:layout_below="@+id/bianji" android:layout_above="@+id/linear_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <!--购物车的二级列表--> <com.example.ruiyonghui.yue_demo.custom.CartExpanableListview android:id="@+id/expanable_listview" android:layout_width="match_parent" android:layout_height="wrap_content"> </com.example.ruiyonghui.yue_demo.custom.CartExpanableListview> <!--为你推荐--> <LinearLayout android:layout_marginTop="20dp" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="500dp"> </LinearLayout> </LinearLayout> </ScrollView> <RelativeLayout android:visibility="gone" android:id="@+id/relative_progress" android:layout_above="@+id/linear_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <ProgressBar android:layout_centerInParent="true" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </RelativeLayout> <LinearLayout android:id="@+id/linear_layout" android:layout_alignParentBottom="true" android:gravity="center_vertical" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="50dp"> <CheckBox android:layout_marginLeft="10dp" android:button="@null" android:background="@drawable/check_box_selector" android:id="@+id/check_all" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/text_total" android:text="合计:¥0.00" android:layout_weight="2" android:layout_width="0dp" android:layout_height="wrap_content" /> <TextView android:text="去结算(0)" android:background="#ff0000" android:textColor="#ffffff" android:gravity="center" android:id="@+id/text_buy" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" /> </LinearLayout> <LinearLayout android:visibility="invisible" android:id="@+id/linear8" android:layout_alignParentBottom="true" android:gravity="center_vertical" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="50dp" > <CheckBox android:layout_marginLeft="10dp" android:button="@null" android:background="@drawable/check_box_selector" android:id="@+id/check_a" android:layout_width="30dp" android:layout_height="30dp" /> <Button android:layout_marginLeft="80dp" android:id="@+id/but1" android:text="分享" android:layout_weight="2" android:layout_width="0dp" android:layout_height="wrap_content" /> <Button android:layout_marginLeft="3dp" android:id="@+id/but2" android:text="移入关注" android:layout_weight="3" android:layout_width="0dp" android:layout_height="wrap_content" /> <Button android:layout_marginLeft="3dp" android:id="@+id/but3" android:textColor="#f00" android:text="删除" android:layout_weight="2" android:layout_width="0dp" android:layout_height="wrap_content" /> </LinearLayout> </RelativeLayout>
mian2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".Activity.Main2Activity"> <LinearLayout android:layout_width="match_parent" android:layout_height="40dp" android:orientation="horizontal" android:layout_alignParentTop="true" android:id="@+id/ding" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="<" android:textSize="26dp" android:onClick="huiqu2" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="确认订单" android:textSize="24dp" android:layout_marginLeft="220dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="订单中心" android:layout_marginLeft="180dp" android:onClick="dingdanzhongxin" /> </LinearLayout> <TextView android:layout_below="@+id/ding" android:layout_width="match_parent" android:layout_height="1dp" android:background="#000" android:id="@+id/xian" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:id="@+id/tupian" > <ImageView android:layout_width="100dp" android:layout_height="100dp" android:id="@+id/maidongxidetupian" /> </LinearLayout> <LinearLayout android:layout_alignParentBottom="true" android:layout_width="match_parent" android:layout_height="50dp" android:orientation="horizontal"> <TextView android:id="@+id/text_kuan" android:layout_width="0dp" android:layout_weight="2" android:text="实付款:" android:layout_marginLeft="120dp" android:layout_marginTop="13dp" android:textColor="#ff0000" android:layout_height="match_parent" /> <TextView android:id="@+id/text_order" android:layout_width="0dp" android:layout_weight="2" android:text="立即下单" android:gravity="center" android:textColor="#fff" android:background="#ff0000" android:layout_height="match_parent" /> </LinearLayout> </RelativeLayout>
lei_biao<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="50dp" android:layout_gravity="center" android:gravity="center" android:orientation="horizontal"> <TextView android:layout_width="0dp" android:layout_weight="1" android:gravity="center" android:layout_height="wrap_content" android:textSize="20sp" android:text="订单列表"/> <ImageView android:id="@+id/iv" android:layout_width="20dp" android:layout_height="20dp" android:layout_marginRight="5dp" android:src="@drawable/lv_icon"/> </LinearLayout> <android.support.design.widget.TabLayout android:id="@+id/tab" android:layout_width="match_parent" android:layout_height="55dp" app:tabIndicatorColor="@color/colorAccent" app:tabMode="fixed" app:tabSelectedTextColor="@color/colorPrimaryDark" app:tabTextColor="@color/colorPrimary" /> <android.support.v4.view.ViewPager android:id="@+id/vp" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout>
child_item_layout<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:padding="10dp" android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:id="@+id/rel" android:layout_toLeftOf="@+id/text_delete" android:layout_width="match_parent" android:layout_height="match_parent"> <CheckBox android:layout_centerVertical="true" android:id="@+id/check_child" android:button="@null" android:background="@drawable/check_box_selector" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <ImageView android:id="@+id/image_good" android:layout_centerVertical="true" android:layout_toRightOf="@+id/check_child" android:layout_marginLeft="10dp" android:layout_width="80dp" android:layout_height="80dp" /> <TextView android:id="@+id/text_title" android:layout_toRightOf="@+id/image_good" android:layout_marginLeft="10dp" android:layout_alignTop="@+id/image_good" android:maxLines="2" android:minLines="2" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/text_price" android:layout_toRightOf="@+id/image_good" android:layout_marginLeft="10dp" android:layout_alignBottom="@+id/image_good" android:text="¥99.99" android:textColor="#ff0000" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <LinearLayout android:layout_alignParentRight="true" android:layout_alignBottom="@+id/image_good" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:id="@+id/text_jian" android:text="一" android:padding="5dp" android:background="@drawable/bian_kuang_line" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:gravity="center" android:id="@+id/text_num" android:paddingLeft="10dp" android:paddingRight="10dp" android:background="@drawable/bian_kuang_line" android:layout_width="wrap_content" android:layout_height="match_parent" /> <TextView android:id="@+id/text_add" android:text="十" android:padding="5dp" android:background="@drawable/bian_kuang_line" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> </RelativeLayout> <TextView android:layout_marginLeft="3dp" android:layout_alignParentRight="true" android:layout_alignTop="@+id/rel" android:layout_alignBottom="@+id/rel" android:id="@+id/text_delete" android:background="#ff0000" android:text="删除" android:gravity="center" android:textColor="#ffffff" android:layout_width="50dp" android:layout_height="match_parent" /> </RelativeLayout>
daizhifu_items<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="30dp" android:layout_margin="10dp" android:orientation="horizontal"> <TextView android:id="@+id/text_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ddd"/> <TextView android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" /> <TextView android:id="@+id/text_state" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ssss"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="30dp" android:layout_margin="10dp" android:orientation="horizontal"> <TextView android:id="@+id/text_price" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ff0000" android:text="ddd"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="40dp" android:layout_margin="10dp" android:orientation="horizontal"> <TextView android:id="@+id/text_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ddd"/> <TextView android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" /> <Button android:id="@+id/bt" android:layout_width="wrap_content" android:layout_height="match_parent" android:text="取消订单"/> </LinearLayout> </LinearLayout> </RelativeLayout> fragment_dingdan<com.scwang.smartrefresh.layout.SmartRefreshLayout android:id="@+id/refreshLayout" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v7.widget.RecyclerView android:id="@+id/rv" android:layout_width="match_parent" android:layout_height="match_parent"> </android.support.v7.widget.RecyclerView> </com.scwang.smartrefresh.layout.SmartRefreshLayout>
group_item_layout<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:gravity="center_vertical" android:padding="10dp" android:layout_width="match_parent" android:layout_height="match_parent"> <CheckBox android:button="@null" android:background="@drawable/check_box_selector" android:id="@+id/check_group" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:layout_marginLeft="10dp" android:text="京东自营" android:id="@+id/text_group" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout>
pop_layout<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="#ffffff"> <TextView android:id="@+id/tv1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="20dp" android:text="待支付"/> <TextView android:id="@+id/tv2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="20dp" android:text="已支付"/> <TextView android:id="@+id/tv3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="20dp" android:text="已取消"/> </LinearLayout>
yiquxiao_items<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="30dp" android:layout_margin="10dp" android:orientation="horizontal"> <TextView android:id="@+id/text_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ddd"/> <TextView android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" /> <TextView android:id="@+id/text_state" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ssss"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="30dp" android:layout_margin="10dp" android:orientation="horizontal"> <TextView android:id="@+id/text_price" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ff0000" android:text="ddd"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="40dp" android:layout_margin="10dp" android:orientation="horizontal"> <TextView android:id="@+id/text_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ddd"/> <TextView android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" /> <Button android:id="@+id/bt" android:layout_width="wrap_content" android:layout_height="match_parent" android:text="查看订单"/> </LinearLayout> </LinearLayout> </RelativeLayout>
yizhifu_items<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="30dp" android:layout_margin="10dp" android:orientation="horizontal"> <TextView android:id="@+id/text_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ddd"/> <TextView android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" /> <TextView android:id="@+id/text_state" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ssss"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="30dp" android:layout_margin="10dp" android:orientation="horizontal"> <TextView android:id="@+id/text_price" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ff0000" android:text="ddd"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="40dp" android:layout_margin="10dp" android:orientation="horizontal"> <TextView android:id="@+id/text_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ddd"/> <TextView android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" /> <Button android:id="@+id/bt" android:layout_width="wrap_content" android:layout_height="match_parent" android:text="查看订单"/> </LinearLayout> </LinearLayout> </RelativeLayout>
bian_kuang_line<shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#ffffff" /> <stroke android:width="0.1dp" android:color="#000000" /> </shape>
check_box_selector<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:drawable="@drawable/shopping_cart_checked"/> <item android:state_checked="false" android:drawable="@drawable/shopping_cart_none_check"/> <item android:drawable="@drawable/shopping_cart_none_check"/> </selector>
iclauncher_background<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="108dp" android:height="108dp" android:viewportHeight="108" android:viewportWidth="108"> <path android:fillColor="#26A69A" android:pathData="M0,0h108v108h-108z" /> <path android:fillColor="#00000000" android:pathData="M9,0L9,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M19,0L19,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M29,0L29,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M39,0L39,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M49,0L49,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M59,0L59,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M69,0L69,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M79,0L79,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M89,0L89,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M99,0L99,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,9L108,9" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,19L108,19" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,29L108,29" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,39L108,39" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,49L108,49" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,59L108,59" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,69L108,69" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,79L108,79" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,89L108,89" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,99L108,99" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M19,29L89,29" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M19,39L89,39" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M19,49L89,49" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M19,59L89,59" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M19,69L89,69" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M19,79L89,79" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M29,19L29,89" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M39,19L39,89" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M49,19L49,89" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M59,19L59,89" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M69,19L69,89" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M79,19L79,89" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> </vector>
values
colors<color name="colorhui">#ccc</color> <color name="colorhei">#000</color> <color name="colorhong">#f00</color>