diff options
author | Alexander Marchuk <alexm@maps.me> | 2016-03-18 16:33:43 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-23 16:57:00 +0300 |
commit | b38da9c7c899c8a141eb53735d874c34f4a6666b (patch) | |
tree | b82897bd501c3c7e72ca103773799ec83c0fc052 | |
parent | 9c539becfb6ac5ed75409e759392b79e7c343ac6 (diff) |
[new downloader][android] fix: Images updated.
4 files changed, 10 insertions, 7 deletions
diff --git a/android/jni/com/mapswithme/maps/MapManager.cpp b/android/jni/com/mapswithme/maps/MapManager.cpp index f0702d0e15..309acb317e 100644 --- a/android/jni/com/mapswithme/maps/MapManager.cpp +++ b/android/jni/com/mapswithme/maps/MapManager.cpp @@ -252,7 +252,11 @@ static void UpdateItem(JNIEnv * env, jobject item, NodeAttrs const & attrs) env->SetBooleanField(item, countryItemFieldPresent, attrs.m_present); // Progress - env->SetIntField(item, countryItemFieldProgress, static_cast<jint>(attrs.m_downloadingProgress.first)); + int progress = 0; + if (attrs.m_downloadingProgress.second) + progress = (int)(attrs.m_downloadingProgress.first * 100.0 / attrs.m_downloadingProgress.second); + + env->SetIntField(item, countryItemFieldProgress, progress); } static void PutItemsToList(JNIEnv * env, jobject const list, TCountriesVec const & children, int category, diff --git a/android/src/com/mapswithme/maps/downloader/CountryItem.java b/android/src/com/mapswithme/maps/downloader/CountryItem.java index f3fc74aa68..5cdedde97d 100644 --- a/android/src/com/mapswithme/maps/downloader/CountryItem.java +++ b/android/src/com/mapswithme/maps/downloader/CountryItem.java @@ -6,7 +6,6 @@ import android.support.annotation.NonNull; * Class representing a single item in countries hierarchy. * Fields are filled by native code. */ -@SuppressWarnings("unused") public final class CountryItem implements Comparable<CountryItem> { // Must correspond to ItemCategory in MapManager.cpp @@ -47,6 +46,7 @@ public final class CountryItem implements Comparable<CountryItem> public int errorCode; public boolean present; + // Percent public int progress; // Internal ID for grouping under headers in the list @@ -120,6 +120,6 @@ public final class CountryItem implements Comparable<CountryItem> ", childCount: " + childCount + ", totalChildCount: " + totalChildCount + ", progress: " + progress + - "}"; + "% }"; } } diff --git a/android/src/com/mapswithme/maps/downloader/DownloaderAdapter.java b/android/src/com/mapswithme/maps/downloader/DownloaderAdapter.java index c461b8ccca..d6069db52e 100644 --- a/android/src/com/mapswithme/maps/downloader/DownloaderAdapter.java +++ b/android/src/com/mapswithme/maps/downloader/DownloaderAdapter.java @@ -435,7 +435,7 @@ class DownloaderAdapter extends RecyclerView.Adapter<DownloaderAdapter.ViewHolde if (inProgress) { - mProgress.setProgress(mItem.status == CountryItem.STATUS_PROGRESS ? (int)(mItem.progress * 100L / mItem.totalSize) : 0); + mProgress.setProgress(mItem.status == CountryItem.STATUS_PROGRESS ? mItem.progress : 0); return; } diff --git a/android/src/com/mapswithme/maps/downloader/OnmapDownloader.java b/android/src/com/mapswithme/maps/downloader/OnmapDownloader.java index 2b4399a66b..b5dec00101 100644 --- a/android/src/com/mapswithme/maps/downloader/OnmapDownloader.java +++ b/android/src/com/mapswithme/maps/downloader/OnmapDownloader.java @@ -114,9 +114,8 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener if (progress) { - int size = (int) (mCurrentCountry.progress * 100L / mCurrentCountry.totalSize); - mProgress.setProgress(size); - sizeText = size + "%"; + mProgress.setProgress(mCurrentCountry.progress); + sizeText = mCurrentCountry.progress + "%"; } else { |