Example #1
0
 /**
  * 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!");
   }
 }
Example #2
0
  /**
   * 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!");
    }
  }
Example #3
0
  /**
   * 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();
    }
  }