forked from organicmaps/organicmaps
[new downloader][android] fix: Review fixes.
This commit is contained in:
parent
28681d7f20
commit
fe8f1ea028
4 changed files with 14 additions and 21 deletions
|
@ -43,12 +43,13 @@ struct FileToDownload
|
|||
uint64_t m_fileSize;
|
||||
};
|
||||
|
||||
//static string g_apkPath;
|
||||
//static string g_sdcardPath;
|
||||
namespace
|
||||
{
|
||||
static vector<FileToDownload> g_filesToDownload;
|
||||
static int g_totalDownloadedBytes;
|
||||
static int g_totalBytesToDownload;
|
||||
static shared_ptr<HttpRequest> g_currentRequest;
|
||||
} // namespace
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
@ -171,8 +172,8 @@ extern "C"
|
|||
FileToDownload & curFile = g_filesToDownload.back();
|
||||
|
||||
JNIEnv * env = jni::GetEnv();
|
||||
static jmethodID methodID = jni::GetMethodID(env, *listener.get(), "onProgress", "(I)V");
|
||||
env->CallVoidMethod(*listener.get(), methodID, static_cast<jint>(g_totalDownloadedBytes + req.Progress().first));
|
||||
static jmethodID methodID = jni::GetMethodID(env, *listener, "onProgress", "(I)V");
|
||||
env->CallVoidMethod(*listener, methodID, static_cast<jint>(g_totalDownloadedBytes + req.Progress().first));
|
||||
}
|
||||
|
||||
static void DownloadURLListFinished(HttpRequest const & req, TCallback const & onFinish, TCallback const & onProgress)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "std/bind.hpp"
|
||||
#include "std/shared_ptr.hpp"
|
||||
|
||||
namespace data
|
||||
namespace
|
||||
{
|
||||
|
||||
using namespace storage;
|
||||
|
@ -21,9 +21,9 @@ enum ItemCategory : uint32_t
|
|||
ALL,
|
||||
};
|
||||
|
||||
jclass g_listClass;
|
||||
jmethodID g_listAddMethod;
|
||||
jclass g_countryItemClass;
|
||||
jobject g_countryChangedListener;
|
||||
|
||||
Storage & GetStorage()
|
||||
{
|
||||
|
@ -32,23 +32,18 @@ Storage & GetStorage()
|
|||
|
||||
void PrepareClassRefs(JNIEnv * env)
|
||||
{
|
||||
if (g_listClass)
|
||||
if (g_listAddMethod)
|
||||
return;
|
||||
|
||||
g_listClass = jni::GetGlobalClassRef(env, "java/util/List");
|
||||
g_listAddMethod = env->GetMethodID(g_listClass, "add", "(Ljava/lang/Object;)Z");
|
||||
jclass listClass = env->FindClass("java/util/List");
|
||||
g_listAddMethod = env->GetMethodID(listClass, "add", "(Ljava/lang/Object;)Z");
|
||||
g_countryItemClass = jni::GetGlobalClassRef(env, "com/mapswithme/maps/downloader/CountryItem");
|
||||
}
|
||||
|
||||
} // namespace data
|
||||
} // namespace
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
using namespace storage;
|
||||
using namespace data;
|
||||
|
||||
|
||||
// static boolean nativeMoveFile(String oldFile, String newFile);
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_mapswithme_maps_MapStorage_nativeMoveFile(JNIEnv * env, jclass clazz, jstring oldFile, jstring newFile)
|
||||
|
@ -308,8 +303,6 @@ Java_com_mapswithme_maps_downloader_MapManager_nativeUnsubscribe(JNIEnv * env, j
|
|||
GetStorage().Unsubscribe(slot);
|
||||
}
|
||||
|
||||
static jobject g_countryChangedListener;
|
||||
|
||||
// static void nativeSubscribeOnCountryChanged(CurrentCountryChangedListener listener);
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_downloader_MapManager_nativeSubscribeOnCountryChanged(JNIEnv * env, jclass clazz, jobject listener)
|
||||
|
|
|
@ -9,7 +9,6 @@ namespace android
|
|||
class Platform : public ::Platform
|
||||
{
|
||||
public:
|
||||
Platform() {}
|
||||
void Initialize(JNIEnv * env,
|
||||
jobject functorProcessObject,
|
||||
jstring apkPath, jstring storagePath,
|
||||
|
|
|
@ -85,7 +85,7 @@ public class DownloadResourcesActivity extends BaseMwmFragmentActivity
|
|||
@SuppressWarnings("unused")
|
||||
private interface Listener
|
||||
{
|
||||
void onProgress(int progress);
|
||||
void onProgress(int percent);
|
||||
void onFinish(int errorCode);
|
||||
}
|
||||
|
||||
|
@ -152,10 +152,10 @@ public class DownloadResourcesActivity extends BaseMwmFragmentActivity
|
|||
private final Listener mResourcesDownloadListener = new Listener()
|
||||
{
|
||||
@Override
|
||||
public void onProgress(final int progress)
|
||||
public void onProgress(final int percent)
|
||||
{
|
||||
if (!isFinishing())
|
||||
mProgress.setProgress(progress);
|
||||
mProgress.setProgress(percent);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue