mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-08 06:42:21 -04:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
fea4a6a9ad
@ -169,7 +169,7 @@ LIBICU_INCLUDES = [os.path.join(LIBICU_SRC, 'i18n'), os.path.join(LIBICU_SRC, 'c
|
|||||||
|
|
||||||
# root folder for libzim
|
# root folder for libzim
|
||||||
LIBZIM_SRC = os.path.join(os.path.dirname(CURRENT_PATH),
|
LIBZIM_SRC = os.path.join(os.path.dirname(CURRENT_PATH),
|
||||||
'src', 'zimlib')
|
'src', 'dependencies', 'zimlib-1.1')
|
||||||
|
|
||||||
# headers for libzim
|
# headers for libzim
|
||||||
LIBZIM_INCLUDES = [os.path.join(LIBZIM_SRC, 'include')]
|
LIBZIM_INCLUDES = [os.path.join(LIBZIM_SRC, 'include')]
|
||||||
|
17
kiwix.c
17
kiwix.c
@ -81,6 +81,23 @@ JNIEXPORT jstring JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getMainPage(JNIEnv
|
|||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jstring JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getId(JNIEnv *env, jobject obj) {
|
||||||
|
jstring id;
|
||||||
|
|
||||||
|
pthread_mutex_lock(&readerLock);
|
||||||
|
if (reader != NULL) {
|
||||||
|
try {
|
||||||
|
std::string cId = reader->getId();
|
||||||
|
id = c2jni(cId, env);
|
||||||
|
} catch (exception &e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pthread_mutex_unlock(&readerLock);
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_loadZIM(JNIEnv *env, jobject obj, jstring path) {
|
JNIEXPORT jboolean JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_loadZIM(JNIEnv *env, jobject obj, jstring path) {
|
||||||
jboolean retVal = JNI_TRUE;
|
jboolean retVal = JNI_TRUE;
|
||||||
std::string cPath = jni2c(path, env);
|
std::string cPath = jni2c(path, env);
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,6 +1,7 @@
|
|||||||
package org.kiwix.kiwixmobile;
|
package org.kiwix.kiwixmobile;
|
||||||
public class JNIKiwix {
|
public class JNIKiwix {
|
||||||
public native String getMainPage();
|
public native String getMainPage();
|
||||||
|
public native String getId();
|
||||||
public native boolean loadZIM(String path);
|
public native boolean loadZIM(String path);
|
||||||
public native byte[] getContent(String url, JNIKiwixString mimeType, JNIKiwixInt size);
|
public native byte[] getContent(String url, JNIKiwixString mimeType, JNIKiwixInt size);
|
||||||
public native boolean searchSuggestions(String prefix, int count);
|
public native boolean searchSuggestions(String prefix, int count);
|
||||||
|
@ -66,6 +66,14 @@ public class ZimContentProvider extends ContentProvider {
|
|||||||
return jniKiwix.getMainPage();
|
return jniKiwix.getMainPage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getId() {
|
||||||
|
if (jniKiwix==null || zimFileName==null)
|
||||||
|
return null;
|
||||||
|
else {
|
||||||
|
return jniKiwix.getId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean searchSuggestions(String prefix, int count) {
|
public static boolean searchSuggestions(String prefix, int count) {
|
||||||
if (jniKiwix==null || zimFileName==null)
|
if (jniKiwix==null || zimFileName==null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user