コード例 #1
0
  /** Method for initializing all views in {@link CategoryMealsActivity} */
  private void initViews() {
    categoriesContainer = (LinearLayout) findViewById(R.id.categoriesContainer);
    List<Item> reorderedList = new ArrayList<Item>();

    for (int i = 0; i < categories.size(); ++i) {
      for (List<Item> it : items) {
        if (categories.get(i).name.equals(it.get(0).category)) {
          reorderedList.addAll(it);
        }
      }
    }

    for (Category category : categories) {
      List<Item> categoryItems = new ArrayList<Item>();

      for (Item item : reorderedList) {
        if (category.name.equalsIgnoreCase(item.category) && item.image.equalsIgnoreCase("subcat"))
          categoryItems.add(item);
      }

      Menu.getInstance().getDataManager().setItemsList((ArrayList<Item>) reorderedList);

      CategoryMealItemView v =
          new CategoryMealItemView(this, category, categoryItems, reorderedList, categories);
      categoriesContainer.addView(v);
    }
  }
コード例 #2
0
  @Override
  protected void onResume() {
    super.onResume();

    if (Menu.getInstance().getDataManager().isCheckoutListEmpty()) hideRightActionBarButton();
    else showRightActionBarButton();
  }