mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 17:59:33 +02:00
synchronization with native branch
This commit is contained in:
parent
3580e2cd59
commit
09e35beb73
9 changed files with 490 additions and 0 deletions
|
@ -37,6 +37,9 @@ jmethodID AndroidUtil::MID_ZLibrary_getVersionName;
|
|||
|
||||
jmethodID AndroidUtil::SMID_PluginCollection_Instance;
|
||||
|
||||
jmethodID AndroidUtil::MID_ZLFile_size;
|
||||
jmethodID AndroidUtil::MID_ZLFile_exists;
|
||||
jmethodID AndroidUtil::MID_ZLFile_isDirectory;
|
||||
jmethodID AndroidUtil::MID_ZLFile_getPath;
|
||||
|
||||
jfieldID AndroidUtil::FID_Book_File;
|
||||
|
@ -71,6 +74,9 @@ bool AndroidUtil::init(JavaVM* jvm) {
|
|||
env->DeleteLocalRef(cls);
|
||||
|
||||
CHECK_NULL( cls = env->FindClass(Class_ZLFile) );
|
||||
CHECK_NULL( MID_ZLFile_size = env->GetMethodID(cls, "size", "()J") );
|
||||
CHECK_NULL( MID_ZLFile_exists = env->GetMethodID(cls, "exists", "()Z") );
|
||||
CHECK_NULL( MID_ZLFile_isDirectory = env->GetMethodID(cls, "isDirectory", "()Z") );
|
||||
CHECK_NULL( MID_ZLFile_getPath = env->GetMethodID(cls, "getPath", "()Ljava/lang/String;") );
|
||||
env->DeleteLocalRef(cls);
|
||||
|
||||
|
@ -86,6 +92,15 @@ bool AndroidUtil::init(JavaVM* jvm) {
|
|||
env->DeleteLocalRef(cls);
|
||||
}
|
||||
|
||||
jobject AndroidUtil::createZLFile(JNIEnv *env, const std::string &path) {
|
||||
jstring javaPath = env->NewStringUTF(path.c_str());
|
||||
jclass cls = env->FindClass(Class_ZLFile);
|
||||
jobject javaFile = env->CallStaticObjectMethod(cls, SMID_ZLFile_createFileByPath, javaPath);
|
||||
env->DeleteLocalRef(cls);
|
||||
env->DeleteLocalRef(javaPath);
|
||||
return javaFile;
|
||||
}
|
||||
|
||||
bool AndroidUtil::extractJavaString(JNIEnv *env, jstring from, std::string &to) {
|
||||
if (from == 0) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue