From d932e21976010a4acd56dc4bf712adf3bedaf435 Mon Sep 17 00:00:00 2001 From: Dmitry Yunitsky Date: Fri, 11 Sep 2015 12:59:55 +0300 Subject: [PATCH] [android] Removed old code. --- .../maps/DownloadResourcesActivity.cpp | 12 -- android/jni/com/mapswithme/maps/Framework.cpp | 37 ------- android/jni/com/mapswithme/maps/Framework.hpp | 2 - .../jni/com/mapswithme/maps/MapStorage.cpp | 16 --- .../src/com/mapswithme/maps/MapStorage.java | 103 ------------------ .../src/com/mapswithme/maps/MwmActivity.java | 75 +------------ .../maps/settings/StoragePathManager.java | 35 ------ strings.txt | 97 +---------------- 8 files changed, 2 insertions(+), 375 deletions(-) diff --git a/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp b/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp index fc444acc9d..17e873cdbb 100644 --- a/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp +++ b/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp @@ -67,18 +67,6 @@ extern "C" try { ModelReaderPtr reader(pl.GetReader(name)); - - if (name == WORLD_FILE_NAME DATA_FILE_EXTENSION) - { - FilesContainerR cont(reader); - if (!cont.IsExist(SEARCH_INDEX_FILE_TAG)) - { - // World.mwm file doesn't have search index - need to download new one. - return true; - } - } - - // file exists - no need to download return false; } catch (RootException const &) diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index 7656f4d644..832102d137 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -555,43 +555,6 @@ namespace android m_work.DeregisterAllMaps(); } - void Framework::GetMapsWithoutSearch(vector & out) const - { - // Actually, this routing is obsolete and comes from ancient times - // when mwm was without search index. - if (!Settings::IsFirstLaunchForDate(150101)) - return; - - ASSERT(out.empty(), ()); - - ::Platform const & pl = GetPlatform(); - - vector localFiles; - platform::FindAllLocalMaps(localFiles); - - for (LocalCountryFile const & localFile : localFiles) - { - CountryFile const countryFile = localFile.GetCountryFile(); - // skip World and WorldCoast - if (countryFile.GetNameWithoutExt() == WORLD_FILE_NAME || - countryFile.GetNameWithoutExt() == WORLD_COASTS_FILE_NAME) - { - continue; - } - try - { - FilesContainerR cont(platform::GetCountryReader(localFile, MapOptions::Map)); - if (!cont.IsExist(SEARCH_INDEX_FILE_TAG)) - out.push_back(countryFile.GetNameWithoutExt()); - } - catch (RootException const & ex) - { - // sdcard can contain dummy _*.mwm files. Suppress these errors. - LOG(LWARNING, ("Bad mwm file:", countryFile.GetNameWithoutExt(), "Error:", ex.Msg())); - } - } - } - TIndex Framework::GetCountryIndex(double lat, double lon) const { return m_work.GetCountryIndex(MercatorBounds::FromLatLon(lat, lon)); diff --git a/android/jni/com/mapswithme/maps/Framework.hpp b/android/jni/com/mapswithme/maps/Framework.hpp index a600d64246..1a1bb3aa3b 100644 --- a/android/jni/com/mapswithme/maps/Framework.hpp +++ b/android/jni/com/mapswithme/maps/Framework.hpp @@ -133,8 +133,6 @@ namespace android void AddLocalMaps(); void RemoveLocalMaps(); - void GetMapsWithoutSearch(vector & out) const; - storage::TIndex GetCountryIndex(double lat, double lon) const; string GetCountryCode(double lat, double lon) const; diff --git a/android/jni/com/mapswithme/maps/MapStorage.cpp b/android/jni/com/mapswithme/maps/MapStorage.cpp index 255f14c6a8..0593af5fac 100644 --- a/android/jni/com/mapswithme/maps/MapStorage.cpp +++ b/android/jni/com/mapswithme/maps/MapStorage.cpp @@ -146,22 +146,6 @@ extern "C" GetStorage().Unsubscribe(slotID); } - JNIEXPORT jobjectArray JNICALL - Java_com_mapswithme_maps_MapStorage_nativeGetMapsWithoutSearch(JNIEnv * env, jobject thiz) - { - vector v; - g_framework->GetMapsWithoutSearch(v); - - jclass klass = env->FindClass("java/lang/String"); - ASSERT ( klass, () ); - - int const count = static_cast(v.size()); - jobjectArray ret = env->NewObjectArray(count, klass, 0); - for (int i = 0; i < count; ++i) - env->SetObjectArrayElement(ret, i, env->NewStringUTF(v[i].c_str())); - return ret; - } - JNIEXPORT jboolean JNICALL Java_com_mapswithme_maps_MapStorage_nativeMoveFile(JNIEnv * env, jobject thiz, jstring oldFile, jstring newFile) { diff --git a/android/src/com/mapswithme/maps/MapStorage.java b/android/src/com/mapswithme/maps/MapStorage.java index 0559133703..efced73e6b 100644 --- a/android/src/com/mapswithme/maps/MapStorage.java +++ b/android/src/com/mapswithme/maps/MapStorage.java @@ -1,18 +1,6 @@ package com.mapswithme.maps; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; -import android.os.Environment; -import android.support.annotation.StringRes; -import android.support.v7.app.AlertDialog; - -import com.mapswithme.maps.settings.StoragePathManager; - import java.io.Serializable; -import java.util.HashSet; -import java.util.Set; public enum MapStorage { @@ -41,13 +29,6 @@ public enum MapStorage void onCountryProgress(Index idx, long current, long total); } - public interface UpdateFunctor - { - void doUpdate(); - - void doCancel(); - } - public static class Index implements Serializable { private static final long serialVersionUID = 1L; @@ -120,89 +101,5 @@ public enum MapStorage public native void unsubscribe(int slotId); - private native String[] nativeGetMapsWithoutSearch(); - public static native boolean nativeMoveFile(String oldFile, String newFile); - - private void runDownloadCountries(Index[] indexes) - { - for (Index index : indexes) - { - if (index != null) - Framework.downloadCountry(index); - } - } - - /** - * Checks whether all maps contain search indexes or updates them, if not. - * - * @return True, if any maps where updated. False otherwise. - */ - public boolean updateMapsWithoutSearchIndex(@StringRes int msgId, Context context, final UpdateFunctor fn) - { - // get map names without search index - final String[] maps = nativeGetMapsWithoutSearch(); - - if (maps.length == 0) - return false; - - // get indexes and filter out maps that already downloading - int count = 0; - final Index[] indexes = new Index[maps.length]; - for (int i = 0; i < maps.length; ++i) - { - indexes[i] = null; - - final Index idx = findIndexByFile(maps[i]); - if (idx != null) - { - final int st = countryStatus(idx); - if (st != DOWNLOADING && st != IN_QUEUE) - { - indexes[i] = idx; - ++count; - } - } - } - - // all maps are already downloading - if (count == 0) - return false; - - String msg = context.getString(msgId); - for (int i = 0; i < maps.length; ++i) - { - if (indexes[i] != null) - msg = msg + "\n" + maps[i]; - } - - new AlertDialog.Builder(context) - .setMessage(msg) - .setPositiveButton(context.getString(R.string.download), new DialogInterface.OnClickListener() - { - @Override - public void onClick(DialogInterface dlg, int which) - { - dlg.dismiss(); - - runDownloadCountries(indexes); - - fn.doUpdate(); - } - }) - .setNegativeButton(context.getString(R.string.later), new DialogInterface.OnClickListener() - { - @Override - public void onClick(DialogInterface dlg, int which) - { - dlg.dismiss(); - - fn.doCancel(); - } - }) - .create() - .show(); - - return true; - } } diff --git a/android/src/com/mapswithme/maps/MwmActivity.java b/android/src/com/mapswithme/maps/MwmActivity.java index e2d5cbb445..a2d7e33e56 100644 --- a/android/src/com/mapswithme/maps/MwmActivity.java +++ b/android/src/com/mapswithme/maps/MwmActivity.java @@ -45,7 +45,6 @@ import com.mapswithme.maps.search.SearchFragment; import com.mapswithme.maps.search.SearchToolbarController; import com.mapswithme.maps.settings.SettingsActivity; import com.mapswithme.maps.settings.StoragePathManager; -import com.mapswithme.maps.settings.StoragePathManager.MoveFilesListener; import com.mapswithme.maps.settings.UnitLocale; import com.mapswithme.maps.sound.TtsPlayer; import com.mapswithme.maps.widget.FadeView; @@ -114,7 +113,6 @@ public class MwmActivity extends BaseMwmFragmentActivity private MainMenu mMainMenu; private PanelAnimator mPanelAnimator; - private boolean mNeedCheckUpdate = true; private int mLocationStateModeListenerId = LocationState.SLOT_UNDEFINED; private FadeView mFadeView; @@ -213,11 +211,8 @@ public class MwmActivity extends BaseMwmFragmentActivity @Override public void run() { - // Run all checks in main thread after rendering is initialized. checkMeasurementSystem(); - checkUpdateMapsWithoutSearchIndex(); checkKitkatMigrationMove(); - checkLiteMapsInPro(); checkUserMarkActivation(); } }); @@ -244,55 +239,6 @@ public class MwmActivity extends BaseMwmFragmentActivity mPathManager.checkKitkatMigration(this); } - private void checkLiteMapsInPro() - { - mPathManager.moveMapsLiteToPro(this, - new MoveFilesListener() - { - @Override - public void moveFilesFinished(String newPath) - { - UiUtils.showAlertDialog(MwmActivity.this, R.string.move_lite_maps_to_pro_ok); - } - - @Override - public void moveFilesFailed(int errorCode) - { - UiUtils.showAlertDialog(MwmActivity.this, R.string.move_lite_maps_to_pro_failed); - } - } - ); - } - - private void checkUpdateMapsWithoutSearchIndex() - { - // do it only once - if (mNeedCheckUpdate) - { - mNeedCheckUpdate = false; - - MapStorage.INSTANCE.updateMapsWithoutSearchIndex(R.string.advise_update_maps, this, new MapStorage.UpdateFunctor() - { - @Override - public void doUpdate() - { - runOnUiThread(new Runnable() - { - @Override - public void run() - { - showDownloader(false); - } - }); - } - - @Override - public void doCancel() - {} - }); - } - } - @Override protected int getFragmentContentResId() { @@ -319,25 +265,6 @@ public class MwmActivity extends BaseMwmFragmentActivity startActivity(new Intent(this, BookmarkCategoriesActivity.class)); } - private void showSearchIfContainsSearchIndex() - { - if (!MapStorage.INSTANCE.updateMapsWithoutSearchIndex(R.string.search_update_maps, this, new MapStorage.UpdateFunctor() - { - @Override - public void doUpdate() - { - showDownloader(false); - } - - @Override - public void doCancel() - { - showSearch(); - } - })) - showSearch(); - } - private void showSearch() { if (mIsFragmentContainer) @@ -609,7 +536,7 @@ public class MwmActivity extends BaseMwmFragmentActivity @Override public void run() { - showSearchIfContainsSearchIndex(); + showSearch(); } }); break; diff --git a/android/src/com/mapswithme/maps/settings/StoragePathManager.java b/android/src/com/mapswithme/maps/settings/StoragePathManager.java index 6b3a70adcb..7a319540e7 100644 --- a/android/src/com/mapswithme/maps/settings/StoragePathManager.java +++ b/android/src/com/mapswithme/maps/settings/StoragePathManager.java @@ -67,9 +67,6 @@ public class StoragePathManager static final String TAG = StoragePathManager.class.getName(); - private static final String LITE_SDCARD_PREFIX = "Android/data/com.mapswithme.maps/files"; - private static final String SAMSUNG_LITE_SDCARD_PREFIX = "Android/data/com.mapswithme.maps.samsung/files"; - private static final String PRO_SDCARD_PREFIX = "Android/data/com.mapswithme.maps.pro/files"; private static final String IS_KML_PLACED_IN_MAIN_STORAGE = "KmlBeenMoved"; private static final String IS_KITKAT_MIGRATION_COMPLETED = "KitKatMigrationCompleted"; @@ -356,38 +353,6 @@ public class StoragePathManager listener.moveFilesFailed(UNKNOWN_KITKAT_ERROR); } - public void moveMapsLiteToPro(Context context, MoveFilesListener listener) - { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || !containsLiteMapsOnSdcard()) - return; - - final long size = StorageUtils.getWritableDirSize(); - final StorageItem currentStorage = new StorageItem(StorageUtils.getWritableDirRoot(), 0); - - // there is no need to copy maps from primary external storage(on internal device flash memory) - - // maps are stored there in root folder and pro version can simply use them - if (Environment.getExternalStorageDirectory().getAbsolutePath().equals(currentStorage.mPath)) - return; - - updateExternalStorages(); - for (StorageItem item : mItems) - { - if (item.mFreeSize > size && item.mPath.contains(PRO_SDCARD_PREFIX) && !item.mPath.equals(currentStorage.mPath)) - { - setStoragePath(context, listener, item, currentStorage, R.string.move_lite_maps_to_pro); - return; - } - } - - listener.moveFilesFailed(UNKNOWN_LITE_PRO_ERROR); - } - - private boolean containsLiteMapsOnSdcard() - { - final String storagePath = StorageUtils.getWritableDirRoot(); - return storagePath.contains(LITE_SDCARD_PREFIX) || storagePath.contains(SAMSUNG_LITE_SDCARD_PREFIX); - } - /** * Checks bookmarks and data(mwms, routing, indexes etc) locations on external storages. *

diff --git a/strings.txt b/strings.txt index 6fe28ae450..052a491d20 100644 --- a/strings.txt +++ b/strings.txt @@ -2314,38 +2314,6 @@ nb = Oppdater %@ fi = Päivitä %@ - [search_update_maps] - en = You need updated maps for search function: - tags = android - comment = Show popup notification when we have downloaded countries without search (from Lite version) - cs = Pro funkci vyhledávání musíš aktualizovat mapy: - sk = Pre funkciu vyhladávania musíte aktualizovať mapy: - de = Sie benötigen aktualisierte Karten für die Suchfunktion - es = Necesita los mapas actualizados para la función de búsqueda - fr = Il vous faut des cartes mises à jour pour la fonction de recherche : - it = Hai bisogno di mappe aggiornate per la funzione di ricerca: - ja = 検索機能を利用するにはマップを更新する必要があります - ko = 당신은 검색 기능에 대한 업데이트된지도 필요 - nl = Om de zoekfunctie te kunnen gebruiken moet u de kaarten updaten - ru = Для функции поиска необходимо обновить устаревшие карты: - uk = Для функції пошуку необхідно оновити застарілі карти: - zh-Hant = 您需要更新地圖以使用搜尋功能: - pl = Musisz posiadać zaktualizowane mapy, aby korzystać z funkcji szukania - pt = Precisa de mapas atualizados para a função de procura: - hu = Frissített térképekre lesz szüksége a kereséshez: - th = คุณจำเป็นต้องใช้แผนที่ที่มีการอัปเดตเพื่อค้นหาฟังก์ชัน: - zh-Hans = 您需要为搜索功能获取已更新的地图。 - ar = أنت بحاجة الى تحديث الخرائط من أجل وظيفة البحث: - da = Du har brug for opdaterede kort for at benytte søgefunktionen: - tr = Arama işlevi için güncellenmiş haritalara ihtiyacınız var: - sv = Du behöver uppdaterade kartor för sökfunktionen: - he = דרושות מפות מעודכנות כדי לבצע חיפוש: - id = Anda memerlukan peta terbaru untuk fungsi pencarian: - vi = Bạn cần bản đồ được cập nhật cho chức năng tìm kiếm: - ro = Aveți nevoie de hărți actualizate pentru funcția de căutare: - nb = Du trenger oppdaterte kart for søkefunksjonen: - fi = Hakutoimintoa varten tarvitset päivitetyt kartat: - [advise_update_maps] en = Update available for these maps: tags = android @@ -5897,69 +5865,6 @@ nb = Vi overfører dine nedlastede kart fra MAPS.ME Lite til MAPS.ME. Det kan ta noen minutter. fi = Me siirrämme lataamasi kartat MAPS.ME Lite:stä MAPS.ME:hen. Siirtäminen voi viedä muutaman minuutin. - [move_lite_maps_to_pro_ok] - tags = android - comment = Message to display when maps moved. - en = Your downloaded maps are successfully transferred to MAPS.ME. - cs = Tvé stažené mapy jsou úspěšně přeneseny do MAPS.ME. - sk = Vaše stiahnuté mapy sú úspešne prenesené na MAPS.ME. - de = Ihre heruntergeladenen Karten wurden erfolgreich zu MAPS.ME übertragen. - es = Tus mapas descargados se han transferido correctamente a MAPS.ME. - fr = Vos cartes téléchargées ont été transférées avec succès vers MAPS.ME. - it = Le mappe che hai scaricato sono state trasferite con successo a MAPS.ME. - ja = ダウンロード済みの地図は無事MAPS.MEに転送されました - ko = 다운로드된 지도가 성공적으로 MAPS.ME에 전송됨 - nl = Uw gedownloade kaarten werden met succes verplaatst naar MAPS.ME. - ru = Ваши карты успешно перенесены в MAPS.ME. - uk = Ваші карти успішно перенесено в MAPS.ME. - zh-Hant = 您下載的地圖已成功傳輸至MAPS.ME。 - pl = Pomyślnie przeniesiono twoje pobrane mapy do MAPS.ME. - pt = Os seus mapas descarregados estão transferidos com sucesso para a MAPS.ME. - hu = Letöltött térképeidet sikeresen áthelyeztük a MAPS.ME-be. - th = แผนที่ที่ดาวน์โหลดของคุณโอนไปยัง MAPS.ME สำเร็จ - zh-Hans = 您下载的地图已成功传输至MAPS.ME。 - ar = تم بنجاح نقل خرائطك التي تم تنزيلها إلى MAPS.ME. - da = Dine downloadede kort er blevet succesfuldt overført til MAPS.ME. - tr = İndirmiş olduğunuz haritalar başarılı bir şekilde MAPS.ME'ye aktarıldı. - sv = Dina nedladdade kartor flyttades till MAPS.ME. - he = המפות שהורדתם הועברו בהצלחה ל-MAPS.ME. - id = Peta unduhan Anda berhasil ditransfer ke MAPS.ME. - vi = Bản đồ đã tải xuống của bạn đã được chuyển thành công sang MAPS.ME. - ro = Hărțile dvs. descărcate sunt transferate cu succes către MAPS.ME. - nb = Nedlastede kart er overført til MAPS.ME. - fi = Lataamasi kartat on siirretty onnistuneesti MAPS.ME:hen. - - [move_lite_maps_to_pro_failed] - tags = android - comment = Message to display when maps move failed. - en = Your maps failed to transfer. Please delete MAPS.ME Lite and download the maps again. - cs = Tvé mapy se nepodařilo přenést. Prosím, odstraň MAPS.ME Lite a stáhni si mapy znovu. - sk = Vaše mapy sa nepodarilo preniesť. Vymažte prosím MAPS.ME Lite a stiahnite si mapy znova. - de = Ihre Karten konnten nicht übertragen werden. Bitte löschen Sie MAPS.ME Lite und laden Sie die Karten erneut herunter. - es = No se han podido transferir tus mapas. Por favor, elimina MAPS.ME Lite y descarga los mapas de nuevo. - fr = Le transfert de vos cartes a échoué. Veuillez supprimer MAPS.ME Lite et télécharger les cartes de nouveau. - it = Non è stato possibile trasferire le tue mappe. Cancella MAPS.ME Lite e scarica le mappe di nuovo. - ja = 地図の転送に失敗しました。MAPS.ME Liteを削除してから地図を再度ダウンロードしてください。 - ko = 지도를 전송하지 못했습니다. MAPS.ME Lite를 삭제하고 다시지도를 다운로드하십시오. - nl = Verplaatsing van uw kaarten mislukt. Gelieve MAPS.ME Lite te verwijderen en de kaarten opnieuw te downloaden. - ru = При переносе карт возникла ошибка. Пожалуйста, удалите MAPS.ME Lite и загрузите карты заново. - uk = При переносі карт виникла помилка. Будь ласка, видаліть MAPS.ME Lite і завантажте карти знову. - zh-Hant = 您的地圖傳輸失敗。請刪除MAPS.ME Lite,然後再次下載地圖。 - pl = Nie udało się przenieść twoich map. Proszę skasować MAPS.ME Lite i pobrać mapy ponownie. - pt = Falhou a transferência dos seus mapas. Por favor, elimine a MAPS.ME Lite e descarregue os mapas novamente. - hu = Térképeid áthelyezése nem sikerült. Kérjük, töröld a MAPS.ME Lite-t és töltsd le a térképet megint. - th = ล้มเหลวในการโอนแผนที่ของคุณ โปรดลบ MAPS.ME Lite และดาวน์โหลดแผนที่อีกครั้ง - zh-Hans = 您的地图传输失败。请删除MAPS.ME Lite,然后再次下载地图。 - ar = فشل نقل خرائطك يُرجى حذف MAPS.ME Lite وتنزيل الخرائط مرة أخرى. - da = Det lykkedes ikke at overføre dine kort. Slet venligst MAPS.ME Lite og download kortene igen. - tr = Haritanızın aktarımı başarısız oldu. Lütfen MAPS.ME Lite'yi silin ve haritaları tekrar indirin. - sv = Flytten av dina kartor misslyckades. Vänligen ta bort MAPS.ME Lite och ladda ner kartorna igen. - he = העברת המפות שלכם נכשלה. אנא מחקו את MAPS.ME Lite והורידו שוב את המפות. - id = Peta Anda gagal ditransfer. Silakan hapus MAPS.ME Lite dan unduh peta lagi. - vi = Bản đồ của bạn không chuyển được. Vui lòng xóa MAPS.ME Lite và tải xuống lại bản đồ. - nb = Kartene dine ble ikke overført. Slett MAPS.ME Lite og last ned kartene på nytt. - fi = Karttoja ei voitu siirtää. Ole hyvä ja poista MAPS.ME Lite ja lataa kartat uudelleen. - [settings_and_more] tags = ios, android comment = Text in menu @@ -13859,4 +13764,4 @@ es = ¿Alguna idea de cómo podemos mejorarla? pl = Czy masz pomysł, w jaki sposób możemy dokonać ulepszeń? nl = Heeft u suggesties voor verbeteringen? - pt = Alguma ideia sobre como podemos melhorar? \ No newline at end of file + pt = Alguma ideia sobre como podemos melhorar?