use of net.osmand.plus.download.DownloadIndexesThread.DownloadEvents in project Osmand by osmandapp.
the class DownloadActivity method newDownloadIndexes.
@Override
@UiThread
public void newDownloadIndexes() {
visibleBanner.updateBannerInProgress();
for (WeakReference<Fragment> ref : fragSet) {
Fragment f = ref.get();
if (f instanceof DownloadEvents && f.isAdded()) {
((DownloadEvents) f).newDownloadIndexes();
}
}
downloadHasFinished();
}
use of net.osmand.plus.download.DownloadIndexesThread.DownloadEvents in project Osmand by osmandapp.
the class DownloadActivity method downloadInProgress.
@Override
@UiThread
public void downloadInProgress() {
if (accessibilityAssistant.isUiUpdateDiscouraged())
return;
accessibilityAssistant.lockEvents();
visibleBanner.updateBannerInProgress();
showDownloadWorldMapIfNeeded();
for (WeakReference<Fragment> ref : fragSet) {
Fragment f = ref.get();
if (f instanceof DownloadEvents && f.isAdded()) {
((DownloadEvents) f).downloadInProgress();
}
}
accessibilityAssistant.unlockEvents();
}
use of net.osmand.plus.download.DownloadIndexesThread.DownloadEvents in project Osmand by osmandapp.
the class DownloadActivity method downloadHasFinished.
@Override
@UiThread
public void downloadHasFinished() {
visibleBanner.updateBannerInProgress();
if (downloadItem != null && downloadItem != getMyApplication().getRegions().getWorldRegion() && !WorldRegion.WORLD_BASEMAP.equals(downloadItem.getRegionDownloadNameLC())) {
if (!Algorithms.isEmpty(downloadTargetFileName)) {
File f = new File(downloadTargetFileName);
if (f.exists() && f.lastModified() > System.currentTimeMillis() - 10000) {
getMyApplication().getDownloadThread().initSettingsFirstMap(downloadItem);
showGoToMap(downloadItem);
}
}
downloadItem = null;
downloadTargetFileName = null;
}
if (!Algorithms.isEmpty(downloadTargetFileName)) {
File f = new File(downloadTargetFileName);
if (f.exists()) {
String fileName = f.getName();
if (fileName.endsWith(IndexConstants.FONT_INDEX_EXT)) {
AlertDialog.Builder bld = new AlertDialog.Builder(this);
bld.setMessage(R.string.restart_is_required);
bld.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
android.os.Process.killProcess(android.os.Process.myPid());
}
});
bld.setNegativeButton(R.string.shared_string_cancel, null);
bld.show();
} else if (fileName.startsWith(FileNameTranslationHelper.SEA_DEPTH)) {
getMyApplication().getSettings().getCustomRenderBooleanProperty("depthContours").set(true);
}
}
downloadItem = null;
downloadTargetFileName = null;
}
for (WeakReference<Fragment> ref : fragSet) {
Fragment f = ref.get();
if (f instanceof DownloadEvents && f.isAdded()) {
((DownloadEvents) f).downloadHasFinished();
}
}
}
Aggregations