/** * Removes the square passed as parameter from the list of the recent squares * * @param square The square you want to remove */ public static void removeRecent(String square) { // trova la square da rimuovere for (Square s : recentSquaresList) { if (s.getId().equals(square)) { recentSquaresList.remove(s); break; } } // Notifica gli ascoltatori for (InSquareProfileListener ispl : listeners) { ispl.onRecentChanged(); Log.d(TAG, "addRecent: notifying listeners!"); } }
/** * Removes the square passed as parameter from the list of the favourite squares * * @param square The square you want to remove */ public static void removeFav(String square) { // trova la square da rimuovere for (Square s : favouriteSquaresList) { if (s.getId().equals(square)) { favouriteSquaresList.remove(s); break; } } // Notifica gli ascoltatori for (InSquareProfileListener ispl : listeners) { Log.d(TAG, "removeFav: notifying listeners!"); ispl.onFavChanged(); } }
/** * Checks if there is a square with the id equals to the one passed as parameter inside the recent * squares list * * @param squareId The id of the square * @return True if the square is present */ public static boolean isRecent(String squareId) { for (Square s : recentSquaresList) { if (s.getId().equals(squareId)) return true; } return false; }
/** * Checks if there is a square with the id equals to the one passed as parameter inside the * favourite squares list * * @param squareId The id of the square * @return True if the square is present */ public static boolean isFav(String squareId) { for (Square s : favouriteSquaresList) { if (s.getId().equals(squareId)) return true; } return false; }
/** * Checks if there is a square with the id equals to the one passed as parameter inside the owned * squares list * * @param squareId The id of the square * @return True if the square is present */ public static boolean isOwned(String squareId) { for (Square s : ownedSquaresList) { if (s.getId().equals(squareId)) return true; } return false; }