protected void downloadFilesCheckFreeVersion() {
   if (Version.isFreeVersion(getMyApplication())) {
     int total = settings.NUMBER_OF_FREE_DOWNLOADS.get();
     boolean wiki = false;
     for (IndexItem es : downloadListIndexThread.getEntriesToDownload().keySet()) {
       if (es.getBasename() != null && es.getBasename().contains("_wiki")) {
         wiki = true;
         break;
       } else if (DownloadActivityType.isCountedInDownloads(es)) {
         total++;
       }
     }
     if (total > MAXIMUM_AVAILABLE_FREE_DOWNLOADS || wiki) {
       String msgTx =
           getString(R.string.free_version_message, MAXIMUM_AVAILABLE_FREE_DOWNLOADS + "");
       Builder msg = new AlertDialog.Builder(this);
       msg.setTitle(R.string.free_version_title);
       msg.setMessage(msgTx);
       msg.setPositiveButton(R.string.default_buttons_ok, null);
       msg.show();
     } else {
       downloadFilesCheckInternet();
     }
   } else {
     downloadFilesCheckInternet();
   }
 }
Beispiel #2
0
  @SuppressLint("DefaultLocale")
  public RightButtonAction getClickAction(final IndexItem indexItem) {
    RightButtonAction clickAction = RightButtonAction.DOWNLOAD;
    if (indexItem.getBasename().toLowerCase().equals(DownloadResources.WORLD_SEAMARKS_KEY)
        && nauticalPluginDisabled) {
      clickAction = RightButtonAction.ASK_FOR_SEAMARKS_PLUGIN;
    } else if ((indexItem.getType() == DownloadActivityType.SRTM_COUNTRY_FILE
            || indexItem.getType() == DownloadActivityType.HILLSHADE_FILE)
        && srtmDisabled) {
      if (srtmNeedsInstallation) {
        clickAction = RightButtonAction.ASK_FOR_SRTM_PLUGIN_PURCHASE;
      } else {
        clickAction = RightButtonAction.ASK_FOR_SRTM_PLUGIN_ENABLE;
      }

    } else if (indexItem.getType() == DownloadActivityType.WIKIPEDIA_FILE && freeVersion) {
      clickAction = RightButtonAction.ASK_FOR_FULL_VERSION_PURCHASE;
    }
    return clickAction;
  }