mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-19 04:16:27 -04:00
Android ZIM file size is displayed correctly for split ZIMs #329
This commit is contained in:
parent
1750fa90b1
commit
792452e4ef
17
kiwix.c
17
kiwix.c
@ -109,6 +109,23 @@ JNIEXPORT jstring JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getId(JNIEnv *env,
|
||||
return id;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getFileSize(JNIEnv *env, jobject obj) {
|
||||
jint size;
|
||||
|
||||
pthread_mutex_lock(&readerLock);
|
||||
if (reader != NULL) {
|
||||
try {
|
||||
int cSize = reader->getFileSize();
|
||||
size = c2jni(cSize);
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&readerLock);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getCreator(JNIEnv *env, jobject obj) {
|
||||
jstring creator;
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -55,7 +55,7 @@ public class JNIKiwix {
|
||||
|
||||
public native String getPublisher();
|
||||
|
||||
public native boolean getFileSize(JNIKiwixInt size);
|
||||
public native int getFileSize();
|
||||
|
||||
public native int getArticleCount();
|
||||
|
||||
|
@ -102,6 +102,14 @@ public class ZimContentProvider extends ContentProvider {
|
||||
}
|
||||
}
|
||||
|
||||
public static int getFileSize() {
|
||||
if (jniKiwix == null || zimFileName == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return jniKiwix.getFileSize();
|
||||
}
|
||||
}
|
||||
|
||||
public static int getArticleCount() {
|
||||
if (jniKiwix == null || zimFileName == null) {
|
||||
return 0;
|
||||
|
@ -148,7 +148,7 @@ public class FileSearch {
|
||||
b.title = ZimContentProvider.getZimFileTitle();
|
||||
b.id = ZimContentProvider.getId();
|
||||
b.file = new File(file);
|
||||
b.size = String.valueOf(b.file.length() / 1024);
|
||||
b.size = String.valueOf(ZimContentProvider.getFileSize());
|
||||
b.favicon = ZimContentProvider.getFavicon();
|
||||
b.creator = ZimContentProvider.getCreator();
|
||||
b.publisher = ZimContentProvider.getPublisher();
|
||||
|
Loading…
x
Reference in New Issue
Block a user