app/src/main/java/com/mensa/zhmensa/services/MensaManager.java
/**
     * Sets a Menu as favorit or removes it from favorites
     * @param favMenu The Menu
     */
Sets a Menu as favorit or removes it from favorites
@param favMenu The Menu
Sets a Menu as favorit or removes it from favorites @param favMenu The Menu
public static void toggleMenuFav(IMenu favMenu, Context activityContext) {
        SharedPreferences prefs = activityContext.getSharedPreferences(SHARED_PREFS_NAME, Context.MODE_PRIVATE);
        favoriteIds = new HashSet<>(prefs.getStringSet(FAVORITE_STORE_ID, new HashSet<String>()));
        if (favMenu.isFavorite()) {
            Log.d("MensaManager", "Toggle favorite for Menu: " + favMenu.getId());
            favoriteMensa.removeMenuFromList(favMenu);
            favoriteIds.remove(favMenu.getId());
            listener.onMensaUpdated(favoriteMensa);
        } else {
            addFavMenuById(favMenu.getId());
        }
        prefs.edit().putStringSet(FAVORITE_STORE_ID, favoriteIds).apply();
    }
public static void toggleMenuFav ( IMenu favMenu , Context activityContext ) { SharedPreferences prefs = activityContext . getSharedPreferences ( SHARED_PREFS_NAME , Context . MODE_PRIVATE ) ; favoriteIds = new HashSet < > ( prefs . getStringSet ( FAVORITE_STORE_ID , new HashSet < String > ( ) ) ) ; if ( favMenu . isFavorite ( ) ) { Log . d ( "MensaManager" , "Toggle favorite for Menu: " + favMenu . getId ( ) ) ; favoriteMensa . removeMenuFromList ( favMenu ) ; favoriteIds . remove ( favMenu . getId ( ) ) ; listener . onMensaUpdated ( favoriteMensa ) ; } else { addFavMenuById ( favMenu . getId ( ) ) ; } prefs . edit ( ) . putStringSet ( FAVORITE_STORE_ID , favoriteIds ) . apply ( ) ; }
Sets a Menu as favorit or removes it from favorites
 @param favMenu The Menu
Sets a Menu as favorit or removes it from favorites @param favMenu The Menu
// Load favorite id from memory //Remove from favorites // Add to favorites