diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index eb758da2bc..66f1ecb6f7 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -423,4 +423,14 @@ namespace android { return m_work.GetCountryName(m2::PointD(x, y)); } + + StringsBundle const Framework::GetDefaultStringsBundle() const + { + return m_work.GetDefaultStringsBundle(); + } + + void Framework::SetStringsBundle(StringsBundle const & bundle) + { + m_work.SetStringsBundle(bundle); + } } diff --git a/android/jni/com/mapswithme/maps/Framework.hpp b/android/jni/com/mapswithme/maps/Framework.hpp index a7cd93fa98..e5c60b162d 100644 --- a/android/jni/com/mapswithme/maps/Framework.hpp +++ b/android/jni/com/mapswithme/maps/Framework.hpp @@ -10,6 +10,7 @@ #include "../../../../../geometry/avg_vector.hpp" #include "../../../../../base/timer.hpp" +#include "../../../../../base/strings_bundle.hpp" #include "../../../nv_event/nv_event.hpp" @@ -93,6 +94,9 @@ namespace android void AddMap(string const & fileName); string const GetCountryName(double x, double y) const; + + StringsBundle const GetDefaultStringsBundle() const; + void SetStringsBundle(StringsBundle const & bundle); }; } diff --git a/android/jni/com/mapswithme/maps/MWMActivity.cpp b/android/jni/com/mapswithme/maps/MWMActivity.cpp index 74803a5bd4..f99386ac9e 100644 --- a/android/jni/com/mapswithme/maps/MWMActivity.cpp +++ b/android/jni/com/mapswithme/maps/MWMActivity.cpp @@ -9,6 +9,10 @@ #include "../../../../../platform/settings.hpp" #include "../../../../../map/country_status_display.hpp" +#include "../../../../../base/strings_bundle.hpp" + +StringsBundle g_stringsBundle; + //////////////////////////////////////////////////////////////////////////////////////////// extern "C" { @@ -105,6 +109,24 @@ extern "C" g_framework->GetCountryStatusDisplay()->downloadCountry(); } + JNIEXPORT void JNICALL + Java_com_mapswithme_maps_MWMActivity_nativeInitStringsBundle(JNIEnv * env, jobject thiz) + { + g_stringsBundle = g_framework->GetDefaultStringsBundle(); + } + + JNIEXPORT void JNICALL + Java_com_mapswithme_maps_MWMActivity_nativeSetString(JNIEnv * env, jobject thiz, jstring name, jstring value) + { + g_stringsBundle.SetString(jni::ToString(name), jni::ToString(value)); + } + + JNIEXPORT void JNICALL + Java_com_mapswithme_maps_MWMActivity_nativeApplyStringsBundle(JNIEnv * env, jobject thiz) + { + g_framework->SetStringsBundle(g_stringsBundle); + } + ////////////////////////////////////////////////////////////////////////////// JNIEXPORT void JNICALL diff --git a/android/res/values-ru/strings.xml b/android/res/values-ru/strings.xml index 0986925807..3716c3c4f2 100644 --- a/android/res/values-ru/strings.xml +++ b/android/res/values-ru/strings.xml @@ -42,4 +42,8 @@ Карта местности, в которой\nвы находитесь (%s) уже загружена. Приостановить Продолжить + %добавлено в очередь\nзагрузки. + Загрузить% + Загружается%(%\\%) + Ошибка загрузки%. diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml index 7d3f31203a..2acbd347f6 100644 --- a/android/res/values/strings.xml +++ b/android/res/values/strings.xml @@ -42,4 +42,8 @@ The map at your current\nlocation (%s) is up-to-date Pause Continue + %is added to the\ndownloading queue. + Downloading%(%\\%) + Download% + Downloading%\nhas failed diff --git a/android/src/com/mapswithme/maps/MWMActivity.java b/android/src/com/mapswithme/maps/MWMActivity.java index 40c6dcece4..f515de9f21 100644 --- a/android/src/com/mapswithme/maps/MWMActivity.java +++ b/android/src/com/mapswithme/maps/MWMActivity.java @@ -290,6 +290,16 @@ LocationService.Listener final boolean isMyPositionEnabled = prefs.getBoolean(PREFERENCES_MYPOSITION, false); findViewById(R.id.map_button_myposition).setSelected(isMyPositionEnabled); + nativeInitStringsBundle(); + + nativeSetString("country_status_added_to_queue", getString(R.string.country_status_added_to_queue)); + nativeSetString("country_status_downloading", getString(R.string.country_status_downloading)); + nativeSetString("country_status_download", getString(R.string.country_status_download)); + nativeSetString("country_status_download_failed", getString(R.string.country_status_download_failed)); + nativeSetString("try_again", getString(R.string.try_again)); + + nativeApplyStringsBundle(); + nativeConnectDownloadButton(); } @@ -457,6 +467,10 @@ LocationService.Listener } } + private native void nativeInitStringsBundle(); + private native void nativeSetString(String name, String value); + private native void nativeApplyStringsBundle(); + private native void nativeStorageConnected(); private native void nativeStorageDisconnected();