@Override public void onClick(View v) { switch (v.getId()) { case R.id.titleback_image_back: // 返回上一页 // Toast.makeText(getApplicationContext(), "返回上一页", 0).show(); this.finish(); break; case R.id.search: // 搜索 // myApplication.setOrderList(orderList); Intent intent = new Intent(AllOederActivity.this, SearchOrderActivity.class); // intent.putExtra("contact_id", list.get(arg2).getContact_id()); startActivity(intent); break; case R.id.button_1: // 全部订单 status_number = 99; buttonNumber = 0; setButtonColor(buttonNumber); builder = Tools.showLoading(this, "加载中"); buttonClick(); break; case R.id.button_2: // 待发货 status_number = 102; buttonNumber = 1; setButtonColor(buttonNumber); builder = Tools.showLoading(this, "加载中"); buttonClick(); break; case R.id.button_3: // 已发货 status_number = 103; buttonNumber = 2; setButtonColor(buttonNumber); builder = Tools.showLoading(this, "加载中"); buttonClick(); break; case R.id.button_4: // 已完结 status_number = 104; buttonNumber = 3; setButtonColor(buttonNumber); builder = Tools.showLoading(this, "加载中"); buttonClick(); break; default: break; } }
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_allorder); myApplication = (MyApplication) getApplication(); myApplication.addActivity(this); preferences = getSharedPreferences(Config.SHARED, Context.MODE_PRIVATE); String release = android.os.Build.VERSION.RELEASE; // android系统版本号 version = Integer.parseInt(release.substring(0, 1)); sessionId = preferences.getString("sessionId", "sessionId"); merchantId = preferences.getLong("merchantId", 10000); initView(); setButton(); mAdapter = new TodayOrderAdapter(this, orderList); order_listview.setAdapter(mAdapter); if (Tools.isConnect(getApplicationContext())) { builder = Tools.showLoading(this, "加载中"); getOrderList(); } else { handler.sendEmptyMessage(2); } }