@Override public void handleMessage(Message msg) { SellOutActivity activity = mActivity.get(); if (activity.mOnSaleFoods == null || activity.mSellOutFoods == null) { return; } SellOutFoodAdapter adapter; activity.findViewById(R.id.button_OnSale_List).setPressed(false); activity.findViewById(R.id.button_Sellout_List).setPressed(false); // 设置底部数量显示 ((TextView) activity.findViewById(R.id.txtView_amount_onSale)) .setText("" + activity.mOnSaleFoods.size()); ((TextView) activity.findViewById(R.id.txtView_amount_sellOut)) .setText("" + activity.mSellOutFoods.size()); switch (msg.what) { case ON_SALE_PAGE: activity.mCurrentPage = ON_SALE_PAGE; adapter = activity .new SellOutFoodAdapter(activity.mOnSaleFoods.filter(activity.mConditionFilter)); activity.findViewById(R.id.button_OnSale_List).setPressed(true); break; case SELL_OUT_PAGE: activity.mCurrentPage = SELL_OUT_PAGE; adapter = activity .new SellOutFoodAdapter(activity.mSellOutFoods.filter(activity.mConditionFilter)); activity.findViewById(R.id.button_Sellout_List).setPressed(true); break; default: activity.mCurrentPage = ON_SALE_PAGE; adapter = activity .new SellOutFoodAdapter( WirelessOrder.foodMenu.foods.filter(activity.mConditionFilter)); } if (adapter.getCount() == 0) { mHintText.setVisibility(View.VISIBLE); } else { mHintText.setVisibility(View.GONE); } activity.mSellOutListView.setAdapter(adapter); }
FoodListHandler(SellOutActivity activity) { mActivity = new WeakReference<SellOutActivity>(activity); mHintText = (TextView) activity.findViewById(R.id.textView_hintText); }