Esempio n. 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!");
   }
 }
Esempio n. 2
0
 /**
  * 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!");
   }
 }
Esempio n. 3
0
 /**
  * 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!");
   }
 }
Esempio n. 4
0
 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;
     }
   }
 }
Esempio n. 5
0
  /**
   * 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!");
    }
  }
Esempio n. 6
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!");
    }
  }
Esempio n. 7
0
 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!");
 }
Esempio n. 8
0
  /**
   * 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!");
    }
  }
Esempio n. 9
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();
    }
  }