diff --git a/android/app/src/main/java/app/organicmaps/downloader/BottomPanel.java b/android/app/src/main/java/app/organicmaps/downloader/BottomPanel.java index f62c68a870..3700f4fe93 100644 --- a/android/app/src/main/java/app/organicmaps/downloader/BottomPanel.java +++ b/android/app/src/main/java/app/organicmaps/downloader/BottomPanel.java @@ -30,7 +30,7 @@ class BottomPanel public void onClick(View v) { final String country = mFragment.getCurrentRoot(); - MapManager.warnOn3gUpdate(mFragment.requireActivity(), country, () -> MapManager.nativeUpdate(country)); + MapManager.warnOn3gUpdate(mFragment.requireActivity(), country, () -> MapManager.startUpdate(country)); } }; diff --git a/android/app/src/main/java/app/organicmaps/downloader/DownloaderAdapter.java b/android/app/src/main/java/app/organicmaps/downloader/DownloaderAdapter.java index 4c3b9558b2..d1d38dadd2 100644 --- a/android/app/src/main/java/app/organicmaps/downloader/DownloaderAdapter.java +++ b/android/app/src/main/java/app/organicmaps/downloader/DownloaderAdapter.java @@ -91,7 +91,7 @@ class DownloaderAdapter extends RecyclerView.Adapter MapManager.nativeUpdate(item.id)); + MapManager.warnOn3gUpdate(adapter.mActivity, item.id, () -> MapManager.startUpdate(item.id)); } private void onExploreActionSelected(CountryItem item, DownloaderAdapter adapter) @@ -385,7 +385,7 @@ class DownloaderAdapter extends RecyclerView.Adapter - MapManager.warnOn3gUpdate(mActivity, mItem.id, () -> MapManager.nativeUpdate(mItem.id)); + MapManager.warnOn3gUpdate(mActivity, mItem.id, () -> MapManager.startUpdate(mItem.id)); default -> throw new IllegalArgumentException("Inappropriate item status: " + mItem.status); } } diff --git a/android/app/src/main/java/app/organicmaps/downloader/MapManager.java b/android/app/src/main/java/app/organicmaps/downloader/MapManager.java index 9cb715baa0..266baa9cdb 100644 --- a/android/app/src/main/java/app/organicmaps/downloader/MapManager.java +++ b/android/app/src/main/java/app/organicmaps/downloader/MapManager.java @@ -229,6 +229,14 @@ public final class MapManager nativeRetry(countryId); } + /** + * Enqueues given {@code root} node with its children in downloader. + */ + public static void startUpdate(@NonNull String root) { + DownloaderService.startForegroundService(); + nativeUpdate(root); + } + /** * Enqueues the given list of nodes and its children in downloader. */ @@ -351,7 +359,7 @@ public final class MapManager /** * Enqueues given {@code root} node with its children in downloader. */ - public static native void nativeUpdate(String root); + private static native void nativeUpdate(String root); /** * Removes given currently downloading {@code root} node and its children from downloader.