forked from organicmaps/organicmaps
[android][downloader] fix: Show correct size of group nodes.
This commit is contained in:
parent
6fab8e5971
commit
5162ba444d
4 changed files with 14 additions and 2 deletions
|
@ -267,6 +267,7 @@ static void UpdateItem(JNIEnv * env, jobject item, NodeAttrs const & attrs)
|
|||
static jfieldID const countryItemFieldTopmostParentName = env->GetFieldID(g_countryItemClass, "topmostParentName", "Ljava/lang/String;");
|
||||
static jfieldID const countryItemFieldDescription = env->GetFieldID(g_countryItemClass, "description", "Ljava/lang/String;");
|
||||
static jfieldID const countryItemFieldSize = env->GetFieldID(g_countryItemClass, "size", "J");
|
||||
static jfieldID const countryItemFieldEnqueuedSize = env->GetFieldID(g_countryItemClass, "enqueuedSize", "J");
|
||||
static jfieldID const countryItemFieldTotalSize = env->GetFieldID(g_countryItemClass, "totalSize", "J");
|
||||
static jfieldID const countryItemFieldChildCount = env->GetFieldID(g_countryItemClass, "childCount", "I");
|
||||
static jfieldID const countryItemFieldTotalChildCount = env->GetFieldID(g_countryItemClass, "totalChildCount", "I");
|
||||
|
@ -316,7 +317,8 @@ static void UpdateItem(JNIEnv * env, jobject item, NodeAttrs const & attrs)
|
|||
|
||||
// Sizes
|
||||
env->SetLongField(item, countryItemFieldSize, attrs.m_localMwmSize);
|
||||
env->SetLongField(item, countryItemFieldTotalSize, (attrs.m_downloadingMwmCounter ? attrs.m_downloadingMwmSize : attrs.m_mwmSize));
|
||||
env->SetLongField(item, countryItemFieldEnqueuedSize, attrs.m_downloadingMwmSize);
|
||||
env->SetLongField(item, countryItemFieldTotalSize, attrs.m_mwmSize);
|
||||
|
||||
// Child counts
|
||||
env->SetIntField(item, countryItemFieldChildCount, attrs.m_downloadingMwmCounter);
|
||||
|
|
|
@ -42,6 +42,7 @@ public final class CountryItem implements Comparable<CountryItem>
|
|||
public String description;
|
||||
|
||||
public long size;
|
||||
public long enqueuedSize;
|
||||
public long totalSize;
|
||||
|
||||
public int childCount;
|
||||
|
@ -148,6 +149,7 @@ public final class CountryItem implements Comparable<CountryItem>
|
|||
", errorCode: " + errorCode +
|
||||
", headerId: " + headerId +
|
||||
", size: " + size +
|
||||
", enqueuedSize: " + enqueuedSize +
|
||||
", totalSize: " + totalSize +
|
||||
", childCount: " + childCount +
|
||||
", totalChildCount: " + totalChildCount +
|
||||
|
|
|
@ -514,7 +514,14 @@ class DownloaderAdapter extends RecyclerView.Adapter<DownloaderAdapter.ViewHolde
|
|||
}
|
||||
|
||||
UiUtils.showIf(mSearchResultsMode, mFoundName);
|
||||
mSize.setText(StringUtils.getFileSizeString(mItem.totalSize));
|
||||
|
||||
long size;
|
||||
if (mItem.status == CountryItem.STATUS_ENQUEUED || mItem.status == CountryItem.STATUS_PROGRESS)
|
||||
size = mItem.enqueuedSize;
|
||||
else
|
||||
size = (mMyMapsMode ? mItem.size : mItem.totalSize);
|
||||
|
||||
mSize.setText(StringUtils.getFileSizeString(size));
|
||||
mStatusIcon.update(mItem);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -359,6 +359,7 @@ public final class MapManager
|
|||
* <li>topmostParentName;</li>
|
||||
* <li>description;</li>
|
||||
* <li>size;</li>
|
||||
* <li>enqueuedSize;</li>
|
||||
* <li>totalSize;</li>
|
||||
* <li>childCount;</li>
|
||||
* <li>totalChildCount;</li>
|
||||
|
|
Loading…
Add table
Reference in a new issue