Example #1
0
 @Override
 public Date getHiddenDate() {
   try {
     return GCLogin.parseGcCustomDate("2009-10-16", getDateFormat());
   } catch (ParseException e) {
     // intentionally left blank
   }
   return null;
 }
Example #2
0
  public void setViewstates(String[] viewstates) {
    if (GCLogin.isEmpty(viewstates)) {
      return;
    }
    // lazy initialization of viewstates
    if (this.viewstates == null) {
      this.viewstates = new String[viewstates.length];
    }

    System.arraycopy(viewstates, 0, this.viewstates, 0, viewstates.length);
  }
Example #3
0
  private void download() {
    try {
      showProgress();

      final SearchResult searchResult =
          DataStore.loadCachedInViewport(getViewport(), Settings.getCacheType());

      if (Settings.isGCConnectorActive() && tokens == null) {
        tokens = GCLogin.getInstance().getMapTokens();
        if (StringUtils.isEmpty(tokens.getUserSession())
            || StringUtils.isEmpty(tokens.getSessionToken())) {
          tokens = null;
          // TODO: show missing map token toast
          //                    if (!noMapTokenShowed) {
          //                        ActivityMixin.showToast(activity,
          // res.getString(R.string.map_token_err));
          //                        noMapTokenShowed = true;
          //                    }
        }
      }
      searchResult.addSearchResult(
          ConnectorFactory.searchByViewport(getViewport().resize(1.2), tokens));

      final Set<Geocache> result =
          searchResult.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB);
      AbstractCachesOverlay.filter(result);
      // update the caches
      // first remove filtered out
      final Set<String> filteredCodes = searchResult.getFilteredGeocodes();
      Log.d("Filtering out " + filteredCodes.size() + " caches: " + filteredCodes.toString());
      DataStore.removeCaches(filteredCodes, EnumSet.of(RemoveFlag.CACHE));

      Log.d(String.format(Locale.ENGLISH, "Live caches found: %d", result.size()));

      // render
      fill(result);

    } finally {
      hideProgress();
    }
  }