コード例 #1
0
  @Override
  public void reduceCount(int position) {
    // TODO Auto-generated method stub
    //		reducePosition=position;
    //		flagPosition=1;
    int temp = (Integer) arrayList_cart.get(position).get("count");
    if (temp > 1) {
      // 这里因为开始设计的时候不合理,所以写的比较乱
      RequestState = 3;
      tempPostionRed = position;
      int temp1 = (Integer) arrayList_cart.get(position).get("count");
      arrayList_cart.get(position).put("count", temp1 - 1);
      ApiClient.modifyCart(
          getActivity(),
          arrayList_cart.get(position).get("id") + "",
          arrayList_cart.get(position).get("count") + "",
          arrayList_cart.get(position).get("express") + "",
          arrayList_cart.get(position).get("p_id") + "",
          arrayList_cart.get(position).get("psku_id") + "",
          networkHelper);
    } else {
      Toast.makeText(getActivity(), "不能再少了", Toast.LENGTH_SHORT).show();
    }

    //		adapter.notifyDataSetChanged();

  }
コード例 #2
0
 @Override
 public void addCount(int position) {
   // TODO Auto-generated method stub
   //		flagPosition=2;
   //		addPosition=position;
   RequestState = 2;
   tempPostionAdd = position;
   int temp = (Integer) arrayList_cart.get(position).get("count");
   arrayList_cart.get(position).put("count", temp + 1);
   ApiClient.modifyCart(
       getActivity(),
       arrayList_cart.get(position).get("id") + "",
       arrayList_cart.get(position).get("count") + "",
       arrayList_cart.get(position).get("express") + "",
       arrayList_cart.get(position).get("p_id") + "",
       arrayList_cart.get(position).get("psku_id") + "",
       networkHelper);
   //		adapter.notifyDataSetChanged();
 }