Пример #1
0
 private void setListData() {
   if (mCategories.count() <= 0) {
     errorAccurDlg("菜谱数据损坏,请更新菜谱!", FINISH_ACTIVITY);
     return;
   }
   setCategories();
   setDishes();
   updateOrderedDishCount();
 }
Пример #2
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);
  }