forked from organicmaps/organicmaps
Lite maps transfer fix.
This commit is contained in:
parent
c9c78a5577
commit
e0fdc84672
4 changed files with 14 additions and 10 deletions
|
@ -1,6 +1,7 @@
|
|||
#include "MapStorage.hpp"
|
||||
#include "Framework.hpp"
|
||||
|
||||
#include "../../../../../coding/internal/file_data.hpp"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
@ -161,6 +162,12 @@ extern "C"
|
|||
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)
|
||||
{
|
||||
return my::RenameFileX(jni::ToNativeString(env, oldFile), jni::ToNativeString(env, newFile));
|
||||
}
|
||||
}
|
||||
|
||||
namespace storage
|
||||
|
|
|
@ -96,7 +96,6 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
|
||||
private static final String IS_KML_MOVED = "KmlBeenMoved";
|
||||
private static final String IS_KITKAT_MIGRATION_COMPLETED = "KitKatMigrationCompleted";
|
||||
private static final String ARE_LITE_MAPS_MOVED = "MapsMovedFromLite";
|
||||
|
||||
public static Intent createShowMapIntent(Context context, Index index, boolean doAutoDownload)
|
||||
{
|
||||
|
@ -403,18 +402,12 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
*/
|
||||
private void checkLiteMapsInPro()
|
||||
{
|
||||
final boolean areLiteMapsMoved = MWMApplication.get().nativeGetBoolean(ARE_LITE_MAPS_MOVED, false);
|
||||
|
||||
if (!areLiteMapsMoved &&
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
|
||||
mApplication.isProVersion() &&
|
||||
(Utils.isAppInstalled(Constants.Package.MWM_LITE_PACKAGE) || Utils.isAppInstalled(Constants.Package.MWM_SAMSUNG_PACKAGE)))
|
||||
{
|
||||
if (!mPathManager.containsLiteMapsOnSdcard())
|
||||
{
|
||||
MWMApplication.get().nativeSetBoolean(ARE_LITE_MAPS_MOVED, true);
|
||||
return;
|
||||
}
|
||||
|
||||
mPathManager.moveMapsLiteToPro(this,
|
||||
new SetStoragePathListener()
|
||||
|
@ -422,7 +415,6 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
@Override
|
||||
public void moveFilesFinished(String newPath)
|
||||
{
|
||||
mApplication.nativeSetBoolean(ARE_LITE_MAPS_MOVED, true);
|
||||
ShowAlertDlg(R.string.move_lite_maps_to_pro_ok);
|
||||
}
|
||||
|
||||
|
|
|
@ -160,6 +160,7 @@ public class MapStorage
|
|||
|
||||
private native String[] nativeGetMapsWithoutSearch();
|
||||
|
||||
public static native boolean nativeMoveFile(String oldFile, String newFile);
|
||||
|
||||
public MapStorage()
|
||||
{
|
||||
|
|
|
@ -16,6 +16,7 @@ import android.util.Log;
|
|||
|
||||
import com.mapswithme.maps.Framework;
|
||||
import com.mapswithme.maps.MWMApplication;
|
||||
import com.mapswithme.maps.MapStorage;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.util.Constants;
|
||||
import com.mapswithme.util.Utils;
|
||||
|
@ -429,7 +430,10 @@ public class StoragePathManager
|
|||
try
|
||||
{
|
||||
for (File moveFile : internalFiles)
|
||||
copyFile(moveFile, new File(fullNewPath + moveFile.getName()));
|
||||
{
|
||||
if (!MapStorage.nativeMoveFile(moveFile.getAbsolutePath(), fullNewPath + moveFile.getName()))
|
||||
copyFile(moveFile, new File(fullNewPath + moveFile.getName()));
|
||||
}
|
||||
} catch (IOException e)
|
||||
{
|
||||
for (File moveFile : internalFiles)
|
||||
|
|
Loading…
Add table
Reference in a new issue