forked from organicmaps/organicmaps
[android] Add stub for skip World maps download if they are already exist (old versions).
This commit is contained in:
parent
a449916857
commit
444c745f4e
2 changed files with 35 additions and 5 deletions
|
@ -62,8 +62,8 @@ extern "C"
|
|||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_mapswithme_maps_DownloadResourcesActivity_getBytesToDownload(JNIEnv * env, jobject thiz,
|
||||
jstring apkPath, jstring sdcardPath)
|
||||
Java_com_mapswithme_maps_DownloadResourcesActivity_getBytesToDownload(
|
||||
JNIEnv * env, jobject thiz, jstring apkPath, jstring sdcardPath)
|
||||
{
|
||||
// clear all
|
||||
g_filesToDownload.clear();
|
||||
|
@ -124,6 +124,18 @@ extern "C"
|
|||
return res;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_mapswithme_maps_DownloadResourcesActivity_isWorldExists(
|
||||
JNIEnv * env, jobject thiz, jstring sdcardPath)
|
||||
{
|
||||
string const path = jni::ToNativeString(env, sdcardPath);
|
||||
|
||||
Platform & pl = GetPlatform();
|
||||
uint64_t dummy;
|
||||
return (pl.GetFileSizeByName(path + WORLD_FILE_NAME + DATA_FILE_EXTENSION, dummy) &&
|
||||
pl.GetFileSizeByName(path + WORLD_COASTS_FILE_NAME + DATA_FILE_EXTENSION, dummy));
|
||||
}
|
||||
|
||||
void DownloadFileFinished(shared_ptr<jobject> obj, downloader::HttpRequest & req)
|
||||
{
|
||||
int errorCode = 0;
|
||||
|
|
|
@ -57,6 +57,13 @@ public class DownloadResourcesActivity extends Activity implements LocationServi
|
|||
mApplication.getDataStoragePath());
|
||||
}
|
||||
|
||||
private boolean isWorldExists()
|
||||
{
|
||||
// 2.0.3 version doesn't contain WorldCoasts on sdcard. No need to check something.
|
||||
//return isWorldExists(mApplication.getDataStoragePath());
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setDownloadMessage(int bytesToDownload)
|
||||
{
|
||||
Log.d(TAG, "prepareFilesDownload, bytesToDownload:" + bytesToDownload);
|
||||
|
@ -274,7 +281,8 @@ public class DownloadResourcesActivity extends Activity implements LocationServi
|
|||
|
||||
mApplication = (MWMApplication)getApplication();
|
||||
|
||||
if (checkLiteProPackages(mApplication.isProVersion()))
|
||||
final boolean isPro = mApplication.isProVersion();
|
||||
if (checkLiteProPackages(isPro))
|
||||
return;
|
||||
|
||||
setContentView(R.layout.download_resources);
|
||||
|
@ -306,8 +314,17 @@ public class DownloadResourcesActivity extends Activity implements LocationServi
|
|||
|
||||
prepareFilesDownload();
|
||||
|
||||
if (ConnectionState.getState(this) == ConnectionState.CONNECTED_BY_WIFI)
|
||||
switch (ConnectionState.getState(this))
|
||||
{
|
||||
case ConnectionState.CONNECTED_BY_WIFI:
|
||||
onDownloadClicked(mDownloadButton);
|
||||
break;
|
||||
|
||||
case ConnectionState.NOT_CONNECTED:
|
||||
if (!isPro && isWorldExists())
|
||||
showMapView();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -417,7 +434,8 @@ public class DownloadResourcesActivity extends Activity implements LocationServi
|
|||
}
|
||||
|
||||
private native void moveMaps(String fromFolder, String toFolder);
|
||||
private native int getBytesToDownload(String m_apkPath, String m_sdcardPath);
|
||||
private native int getBytesToDownload(String apkPath, String sdcardPath);
|
||||
private native boolean isWorldExists(String path);
|
||||
private native int startNextFileDownload(Object observer);
|
||||
private native String findCountryByPos(double lat, double lon);
|
||||
private native void cancelCurrentFile();
|
||||
|
|
Loading…
Add table
Reference in a new issue