@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle extras = getIntent().getExtras();
    String itemName = null;
    if (extras != null && extras.containsKey(EXTRA_MENUITEM_NAME)) {
      itemName = extras.getString(EXTRA_MENUITEM_NAME);
    } else if (savedInstanceState != null && savedInstanceState.containsKey(EXTRA_MENUITEM_NAME)) {
      itemName = extras.getString(EXTRA_MENUITEM_NAME);
    }

    // Ugly way to find the item
    DineOnUser dou = DineOnUserApplication.getDineOnUser();
    DiningSession session = dou.getDiningSession();
    if (session != null) {
      for (Menu menu : session.getRestaurantInfo().getMenuList()) {
        for (MenuItem item : menu.getItems()) {
          if (item.getTitle().equals(itemName)) {
            mItem = item;
          }
        }
      }
    }

    if (mItem == null) {
      Log.e(TAG, "Unable to load menu item to show details");
      return;
    }

    setContentView(R.layout.activity_menuitem_detail);
  }
Ejemplo n.º 2
0
 /** @return A Menu representing a menu */
 public static Menu createFakeMenu() {
   Menu entreeMenu = new Menu("testEntrees");
   for (MenuItem item : createFakeMenuItems(3)) {
     entreeMenu.addNewItem(item);
   }
   entreeMenu.setObjId("menu");
   return entreeMenu;
 }