[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:
Mihail Mitrofanov
2025-06-11 10:21:04 +02:00
committed by Konstantin Pastbin
parent 52b31d31e4
commit 7df0565bc9

View File

@@ -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;
}
}