<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # 基礎使用 請看這篇文章 [基礎使用教程](http://blog.csdn.net/yanbober/article/details/45307549) # 點餐APP中的用法: 第一步,初始化 ` final AsyncHttpClient client = new AsyncHttpClient();` 第二步發送get請求 ~~~ client.get(Constants.server_url + Constants.buyer_list_url, null, new AsyncHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) { AppLog.debug(new String(responseBody)); Gson gson = new Gson(); ProductVO productVO = gson.fromJson(new String(responseBody), ProductVO.class); AppLog.debug(productVO.getData().get(0).getFoods().get(0).getName()); //一個data就是一種商品類型 List<ProductVO.DataBean> dataBeanList = productVO.getData(); //組裝商品類型 categorylist List<String> categoryName = new ArrayList<>(); //組裝商品productlist final List<ProductItem> productItemList = new ArrayList<>(); final List<Integer> typesList = new ArrayList<>(); int flag = 0; for (ProductVO.DataBean dataBean : dataBeanList) { String categoryNameTMP = dataBean.getName(); AppLog.debug(categoryNameTMP); //組裝類型名稱 categoryName.add(categoryNameTMP); //獲得商品列表 List<ProductVO.DataBean.FoodsBean> foods = dataBean.getFoods(); flag += foods.size(); typesList.add(flag);//每個商品類型有幾個商品,第0個類型有 foods.zie個商品 for (ProductVO.DataBean.FoodsBean foodsBean : foods) { ProductItem productItem = new ProductItem(); productItem.setProductId(foodsBean.getId()); productItem.setImgUrl(foodsBean.getIcon()); productItem.setProductName(foodsBean.getName()); productItem.setProductDes(foodsBean.getDescription()); productItem.setProductPrice(foodsBean.getPrice()); //添加商品列表 productItemList.add(productItem); } } RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getApplicationContext(), LinearLayoutManager.VERTICAL, false); RecyclerView.LayoutManager layoutManager1 = new LinearLayoutManager(getApplicationContext(), LinearLayoutManager.VERTICAL, false); rvProduct.setLayoutManager(layoutManager); ivProductCategory.setLayoutManager(layoutManager1); BaseQuickAdapter<String, BaseViewHolder> categoryAdapter = new HomeAdapterCategory(R.layout.product_category_item, categoryName); final BaseQuickAdapter<ProductItem, BaseViewHolder> infoProductAdapter = new HomeAdapter(R.layout.product_info_item, productItemList); //商品類型添加事件 categoryAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { @Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { //position對應商品類型 int foodsposition = typesList.get(position); AppLog.debug(foodsposition); rvProduct.scrollToPosition(foodsposition); } }); infoProductAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() { @Override public void onItemChildClick(BaseQuickAdapter adapter, View view, final int position) { List<ProductItem> productItems = cartForm.getList(); if (view.getId() == R.id.btn_add_product_to_cart) { Integer amout = productItemList.get(position).getAmout(); productItemList.get(position).setAmout(amout + 1); AppLog.debug(amout + 1); ProductItem productItem = productItemList.get(position); productItems.add(productItem); } else if (view.getId() == R.id.btn_de_product_to_cart) { Integer amout = productItemList.get(position).getAmout(); if (amout > 0) { productItemList.get(position).setAmout(amout - 1); ProductItem productItem = productItemList.get(position); productItems.add(productItem); } AppLog.debug(amout - 1); } int sumCount = 0; int sumPrice = 0; for (ProductItem productItem : productItemList) { sumCount += productItem.getAmout(); if (productItem.getAmout() >= 1) { sumPrice += productItem .getProductPrice() * productItem.getAmout(); } } cartForm.setList(productItems); rvProduct.setAdapter(infoProductAdapter); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("總共").append(sumCount).append("件商品").append("共計").append(sumPrice).append("元"); tvShowCart.setText(stringBuilder); } }); rvProduct.setAdapter(infoProductAdapter); ivProductCategory.setAdapter(categoryAdapter); } @Override public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) { } }); ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看