@Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.search:
       currentPage = 1;
       findParameter = input.getText().toString();
       store_add_goods_lv.setMode(Mode.PULL_FROM_START);
       getResult();
       store_add_goods_lv.setRefreshing();
       break;
     case R.id.scan:
       startActivityForResult(new Intent(this, MipcaActivityCapture.class), Constants.FOR_GET);
       //			startActivityForResult(new Intent(this, CaptureActivity.class),10086);
       break;
     case R.id.ico_scan:
       startActivityForResult(new Intent(this, MipcaActivityCapture.class), Constants.FOR_GET);
       //			startActivityForResult(new Intent(this, CaptureActivity.class),10086);
       break;
     case R.id.clear_input:
       input.setText("");
       clear_input.setVisibility(View.GONE);
       break;
     default:
       break;
   }
 }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_store_order_add_goods);
   setTitleText("选择商品");
   instance = this;
   showBackbtn();
   findView();
   store_add_goods_lv.setMode(Mode.PULL_FROM_START);
   getResult();
   store_add_goods_lv.setRefreshing();
 }
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   if (resultCode == RESULT_OK) {
     findParameter = data.getStringExtra(Constants.DEVICE_CODE);
     input.setText(findParameter);
     currentPage = 1;
     store_add_goods_lv.setMode(Mode.PULL_FROM_START);
     getResult();
     store_add_goods_lv.setRefreshing();
   }
 }
  public void findView() {
    searchGoodsVoList = new ArrayList<StockInfoVo>();
    flag = getIntent().getStringExtra("flag");
    shopId = getIntent().getStringExtra("shopId");
    search = (TextView) findViewById(R.id.search);
    search.setOnClickListener(this);
    input = (EditText) findViewById(R.id.input);
    scan = (ImageView) findViewById(R.id.scan);
    ico_scan = (ImageView) findViewById(R.id.ico_scan);
    clear_input = (ImageView) findViewById(R.id.clear_input);
    clear_input.setOnClickListener(this);
    ico_scan.setOnClickListener(this);
    scan.setOnClickListener(this);
    store_add_goods_lv = (PullToRefreshListView) findViewById(R.id.store_add_goods_lv);
    stockAddGoodsAdapter = new StockAddGoodsAdapter(StockAddGoodsActivity.this, searchGoodsVoList);
    store_add_goods_lv.setAdapter(stockAddGoodsAdapter);
    store_add_goods_lv.setMode(Mode.BOTH);
    new ListAddFooterItem(this, store_add_goods_lv.getRefreshableView());
    // 列表刷新和加载更多操作
    store_add_goods_lv.setOnRefreshListener(
        new PullToRefreshBase.OnRefreshListener2<ListView>() {
          /**
           * 下拉重置数据
           *
           * @param refreshView
           */
          @Override
          public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
            String label =
                DateUtils.formatDateTime(
                    StockAddGoodsActivity.this,
                    System.currentTimeMillis(),
                    DateUtils.FORMAT_SHOW_TIME
                        | DateUtils.FORMAT_SHOW_DATE
                        | DateUtils.FORMAT_ABBREV_ALL);
            refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label);
            currentPage = 1; // 选择以后初始化页数
            getResult();
          }
          /**
           * 上拉加载更多
           *
           * @param refreshView
           */
          @Override
          public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
            String label =
                DateUtils.formatDateTime(
                    StockAddGoodsActivity.this,
                    System.currentTimeMillis(),
                    DateUtils.FORMAT_SHOW_TIME
                        | DateUtils.FORMAT_SHOW_DATE
                        | DateUtils.FORMAT_ABBREV_ALL);
            refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label);
            currentPage = currentPage + 1;
            getResult();
          }
        });
    input.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {
            if (s != null && !s.toString().equals("")) {
              clear_input.setVisibility(View.VISIBLE);
            } else {
              clear_input.setVisibility(View.GONE);
            }
          }

          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          @Override
          public void afterTextChanged(Editable s) {}
        });
    store_add_goods_lv.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            Intent add;
            if (("returnAdjustmentAdd").equals(flag)) {
              add = new Intent(StockAddGoodsActivity.this, StockGoodInfoActivity.class);
              add.putExtra("activity", "stockGoodInfoActivity");
              add.putExtra("goodId", searchGoodsVoList.get(arg2 - 1).getGoodsId());
              add.putExtra("shopId", shopId);
              add.putExtra("barCode", searchGoodsVoList.get(arg2 - 1).getBarCode());
              add.putExtra("goodName", searchGoodsVoList.get(arg2 - 1).getGoodsName());
              startActivity(add);
            }
          }
        });
  }