diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index 21ca624a52..ab8190c1fa 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -172,6 +172,27 @@ namespace android return m_work.GetCountryStatusDisplay(); } + void Framework::ShowCountry(storage::TIndex const & idx) + { + storage::Country const & country = m_work.Storage().CountryByIndex(idx); + m2::RectD const r = m_work.GetCountryBounds(country.GetFile().m_fileName); + + m_doLoadState = false; + + m_work.SkipLocationCentering(); + m_work.ShowRect(r); + } + + storage::TStatus Framework::GetCountryStatus(storage::TIndex const & idx) const + { + return m_work.GetCountryStatus(idx); + } + + void Framework::DeleteCountry(storage::TIndex const & idx) + { + m_work.DeleteCountry(idx); + } + void Framework::Resize(int w, int h) { m_work.OnSize(w, h); @@ -376,14 +397,6 @@ namespace android m_eventType = eventType; } - void Framework::ShowCountry(m2::RectD const & r) - { - m_doLoadState = false; - - m_work.SkipLocationCentering(); - m_work.ShowRect(r); - } - void Framework::ShowSearchResult(search::Result const & r) { m_doLoadState = false; diff --git a/android/jni/com/mapswithme/maps/Framework.hpp b/android/jni/com/mapswithme/maps/Framework.hpp index 0d4c084487..c0af1b387d 100644 --- a/android/jni/com/mapswithme/maps/Framework.hpp +++ b/android/jni/com/mapswithme/maps/Framework.hpp @@ -62,6 +62,10 @@ namespace android storage::Storage & Storage(); CountryStatusDisplay * GetCountryStatusDisplay(); + void ShowCountry(storage::TIndex const & idx); + storage::TStatus GetCountryStatus(storage::TIndex const & idx) const; + void DeleteCountry(storage::TIndex const & idx); + void OnLocationStatusChanged(int/* == location::TLocationStatus*/ newStatus); void OnLocationUpdated(uint64_t time, double lat, double lon, float accuracy); void OnCompassUpdated(uint64_t time, double magneticNorth, double trueNorth, double accuracy); @@ -82,7 +86,6 @@ namespace android /// Show rect from another activity. Ensure that no LoadState will be called, /// when maim map activity will become active. - void ShowCountry(m2::RectD const & r); void ShowSearchResult(search::Result const & r); bool Search(search::SearchParams const & params); diff --git a/android/jni/com/mapswithme/maps/MapStorage.cpp b/android/jni/com/mapswithme/maps/MapStorage.cpp index 65274ebf1f..160f131414 100644 --- a/android/jni/com/mapswithme/maps/MapStorage.cpp +++ b/android/jni/com/mapswithme/maps/MapStorage.cpp @@ -100,7 +100,7 @@ extern "C" JNIEXPORT jint JNICALL Java_com_mapswithme_maps_MapStorage_countryStatus(JNIEnv * env, jobject thiz, jobject idx) { - return static_cast(g_framework->Storage().CountryStatus(IndexBinding(idx).toNative())); + return static_cast(g_framework->GetCountryStatus(IndexBinding(idx).toNative())); } JNIEXPORT void JNICALL @@ -112,16 +112,9 @@ extern "C" JNIEXPORT void JNICALL Java_com_mapswithme_maps_MapStorage_deleteCountry(JNIEnv * env, jobject thiz, jobject idx) { - g_framework->Storage().DeleteCountry(IndexBinding(idx).toNative()); + g_framework->DeleteCountry(IndexBinding(idx).toNative()); } - JNIEXPORT void JNICALL - Java_com_mapswithme_maps_MapStorage_deleteCountryFiles(JNIEnv * env, jobject thiz, jobject idx) - { - g_framework->Storage().DeleteCountryFiles(IndexBinding(idx).toNative()); - } - - JNIEXPORT jobject JNICALL Java_com_mapswithme_maps_MapStorage_findIndexByName(JNIEnv * env, jobject thiz, jstring name) { @@ -140,8 +133,7 @@ extern "C" JNIEXPORT void JNICALL Java_com_mapswithme_maps_MapStorage_showCountry(JNIEnv * env, jobject thiz, jobject idx) { - m2::RectD const rect = g_framework->Storage().CountryBounds(IndexBinding(idx).toNative()); - g_framework->ShowCountry(rect); + g_framework->ShowCountry(IndexBinding(idx).toNative()); } void ReportChangeCountryStatus(shared_ptr const & obj, storage::TIndex const & idx) diff --git a/android/src/com/mapswithme/maps/DownloadResourcesActivity.java b/android/src/com/mapswithme/maps/DownloadResourcesActivity.java index 707f77c440..55cb3bc9e1 100644 --- a/android/src/com/mapswithme/maps/DownloadResourcesActivity.java +++ b/android/src/com/mapswithme/maps/DownloadResourcesActivity.java @@ -211,8 +211,6 @@ public class DownloadResourcesActivity extends Activity implements LocationServi if (idx.isValid()) { - mMapStorage.deleteCountryFiles(idx); - mProgress.setMax((int)mMapStorage.countryRemoteSizeInBytes(idx)); mProgress.setProgress(0); diff --git a/android/src/com/mapswithme/maps/DownloadUI.java b/android/src/com/mapswithme/maps/DownloadUI.java index cf12dc0e26..5aca3d1dbb 100644 --- a/android/src/com/mapswithme/maps/DownloadUI.java +++ b/android/src/com/mapswithme/maps/DownloadUI.java @@ -253,10 +253,7 @@ public class DownloadUI extends ListActivity implements MapStorage.Listener if (size > getFreeSpace()) showNotEnoughFreeSpaceDialog(getSizeString(size), name); else - { - m_storage.deleteCountry(idx); m_storage.downloadCountry(idx); - } dlg.dismiss(); } diff --git a/android/src/com/mapswithme/maps/MapStorage.java b/android/src/com/mapswithme/maps/MapStorage.java index 7317bb3a9e..5a1d43be17 100644 --- a/android/src/com/mapswithme/maps/MapStorage.java +++ b/android/src/com/mapswithme/maps/MapStorage.java @@ -4,14 +4,15 @@ public class MapStorage { public static final int GROUP = -2; public static final int COUNTRY = -1; + + /// This constants should be equal with storage/storage.hpp, storage::TStatus public static final int ON_DISK = 0; public static final int NOT_DOWNLOADED = 1; public static final int DOWNLOAD_FAILED = 2; public static final int DOWNLOADING = 3; public static final int IN_QUEUE = 4; public static final int UNKNOWN = 5; - public static final int GENERATING_INDEX = 6; - public static final int ON_DISK_OUT_OF_DATE = 7; + public static final int ON_DISK_OUT_OF_DATE = 6; public interface Listener { @@ -112,7 +113,6 @@ public class MapStorage public native void downloadCountry(Index idx); public native void deleteCountry(Index idx); - public native void deleteCountryFiles(Index idx); public native Index findIndexByName(String name);