/** * Sets the favourite squares list, notifying the listeners * * @param favouriteSquaresList the list to set */ public static void setFavouriteSquaresList(ArrayList<Square> favouriteSquaresList) { InSquareProfile.favouriteSquaresList = favouriteSquaresList; // Notifica gli ascoltatori for (InSquareProfileListener ispl : listeners) { ispl.onFavChanged(); Log.d(TAG, "setFavSquares: notifying listeners!"); } }
/** * Sets the recent squares list, notifying the listeners * * @param recentSquaresList the list to set */ public static void setRecentSquaresList(ArrayList<Square> recentSquaresList) { InSquareProfile.recentSquaresList = recentSquaresList; // Notifica gli ascoltatori for (InSquareProfileListener ispl : listeners) { ispl.onRecentChanged(); Log.d(TAG, "setRecentSquares: notifying listeners!"); } }
/** * Sets the owned squares list, notifying the listeners * * @param ownedSquaresList the list to set */ public static void setOwnedSquaresList(ArrayList<Square> ownedSquaresList) { InSquareProfile.ownedSquaresList = ownedSquaresList; // Notifica gli ascoltatori for (InSquareProfileListener ispl : listeners) { ispl.onOwnedChanged(); Log.d(TAG, "setOwnedSquares: notifying listeners!"); } }
public static void removeListener(InSquareProfileListener listener) { for (InSquareProfileListener ispl : listeners) { if (ispl.getClass().toString().equals(listener.getClass().toString())) { listeners.remove(ispl); Log.d(TAG, "removeListener: " + listener.getClass().toString()); return; } } }
/** * Adds the square passed as parameter to the list of the recent squares * * @param square The square you want to add */ public static void addRecent(Square square) { // Aggiungi in coda recentSquaresList.add(square); // Notifica gli ascoltatori for (InSquareProfileListener ispl : listeners) { ispl.onRecentChanged(); Log.d(TAG, "addRecent: notifying listeners!"); } }
/** * Adds the square passed as parameter to the list of the favourite squares * * @param square The square you want to add */ public static void addFav(Square square) { // Aggiungi in coda favouriteSquaresList.add(square); // Notifica gli ascoltatori for (InSquareProfileListener ispl : listeners) { ispl.onFavChanged(); Log.d(TAG, "addFav: notifying listeners!"); } }
public static void addListener(InSquareProfileListener listener) { boolean exists = false; for (InSquareProfileListener ispl : listeners) { if (ispl.getClass().toString().equals(listener.getClass().toString())) exists = true; } if (!exists) { listeners.add(listener); Log.d(TAG, "addListener: " + listener.getClass().toString()); } else Log.d(TAG, "addListener: already there!"); }
/** * 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(); } }