forked from organicmaps/organicmaps
Start DownloaderService when map update is requested also
Signed-off-by: Alexey Krasilnikov <alexey@krasilnikov.me>
This commit is contained in:
parent
08b9e407cb
commit
a11c266584
3 changed files with 12 additions and 4 deletions
|
@ -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));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ class DownloaderAdapter extends RecyclerView.Adapter<DownloaderAdapter.ViewHolde
|
|||
item.update();
|
||||
if (item.status != CountryItem.STATUS_UPDATABLE)
|
||||
return;
|
||||
MapManager.warnOn3gUpdate(adapter.mActivity, item.id, () -> 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<DownloaderAdapter.ViewHolde
|
|||
MapManager.warn3gAndRetry(mActivity, mItem.id, null);
|
||||
}
|
||||
case CountryItem.STATUS_UPDATABLE ->
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue