Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Yunitsky <yunik@mapswithme.com>2015-09-11 12:59:55 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 03:04:32 +0300
commitd932e21976010a4acd56dc4bf712adf3bedaf435 (patch)
tree0fae39d944f4c20100986edcb814b7000d38fb0d /android
parent5b3cd853c51d029b5073ba6922709086b5650dfc (diff)
[android] Removed old code.
Diffstat (limited to 'android')
-rw-r--r--android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp12
-rw-r--r--android/jni/com/mapswithme/maps/Framework.cpp37
-rw-r--r--android/jni/com/mapswithme/maps/Framework.hpp2
-rw-r--r--android/jni/com/mapswithme/maps/MapStorage.cpp16
-rw-r--r--android/src/com/mapswithme/maps/MapStorage.java103
-rw-r--r--android/src/com/mapswithme/maps/MwmActivity.java75
-rw-r--r--android/src/com/mapswithme/maps/settings/StoragePathManager.java35
7 files changed, 1 insertions, 279 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<string> & 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<LocalCountryFile> 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<string> & 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<string> v;
- g_framework->GetMapsWithoutSearch(v);
-
- jclass klass = env->FindClass("java/lang/String");
- ASSERT ( klass, () );
-
- int const count = static_cast<int>(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.
* <p/>