private void refreshOneSavedPage(@NonNull final PageTitle title) { getApiService(title) .pageCombo( title.getPrefixedText(), !WikipediaApp.getInstance().isImageDownloadEnabled(), new SaveOtherPageCallback(title) { @Override protected void onComplete() { if (!progressDialog.isShowing()) { isRefreshCancelled = true; // no longer attached to activity! return; } savedPagesCompleted++; progressDialog.setProgress(savedPagesCompleted); L.d("Count is " + savedPagesCompleted + " of " + savedPages.size()); if (savedPagesCompleted == savedPages.size()) { progressDialog.dismiss(); } } @Override protected void onError() { isRefreshCancelled = true; if (!progressDialog.isShowing()) { // no longer attached to activity! return; } progressDialog.dismiss(); getErrorDialog().show(); } }); }
private PageService getApiService(PageTitle title) { return PageServiceFactory.create(title.getSite()); }