public void updateLoadedFiles() {
   Map<String, String> indexActivatedFileNames = app.getResourceManager().getIndexFileNames();
   DownloadIndexActivity.listWithAlternatives(
       app, app.getAppPath(""), IndexConstants.EXTRA_EXT, indexActivatedFileNames);
   Map<String, String> indexFileNames = app.getResourceManager().getIndexFileNames();
   DownloadIndexActivity.listWithAlternatives(
       app, app.getAppPath(""), IndexConstants.EXTRA_EXT, indexFileNames);
   DownloadIndexActivity.listWithAlternatives(
       app,
       app.getAppPath(IndexConstants.TILES_INDEX_DIR),
       IndexConstants.SQLITE_EXT,
       indexFileNames);
   app.getResourceManager().getBackupIndexes(indexFileNames);
   this.indexFileNames = indexFileNames;
   this.indexActivatedFileNames = indexActivatedFileNames;
 }
 public List<String> onIndexingFiles(IProgress progress, Map<String, String> indexFileNames) {
   ArrayList<TourInformation> tourPresent = new ArrayList<TourInformation>();
   List<String> warns = new ArrayList<String>();
   selectedTour = null;
   if (toursFolder.exists()) {
     File[] availableTours = toursFolder.listFiles();
     if (availableTours != null) {
       String selectedName = selectedTourPref.get();
       for (File tr : availableTours) {
         if (tr.isDirectory()) {
           boolean selected = selectedName != null && selectedName.equals(tr.getName());
           String date =
               app.getResourceManager()
                   .getDateFormat()
                   .format(new Date(DownloadIndexActivity.findFileInDir(tr).lastModified()));
           indexFileNames.put(tr.getName(), date);
           final TourInformation tourInformation = new TourInformation(tr);
           tourPresent.add(tourInformation);
           if (selected) {
             reloadSelectedTour(progress, tr, tourInformation, warns);
           }
         }
       }
       if (selectedName == null) {
         app.getSettings().setSettingsAPI(originalSettings.getSettingsAPI());
       }
     }
   }
   this.tourPresent = tourPresent;
   return warns;
 }
 @Override
 public void run() {
   indexFiles = DownloadOsmandIndexesHelper.getIndexesList(ctx);
   if (uiActivity != null) {
     uiActivity.removeDialog(DIALOG_PROGRESS_LIST);
     uiActivity.runOnUiThread(
         new Runnable() {
           @Override
           public void run() {
             if (indexFiles != null) {
               boolean basemapExists =
                   ((OsmandApplication) uiActivity.getApplication())
                       .getResourceManager()
                       .containsBasemap();
               if (!basemapExists && indexFiles.getBasemap() != null) {
                 uiActivity.entriesToDownload.put(
                     indexFiles.getBasemap().getFileName(),
                     indexFiles.getBasemap().createDownloadEntry(ctx));
                 AccessibleToast.makeText(
                         uiActivity,
                         R.string.basemap_was_selected_to_download,
                         Toast.LENGTH_LONG)
                     .show();
                 uiActivity.findViewById(R.id.DownloadButton).setVisibility(View.VISIBLE);
               }
               uiActivity.setListAdapter(
                   uiActivity.new DownloadIndexAdapter(indexFiles.getIndexFiles()));
               if (indexFiles.isIncreasedMapVersion()) {
                 uiActivity.showDialog(DownloadIndexActivity.DIALOG_MAP_VERSION_UPDATE);
               }
             } else {
               AccessibleToast.makeText(
                       uiActivity, R.string.list_index_files_was_not_loaded, Toast.LENGTH_LONG)
                   .show();
             }
           }
         });
   }
 }
示例#4
0
 @Override
 public void run() {
   indexFiles = DownloadOsmandIndexesHelper.downloadIndexesListFromInternet();
   if (uiActivity != null) {
     uiActivity.removeDialog(DIALOG_PROGRESS_LIST);
     uiActivity.runOnUiThread(
         new Runnable() {
           @Override
           public void run() {
             if (indexFiles != null) {
               uiActivity.setListAdapter(
                   uiActivity.new DownloadIndexAdapter(indexFiles.getIndexFiles()));
               if (indexFiles.isIncreasedMapVersion()) {
                 uiActivity.showDialog(DownloadIndexActivity.DIALOG_MAP_VERSION_UPDATE);
               }
             } else {
               Toast.makeText(
                       uiActivity, R.string.list_index_files_was_not_loaded, Toast.LENGTH_LONG)
                   .show();
             }
           }
         });
   }
 }
 public void updatedLoadedFiles(
     java.util.Map<String, String> indexFileNames,
     java.util.Map<String, String> indexActivatedFileNames) {
   DownloadIndexActivity.listWithAlternatives(
       app.getResourceManager().getDateFormat(), toursFolder, "", indexFileNames);
 }