app/src/main/java/com/mensa/zhmensa/services/MensaManager.java
/**
     * Adds a new mensa for a given category, given day and given mealtype.
     *
     * @param mensas Mensa items to store
     * @param category MenuCategory
     * @param day
     * @param mealType
     */
Adds a new mensa for a given category, given day and given mealtype.
Adds a new mensa for a given category given day and given mealtype .
@Deprecated
    private static void addNewMensaItem(List<Mensa> mensas, MensaCategory category, Mensa.Weekday day, Mensa.MenuCategory mealType, boolean loadedFromInternet) {
        boolean changedFav = false;
        final long currentTime = Helper.getStartOfWeek().getMillis();
        for (Mensa mensa : mensas) {
            mensa.setLastUpdated(currentTime);
            mensa.setMensaCategory(getCategoryForMensa(mensa, category));
            List<IMenu> newMenus = mensa.getMenusForDayAndCategory(day, mealType);
            putAndUpdate(mensa, day, mealType, newMenus);
            for (IMenu menu : newMenus) {
                if (favoriteIds.contains(menu.getId())) {
                    changedFav = true;
                    Log.d("MensaManager-Observable", "Menu: " + menu.getName() + " will be added to the favorite Mensa");
                    favoriteMensa.addMenu(mensa.getDisplayName(), mensa.getUniqueId(),day, mealType, menu);
                }
            }
        }
        if(changedFav) {
            favoriteMensa.setLastUpdated(currentTime);
            listener.onMensaUpdated(favoriteMensa);
        }
    }
@ Deprecated private static void addNewMensaItem ( List < Mensa > mensas , MensaCategory category , Mensa . Weekday day , Mensa . MenuCategory mealType , boolean loadedFromInternet ) { boolean changedFav = false ; final long currentTime = Helper . getStartOfWeek ( ) . getMillis ( ) ; for ( Mensa mensa : mensas ) { mensa . setLastUpdated ( currentTime ) ; mensa . setMensaCategory ( getCategoryForMensa ( mensa , category ) ) ; List < IMenu > newMenus = mensa . getMenusForDayAndCategory ( day , mealType ) ; putAndUpdate ( mensa , day , mealType , newMenus ) ; for ( IMenu menu : newMenus ) { if ( favoriteIds . contains ( menu . getId ( ) ) ) { changedFav = true ; Log . d ( "MensaManager-Observable" , "Menu: " + menu . getName ( ) + " will be added to the favorite Mensa" ) ; favoriteMensa . addMenu ( mensa . getDisplayName ( ) , mensa . getUniqueId ( ) , day , mealType , menu ) ; } } } if ( changedFav ) { favoriteMensa . setLastUpdated ( currentTime ) ; listener . onMensaUpdated ( favoriteMensa ) ; } }
Adds a new mensa for a given category, given day and given mealtype.
Adds a new mensa for a given category given day and given mealtype .
// New loaded Menus // Check if any item is a favorite Menu. If yes, add it to the favorite Mensa-