forked from organicmaps/organicmaps
[AND] try to copy maps on KitKat on every application start, if doesn't copy it's later
This commit is contained in:
parent
e6b3fd2f0d
commit
83ae643861
3 changed files with 23 additions and 13 deletions
|
@ -343,8 +343,8 @@
|
|||
<string name="placepage_coordinates">Coordinates</string>
|
||||
<string name="placepage_unsorted">Unsorted</string>
|
||||
<string name="search_show_on_map">View on map</string>
|
||||
<string name="kitkat_migrate_ok">All maps been copyed</string>
|
||||
<string name="kitkat_migrate_ok">All maps been copyed. You can delete MapsWithMe folder from your sdcard</string>
|
||||
<string name="kitkat_migrate_filed">Not enough space for maps</string>
|
||||
<string name="bookmark_move_fail">Not enough space for bookmarks</string>
|
||||
<string name="kitkat_optimization_in_progress">Optimization. Please wait</string>
|
||||
<string name="kitkat_optimization_in_progress">Optimization. This can take several minutes.\nPlease wait…</string>
|
||||
</resources>
|
||||
|
|
|
@ -334,26 +334,35 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
private void checkKitkatMigrationMove()
|
||||
{
|
||||
final String KmlMovedFlag = "KmlBeenMoved";
|
||||
if (MWMApplication.get().nativeGetBoolean(KmlMovedFlag, false))
|
||||
return;
|
||||
|
||||
Log.i(TAG, "Check kml move called");
|
||||
if (StoragePathManager.MoveBookmarks())
|
||||
final String KitKatMigrationCompleted = "KitKatMigrationCompleted";
|
||||
boolean kmlMoved = MWMApplication.get().nativeGetBoolean(KmlMovedFlag, false);
|
||||
boolean mapsCpy = MWMApplication.get().nativeGetBoolean(KitKatMigrationCompleted, false);
|
||||
|
||||
if (!kmlMoved)
|
||||
{
|
||||
if (StoragePathManager.MoveBookmarks())
|
||||
MWMApplication.get().nativeSetBoolean(KmlMovedFlag, true);
|
||||
else
|
||||
{
|
||||
ShowAlertDlg(R.string.bookmark_move_fail);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mapsCpy)
|
||||
{
|
||||
MWMApplication.get().nativeSetBoolean(KmlMovedFlag, true);
|
||||
SetStoragePathListener listener = new SetStoragePathListener()
|
||||
{
|
||||
@Override
|
||||
public void MoveFilesFinished(String newPath)
|
||||
{
|
||||
ShowAlertDlg(R.string.kitkat_migrate_ok);
|
||||
MWMApplication.get().nativeSetBoolean(KitKatMigrationCompleted, true);
|
||||
ShowAlertDlg(R.string.kitkat_migrate_ok);
|
||||
}
|
||||
};
|
||||
if (StoragePathManager.CheckWritableDir(this, listener) == false)
|
||||
ShowAlertDlg(R.string.kitkat_migrate_filed);
|
||||
}
|
||||
else
|
||||
ShowAlertDlg(R.string.bookmark_move_fail);
|
||||
}
|
||||
|
||||
private void checkUpdateMaps()
|
||||
|
|
|
@ -149,8 +149,9 @@ public class StoragePathManager
|
|||
f.delete();
|
||||
return true;
|
||||
}
|
||||
|
||||
ArrayList<StorageItem> items = GetStorages(context, writableDir, settingsDir);
|
||||
|
||||
ArrayList<StorageItem> items = GetStorages(context, writableDir.replace(MWM_DIR_POSTFIX, ""),
|
||||
settingsDir.replace(MWM_DIR_POSTFIX, ""));
|
||||
long size = getDirSizeImpl(writableDir);
|
||||
for (StorageItem item : items)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue