Example #1
0
 public void getID(
     Game game,
     final Context mContext,
     final GoogleMap mMap,
     final HashMap<String, SearchItemModel> markerMap) {
   ServerRequests serverRequests = new ServerRequests(mContext);
   serverRequests.getIDInBackground(
       game,
       new GetGameCallback() {
         @Override
         public void done(Game returnedGame) {
           if (returnedGame == null) {
             // createGame(userLocalStore.getGame());
             searchLocation(new Game(name), mContext, mMap, markerMap);
           } else {
             // userLocalStore.storeID(returnedGame);
             // Game ngame = userLocalStore.getGame();
             int court_id = returnedGame.id + 1; // number of games at the court
             for (int i = 0; i < court_id; i++) {
               searchLocation(new Game(i, name), mContext, mMap, markerMap);
             }
           }
           // return returnedGame;
         }
       });
 }
Example #2
0
  public void searchLocation(
      Game game,
      final Context mContext,
      final GoogleMap mMap,
      final HashMap<String, SearchItemModel> markerMap) {
    ServerRequests serverRequests = new ServerRequests(mContext);
    gamesList = new ArrayList<>();
    serverRequests.fetchGameDataInBackground(
        game,
        new GetGameCallback() {
          @Override
          public void done(Game returnedGame) {
            if (returnedGame != null) {
              try {
                gamesList.add(returnedGame);

              } catch (NullPointerException e) {
                e.printStackTrace();
              }
            }
            populateMapWithModel(mMap, mContext, markerMap);
          }
        });
  }