Ejemplo n.º 1
0
 @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();
             }
           }
         });
   }
 }
Ejemplo n.º 2
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();
             }
           }
         });
   }
 }