@Override
  protected void onResume() {
    super.onResume();
    user = GeekApplication.getUser();
    if (user != null) {
      userId = user.getId();
      token = user.getToken();
      getCarts();

    } else {
      userId = "";
      token = "";
      mListView.setVisibility(View.GONE);
      mBottomLayout.setVisibility(View.GONE);
      mEmptyLayout.setVisibility(View.VISIBLE);
    }
    getGuessLike();
  }
  private void init() {
    mScrollView = (PullToRefreshScrollView) findViewById(R.id.carts_list);
    mBottomLayout = (LinearLayout) findViewById(R.id.footer_bar);
    mEmptyLayout = (LinearLayout) findViewById(R.id.empty_layout);
    mToBuy = (Button) findViewById(R.id.to_buy);
    mToBuy.setOnClickListener(this);
    mTotalPrice = (TextView) findViewById(R.id.total_price);
    findViewById(R.id.sidebar).setOnClickListener(this);
    mListView = (ExpandListViewForScrollView) findViewById(R.id.cart_listview);
    //        View footer = getLayoutInflater().inflate(R.layout.shopping_cart_footer, null);
    mHorizontalListView = (HorizontalListView) findViewById(R.id.like_listview);
    mCheckBox = (CheckBox) findViewById(R.id.all_check_box);
    mPayView = (Button) findViewById(R.id.pay);
    mLikeAdapter = new LikeAdapter(this);
    mPayView.setOnClickListener(this);
    mHorizontalListView.setAdapter(mLikeAdapter);
    mListView.setGroupIndicator(null);
    //        mFragment =
    // ((ShoppingCartBaseFragment)getSupportFragmentManager().findFragmentById(R.id.fragment));
    //        mListView.addFooterView(footer);
    mAdapter = new CartAdapter(this);
    mListView.setAdapter(mAdapter);
    mHorizontalListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent intent = new Intent(ShoppingCartActivity.this, ProductInfoActivity.class);
            intent.putExtra("product", mLikeAdapter.getItem(position));
            startActivity(intent);
          }
        });
    //        mListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
    //            @Override
    //            public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
    // int childPosition, long id) {
    //                Intent intent = new Intent(ShoppingCartActivity.this,
    // ProductInfoActivity.class);
    //                intent.putExtra("product", mAdapter.getChild(groupPosition, childPosition));
    //                startActivity(intent);
    //                return true;
    //            }
    //        });

    mAdapter.setmListener(
        new CartAdapter.CartListener() {
          @Override
          public void onCheck() {
            float total = 0;
            for (int i = 0; i < mAdapter.getChecked().size(); i++) {
              total +=
                  mAdapter.getChecked().get(i).getGoodsNumber()
                      * mAdapter.getChecked().get(i).getMemberPrice();
            }
            mTotalPrice.setText("¥ " + total);
          }
        });
    mCheckBox.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            SparseBooleanArray checks = new SparseBooleanArray();
            for (int i = 0; i < mStores.size(); i++) {
              checks.put(i, mCheckBox.isChecked());
            }
            mAdapter.setChildIgnoreChange(false);
            mAdapter.setmGroupCheck(checks);
            mAdapter.notifyDataSetChanged();
          }
        });
    mScrollView.setOnRefreshListener(
        new PullToRefreshBase.OnRefreshListener<ScrollView>() {
          @Override
          public void onRefresh(PullToRefreshBase<ScrollView> refreshView) {
            if (user != null) {
              userId = user.getId();
              token = user.getToken();
              getCarts();

            } else {
              mScrollView.onRefreshComplete();
            }
          }
        });
  }