/** * 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!"); } }
/** * Adds the square passed as parameter to the list of the owned squares * * @param square The square you want to add */ public static void addOwned(Square square) { // Aggiungi in coda ownedSquaresList.add(square); // Notifica gli ascoltatori for (InSquareProfileListener ispl : listeners) { ispl.onOwnedChanged(); Log.d(TAG, "addOwned: notifying listeners!"); } }
/** * Removes the square passed as parameter from the list of the owned squares * * @param square The square you want to remove */ public static void removeOwned(String square) { // trova la square da rimuovere for (Square s : ownedSquaresList) { if (s.getId().equals(square)) { ownedSquaresList.remove(s); break; } } // Notifica gli ascoltatori for (InSquareProfileListener ispl : listeners) { ispl.onOwnedChanged(); Log.d(TAG, "removeOwned: notifying listeners!"); } }