This commit is contained in:
Alexander Sytnyk 2018-01-29 13:51:44 +02:00
parent adb1b92c34
commit b789a731e7

View file

@ -25,6 +25,7 @@ import net.osmand.plus.download.DownloadIndexesThread;
import net.osmand.plus.download.DownloadValidationManager; import net.osmand.plus.download.DownloadValidationManager;
import net.osmand.plus.download.IndexItem; import net.osmand.plus.download.IndexItem;
import net.osmand.plus.helpers.FileNameTranslationHelper; import net.osmand.plus.helpers.FileNameTranslationHelper;
import net.osmand.plus.liveupdates.LiveUpdatesHelper;
import net.osmand.plus.mapcontextmenu.MenuBuilder; import net.osmand.plus.mapcontextmenu.MenuBuilder;
import net.osmand.plus.mapcontextmenu.MenuController; import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.srtmplugin.SRTMPlugin; import net.osmand.plus.srtmplugin.SRTMPlugin;
@ -107,9 +108,10 @@ public class MapDataMenuController extends MenuController {
Toast.makeText(mapActivity, mapActivity.getString(R.string.activate_srtm_plugin), Toast.makeText(mapActivity, mapActivity.getString(R.string.activate_srtm_plugin),
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
} }
} else { } else if (!downloaded || indexItem.isOutdated()) {
new DownloadValidationManager(getMapActivity().getMyApplication()) new DownloadValidationManager(app).startDownload(mapActivity, indexItem);
.startDownload(getMapActivity(), indexItem); } else if (isLiveUpdatesOn()) {
LiveUpdatesHelper.runLiveUpdate(mapActivity, indexItem.getTargetFileName(), true);
} }
} }
} }
@ -179,6 +181,10 @@ public class MapDataMenuController extends MenuController {
updateData(); updateData();
} }
private boolean isLiveUpdatesOn() {
return getMapActivity().getMyApplication().getSettings().IS_LIVE_UPDATES_ON.get();
}
@Override @Override
public boolean displayDistanceDirection() { public boolean displayDistanceDirection() {
return true; return true;
@ -380,6 +386,8 @@ public class MapDataMenuController extends MenuController {
leftDownloadButtonController.caption = getMapActivity().getString(R.string.shared_string_update); leftDownloadButtonController.caption = getMapActivity().getString(R.string.shared_string_update);
} else if (!downloaded) { } else if (!downloaded) {
leftDownloadButtonController.caption = getMapActivity().getString(R.string.shared_string_download); leftDownloadButtonController.caption = getMapActivity().getString(R.string.shared_string_download);
} else if (isLiveUpdatesOn()) {
leftDownloadButtonController.caption = getMapActivity().getString(R.string.live_update);
} else { } else {
leftDownloadButtonController.visible = false; leftDownloadButtonController.visible = false;
} }