Exemple #1
0
  public void doSearch(Search search) {
    Preconditions.checkState(listener != null, "Listener not initialised");
    final int searchId = ++currentSearchId;
    listener.onSearching();
    atlas.search(
        search,
        new Callback<List<ProductHeader>>() {
          @Override
          public void success(List<ProductHeader> result) {
            if (searchId != currentSearchId) {
              return;
            }

            setProducts(searchId, result);
          }

          @Override
          public void error(Exception e) {
            if (searchId != currentSearchId) {
              return;
            }

            listener.onError(e);
          }
        });
  }
Exemple #2
0
 public void setListener(Listener l) {
   this.listener = Preconditions.checkNotNull(l, "Null listener");
 }