mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-04 03:06:41 -04:00
+ JNI getRandomPage()
This commit is contained in:
parent
ee19d5b834
commit
bccd1d1806
@ -13,11 +13,11 @@ import shutil
|
|||||||
from subprocess import call, check_output
|
from subprocess import call, check_output
|
||||||
|
|
||||||
# switchs for debugging purposes ; please ignore.
|
# switchs for debugging purposes ; please ignore.
|
||||||
CREATE_TOOLCHAIN = True
|
CREATE_TOOLCHAIN = False
|
||||||
COMPILE_LIBLZMA = True
|
COMPILE_LIBLZMA = False
|
||||||
COMPILE_LIBZIM = True
|
COMPILE_LIBZIM = True
|
||||||
COMPILE_LIBKIWIX = True
|
COMPILE_LIBKIWIX = True
|
||||||
STRIP_LIBKIWIX = True
|
STRIP_LIBKIWIX = False
|
||||||
COMPILE_APK = True
|
COMPILE_APK = True
|
||||||
|
|
||||||
# store the OS's environment PATH as we'll mess with it
|
# store the OS's environment PATH as we'll mess with it
|
||||||
|
21
kiwix.c
21
kiwix.c
@ -236,3 +236,24 @@ JNIEXPORT jboolean JNICALL Java_org_kiwix_kiwixmobile_JNIKiwibx_getDescription
|
|||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jboolean JNICALL Java_org_kiwix_kiwixmobile_JNIKiwibx_getRandomPage
|
||||||
|
(JNIEnv *env, jobject obj, jobject urlObj) {
|
||||||
|
jboolean retVal = JNI_FALSE;
|
||||||
|
std::string cUrl;
|
||||||
|
|
||||||
|
pthread_mutex_lock(&readerLock);
|
||||||
|
try {
|
||||||
|
if (reader != NULL) {
|
||||||
|
std::string cUrl = reader->getRandomPageUrl();
|
||||||
|
setStringObjValue(cUrl, urlObj, env);
|
||||||
|
retVal = JNI_TRUE;
|
||||||
|
}
|
||||||
|
} catch (exception &e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
pthread_mutex_unlock(&readerLock);
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -8,6 +8,7 @@ public class JNIKiwix {
|
|||||||
public native boolean getPageUrlFromTitle(String title, JNIKiwixString url);
|
public native boolean getPageUrlFromTitle(String title, JNIKiwixString url);
|
||||||
public native boolean getTitle(JNIKiwixString title);
|
public native boolean getTitle(JNIKiwixString title);
|
||||||
public native boolean getDescription(JNIKiwixString title);
|
public native boolean getDescription(JNIKiwixString title);
|
||||||
|
public native boolean getRandomPage(JNIKiwixString url);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("kiwix");
|
System.loadLibrary("kiwix");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user