mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-26 07:43:36 +00:00
[android] Fix displayed map size on download error
When a map download fails, the displayed size in the UI should be the total size of the map. This commit fixes that discrepancy.
This commit is contained in:
committed by
Konstantin Pastbin
parent
52b31d31e4
commit
7df0565bc9
@@ -480,6 +480,13 @@ class DownloaderAdapter extends RecyclerView.Adapter<DownloaderAdapter.ViewHolde
|
||||
|
||||
UiUtils.showIf(mSearchResultsMode && !TextUtils.isEmpty(found), mFoundName);
|
||||
|
||||
long size = getMapDisplaySize();
|
||||
mSize.setText(StringUtils.getFileSizeString(mFragment.requireContext(), size));
|
||||
mStatusIcon.update(mItem);
|
||||
}
|
||||
|
||||
private long getMapDisplaySize()
|
||||
{
|
||||
long size;
|
||||
if (mItem.status == CountryItem.STATUS_ENQUEUED ||
|
||||
mItem.status == CountryItem.STATUS_PROGRESS ||
|
||||
@@ -487,13 +494,16 @@ class DownloaderAdapter extends RecyclerView.Adapter<DownloaderAdapter.ViewHolde
|
||||
{
|
||||
size = mItem.enqueuedSize;
|
||||
}
|
||||
else if (mItem.status == CountryItem.STATUS_FAILED ||
|
||||
mItem.status == CountryItem.STATUS_DOWNLOADABLE)
|
||||
{
|
||||
size = mItem.totalSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
size = ((!mSearchResultsMode && mMyMapsMode) ? mItem.size : mItem.totalSize);
|
||||
}
|
||||
|
||||
mSize.setText(StringUtils.getFileSizeString(mFragment.requireContext(), size));
|
||||
mStatusIcon.update(mItem);
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user