Example #1
0
 @Override
 public void onItemClick(AdapterView<?> arg0, View view, int position, long arg3) {
   if (!mCategories.getName(position).equals(mDishLstTitle.getText())) {
     mDishLstTitle.setText(mCategories.getName(position));
     updateDishes(position);
   }
 }
Example #2
0
 private void setListData() {
   if (mCategories.count() <= 0) {
     errorAccurDlg("菜谱数据损坏,请更新菜谱!", FINISH_ACTIVITY);
     return;
   }
   setCategories();
   setDishes();
   updateOrderedDishCount();
 }
Example #3
0
  private void setDishes() {
    mDishLstAdapter =
        new DishListAdapter(this, mDishes) {
          @Override
          public View getView(int position, View convertView, ViewGroup arg2) {
            if (Info.getMode() == Info.WORK_MODE_CUSTOMER) {
              return getMenuView(position, convertView);
            } else {
              return getFastOrderMenu(position, convertView);
            }
          }
        };
    if (mCategories.count() <= 0) {
      return;
    }
    mDishLstTitle.setText(mCategories.getName(0));
    mDishesLst.setAdapter(mDishLstAdapter);
    View emptyView = getLayoutInflater().inflate(R.layout.empty_list, null);

    ((ViewGroup) mDishesLst.getParent())
        .addView(emptyView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    mDishesLst.setEmptyView(emptyView);
    updateDishes(0);
  }