diff --git a/android/res/values-cs/strings.xml b/android/res/values-cs/strings.xml index 150bfa215e..971a1c89e0 100644 --- a/android/res/values-cs/strings.xml +++ b/android/res/values-cs/strings.xml @@ -105,7 +105,7 @@ ^přidáno do \nfronty stahování. - Stahuji^(^%) + Stahuji^ (^%) Stáhnout^ @@ -144,5 +144,6 @@ Pokračovat Staženo (%s), klepni pro smazání Aktualizace %s + Pro funkci vyhledávání musíš aktualizovat mapy: diff --git a/android/res/values-ru/strings.xml b/android/res/values-ru/strings.xml index cc0a6b5381..58c90b468b 100644 --- a/android/res/values-ru/strings.xml +++ b/android/res/values-ru/strings.xml @@ -109,7 +109,7 @@ ^добавлено в очередь\nзагрузки. - Загружается^(^%) + Загружается^ (^%) Загрузить^ @@ -148,9 +148,16 @@ Продолжить Загружено (%s), нажмите для обновления или удаления Обновить %s + Для функции поиска необходимо обновить устаревшие карты: + Доступно обновление для следующих карт: + Maps With Me Lite больше не нужна. Рекомендуем ее удалить. + + %s успешно загружена. + + Загрузка %s провалилась. Добавить группу diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml index ba30062544..75565be59d 100644 --- a/android/res/values/strings.xml +++ b/android/res/values/strings.xml @@ -112,7 +112,7 @@ ^is added to the\ndownloading queue. - Downloading^(^%) + Downloading^ (^%) Download^ @@ -152,9 +152,16 @@ Continue Downloaded (%s), touch to update or delete Update %s + You need to updated maps for search function: - Update available for this maps: + + Update available for these maps: + You don\'t need Maps With Me Lite any more, so you can uninstall it. + + %s downloaded successfuly. + + Downloading of %s failed. Add New Set diff --git a/android/src/com/mapswithme/maps/DownloadResourcesActivity.java b/android/src/com/mapswithme/maps/DownloadResourcesActivity.java index f131791086..9fd04c7529 100644 --- a/android/src/com/mapswithme/maps/DownloadResourcesActivity.java +++ b/android/src/com/mapswithme/maps/DownloadResourcesActivity.java @@ -287,7 +287,7 @@ public class DownloadResourcesActivity extends Activity implements LocationServi setContentView(R.layout.download_resources); - mMapStorage = MapStorage.getInstance(); + mMapStorage = mApplication.getMapStorage(); mSlotId = mMapStorage.subscribe(this); // Create sdcard folder if it doesn't exist diff --git a/android/src/com/mapswithme/maps/DownloadUI.java b/android/src/com/mapswithme/maps/DownloadUI.java index 5aca3d1dbb..a965ee6399 100644 --- a/android/src/com/mapswithme/maps/DownloadUI.java +++ b/android/src/com/mapswithme/maps/DownloadUI.java @@ -134,8 +134,9 @@ public class DownloadUI extends ListActivity implements MapStorage.Listener public DownloadAdapter(Activity context) { - m_storage = MapStorage.getInstance(); - m_packageName = context.getApplication().getPackageName(); + MWMApplication app = (MWMApplication) context.getApplication(); + m_storage = app.getMapStorage(); + m_packageName = app.getPackageName(); m_context = context; m_inflater = (LayoutInflater) m_context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); diff --git a/android/src/com/mapswithme/maps/MWMActivity.java b/android/src/com/mapswithme/maps/MWMActivity.java index 813e3ec90f..9d901eb57a 100644 --- a/android/src/com/mapswithme/maps/MWMActivity.java +++ b/android/src/com/mapswithme/maps/MWMActivity.java @@ -11,7 +11,6 @@ import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; import android.os.Environment; -import android.util.DisplayMetrics; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -38,6 +37,10 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService { return mApplication.getLocationService(); } + private MapStorage getMapStorage() + { + return mApplication.getMapStorage(); + } public void checkShouldStartLocationService() { @@ -213,8 +216,7 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService { m_needCheckUpdate = false; - final MapStorage s = MapStorage.getInstance(); - s.updateMaps(R.string.advise_update_maps, this, new MapStorage.UpdateFunctor() + getMapStorage().updateMaps(R.string.advise_update_maps, this, new MapStorage.UpdateFunctor() { @Override public void doUpdate() @@ -276,8 +278,7 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService } else { - final MapStorage s = MapStorage.getInstance(); - if (!s.updateMaps(R.string.search_update_maps, this, new MapStorage.UpdateFunctor() + if (!getMapStorage().updateMaps(R.string.search_update_maps, this, new MapStorage.UpdateFunctor() { @Override public void doUpdate() @@ -327,9 +328,18 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService mApplication = (MWMApplication)getApplication(); + 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)); + nativeSetString("not_enough_free_space_on_sdcard", getString(R.string.not_enough_free_space_on_sdcard)); + + nativeConnectDownloadButton(); + // Get screen density - DisplayMetrics metrics = new DisplayMetrics(); - getWindowManager().getDefaultDisplay().getMetrics(metrics); + //DisplayMetrics metrics = new DisplayMetrics(); + //getWindowManager().getDefaultDisplay().getMetrics(metrics); double k = metrics.density; @@ -382,15 +392,6 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService SharedPreferences prefs = getSharedPreferences(mApplication.getPackageName(), MODE_PRIVATE); final boolean isMyPositionEnabled = prefs.getBoolean(PREFERENCES_MYPOSITION, false); findViewById(R.id.map_button_myposition).setSelected(isMyPositionEnabled); - - 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)); - nativeSetString("not_enough_free_space_on_sdcard", getString(R.string.not_enough_free_space_on_sdcard)); - - nativeConnectDownloadButton(); } @Override diff --git a/android/src/com/mapswithme/maps/MWMApplication.java b/android/src/com/mapswithme/maps/MWMApplication.java index 5c53f8062c..bfabf10113 100644 --- a/android/src/com/mapswithme/maps/MWMApplication.java +++ b/android/src/com/mapswithme/maps/MWMApplication.java @@ -13,18 +13,51 @@ import android.os.Environment; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.util.Log; +import android.widget.Toast; +import com.mapswithme.maps.MapStorage.Index; import com.mapswithme.maps.location.LocationService; import com.mapswithme.util.Utils; -public class MWMApplication extends android.app.Application + +public class MWMApplication extends android.app.Application implements MapStorage.Listener { private final static String TAG = "MWMApplication"; - private LocationService mLocationService = null; + + private LocationService m_location = null; + private MapStorage m_storage = null; + private int m_slotID = 0; private boolean mIsProVersion = false; private String mProVersionCheckURL = ""; + + private void showDownloadToast(int resID, Index idx) + { + String msg = String.format(getString(resID), m_storage.countryName(idx)); + Toast.makeText(this, msg, Toast.LENGTH_LONG).show(); + } + + @Override + public void onCountryStatusChanged(Index idx) + { + switch (m_storage.countryStatus(idx)) + { + case MapStorage.ON_DISK: + showDownloadToast(R.string.download_country_success, idx); + break; + + case MapStorage.DOWNLOAD_FAILED: + showDownloadToast(R.string.download_country_failed, idx); + break; + } + } + + @Override + public void onCountryProgress(Index idx, long current, long total) + { + } + @Override public void onCreate() { @@ -66,16 +99,27 @@ public class MWMApplication extends android.app.Application // Changed path for settings to be the same as external storage extStoragePath, //getSettingsPath(), mIsProVersion); + + m_slotID = getMapStorage().subscribe(this); } public LocationService getLocationService() { - if (mLocationService == null) - mLocationService = new LocationService(this); + if (m_location == null) + m_location = new LocationService(this); - return mLocationService; + return m_location; } + public MapStorage getMapStorage() + { + if (m_storage == null) + m_storage = new MapStorage(); + + return m_storage; + } + + public String getApkPath() { try diff --git a/android/src/com/mapswithme/maps/MapStorage.java b/android/src/com/mapswithme/maps/MapStorage.java index 220de68b46..99ca3d48f9 100644 --- a/android/src/com/mapswithme/maps/MapStorage.java +++ b/android/src/com/mapswithme/maps/MapStorage.java @@ -128,20 +128,10 @@ public class MapStorage private native String[] nativeGetMapsWithoutSearch(); - private MapStorage() + public MapStorage() { } - private static MapStorage mInstance = null; - - public static MapStorage getInstance() - { - if (mInstance == null) - mInstance = new MapStorage(); - - return mInstance; - } - private void runDownloadCountries(Index[] indexes) { for (int i = 0; i < indexes.length; ++i) diff --git a/map/country_status_display.cpp b/map/country_status_display.cpp index e0e2557593..7b33913a50 100644 --- a/map/country_status_display.cpp +++ b/map/country_status_display.cpp @@ -15,7 +15,7 @@ string const CountryStatusDisplay::displayName() const { if (!m_mapGroupName.empty()) - return m_mapName + "(" + m_mapGroupName + ")"; + return m_mapName + " (" + m_mapGroupName + ")"; else return m_mapName; } diff --git a/strings.txt b/strings.txt index ceb48046c0..9c60b49694 100644 --- a/strings.txt +++ b/strings.txt @@ -513,10 +513,10 @@ ru = ^добавлено в очередь\nзагрузки. cs = ^přidáno do \nfronty stahování. [country_status_downloading] - en = Downloading^(^%) + en = Downloading^ (^%) comment = Message to display at the center of the screen when the country is downloading - ru = Загружается^(^%) - cs = Stahuji^(^%) + ru = Загружается^ (^%) + cs = Stahuji^ (^%) [country_status_download] en = Download^ comment = Button text for the button at the center of the screen when the country is not downloaded @@ -669,30 +669,46 @@ ru = Обновить %@ cs = Aktualizace %@ [search_update_maps] + comment = Show toast when we have countries without search index + tags = android en = You need to updated maps for search function: ru = Для функции поиска необходимо обновить устаревшие карты: cs = Pro funkci vyhledávání musíš aktualizovat mapy: [advise_update_maps] - en = Update available for this maps: + comment = Show toast on start when we have out-of-date maps + tags = android + en = Update available for these maps: ru = Доступно обновление для следующих карт: [suggest_uninstall_lite] + comment = Show toast in Pro version that Lite can be deleted + tags = android en = You don't need Maps With Me Lite any more, so you can uninstall it. ru = Maps With Me Lite больше не нужна. Рекомендуем ее удалить. + [download_country_success] + comment = Show toast when country has downloaded. + tags = android + en = %@ downloaded successfuly. + ru = %@ успешно загружена. + [download_country_failed] + comment = Show toast when country downloading failed. + tags = android + en = Downloading of %@ failed. + ru = Загрузка %@ провалилась. [add_new_set] - en = Add New Set - tags = ios - comment = Add New Bookmark Set dialog title - ru = Добавить группу + en = Add New Set + tags = ios + comment = Add New Bookmark Set dialog title + ru = Добавить группу [add_to_bookmarks] - en = Add To Bookmarks - tags = ios - comment = Place Page - Add To Bookmarks button - ru = Добавить в закладки + en = Add To Bookmarks + tags = ios + comment = Place Page - Add To Bookmarks button + ru = Добавить в закладки [bookmark_color] - en = Bookmark Color - tags = ios - comment = Bookmark Color dialog title - ru = Цвет закладки + en = Bookmark Color + tags = ios + comment = Bookmark Color dialog title + ru = Цвет закладки [bookmark_set_name] en = Bookmark Set Name tags = ios