Пример #1
0
  void logOffline(
      final IAbstractActivity fromActivity,
      final String log,
      Calendar date,
      final LogType logType) {
    if (logType == LogType.LOG_UNKNOWN) {
      return;
    }
    cgeoapplication app = (cgeoapplication) ((Activity) fromActivity).getApplication();
    final boolean status = app.saveLogOffline(geocode, date.getTime(), logType, log);

    Resources res = ((Activity) fromActivity).getResources();
    if (status) {
      fromActivity.showToast(res.getString(R.string.info_log_saved));
      app.saveVisitDate(geocode);
    } else {
      fromActivity.showToast(res.getString(R.string.err_log_post_failed));
    }
  }
Пример #2
0
  public boolean logVisit(IAbstractActivity fromActivity) {
    if (StringUtils.isBlank(cacheId)) {
      fromActivity.showToast(
          ((Activity) fromActivity).getResources().getString(R.string.err_cannot_log_visit));
      return true;
    }
    Intent logVisitIntent = new Intent((Activity) fromActivity, VisitCacheActivity.class);
    logVisitIntent.putExtra(VisitCacheActivity.EXTRAS_ID, cacheId);
    logVisitIntent.putExtra(VisitCacheActivity.EXTRAS_GEOCODE, geocode.toUpperCase());
    logVisitIntent.putExtra(VisitCacheActivity.EXTRAS_FOUND, found);

    ((Activity) fromActivity).startActivity(logVisitIntent);

    return true;
  }