mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-16 02:48:08 -04:00
#1259 update to latest library, integrate with api changes
This commit is contained in:
parent
cb2e89a89f
commit
3d7e2232d9
@ -50,8 +50,8 @@ dependencies {
|
||||
implementation("com.jakewharton.threetenabp:threetenabp:1.1.1")
|
||||
|
||||
// Get kiwixlib online if it is not populated locally
|
||||
if (!file("./libs").exists()) {
|
||||
implementation 'org.kiwix.kiwixlib:kiwixlib:5.2.0'
|
||||
if (!shouldUseLocalVersion()) {
|
||||
implementation 'org.kiwix.kiwixlib:kiwixlib:6.0.0'
|
||||
} else {
|
||||
implementation 'com.getkeepsafe.relinker:relinker:1.3.1'
|
||||
implementation fileTree(include: ['*.aar'], dir: 'libs')
|
||||
@ -125,7 +125,6 @@ dependencies {
|
||||
// Leak canary
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-alpha-2'
|
||||
|
||||
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
|
||||
implementation "android.arch.lifecycle:extensions:1.1.1"
|
||||
implementation "io.objectbox:objectbox-kotlin:$objectboxVersion"
|
||||
@ -138,6 +137,10 @@ dependencies {
|
||||
testImplementation 'androidx.arch.core:core-testing:2.0.1'
|
||||
}
|
||||
|
||||
private boolean shouldUseLocalVersion() {
|
||||
file("./libs").exists()
|
||||
}
|
||||
|
||||
// Set custom app import directory
|
||||
def map = [:]
|
||||
def custom = new File("app/src")
|
||||
|
@ -125,7 +125,7 @@ public class ZimContentProvider extends ContentProvider {
|
||||
*
|
||||
* Note that the value returned is NOT unique for each zim file. Versions of the same wiki
|
||||
* (complete, nopic, novid, etc) may return the same title.
|
||||
* */
|
||||
*/
|
||||
public static String getZimFileTitle() {
|
||||
if (currentJNIReader == null || zimFileName == null) {
|
||||
return null;
|
||||
@ -409,10 +409,8 @@ public class ZimContentProvider extends ContentProvider {
|
||||
String fileName = uri.toString();
|
||||
fileName = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.length());
|
||||
File f = new File(FileUtils.getFileCacheDir(getContext()), fileName);
|
||||
JNIKiwixString mime = new JNIKiwixString();
|
||||
JNIKiwixString title = new JNIKiwixString();
|
||||
JNIKiwixInt size = new JNIKiwixInt();
|
||||
byte[] data = currentJNIReader.getContent(filePath, title, mime, size);
|
||||
byte[] data = currentJNIReader.getContent(new JNIKiwixString(filePath), new JNIKiwixString(),
|
||||
new JNIKiwixString(), new JNIKiwixInt());
|
||||
FileOutputStream out = new FileOutputStream(f);
|
||||
out.write(data, 0, data.length);
|
||||
out.flush();
|
||||
@ -473,10 +471,10 @@ public class ZimContentProvider extends ContentProvider {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
JNIKiwixString mime = new JNIKiwixString();
|
||||
JNIKiwixString title = new JNIKiwixString();
|
||||
JNIKiwixInt size = new JNIKiwixInt();
|
||||
byte[] data = currentJNIReader.getContent(articleZimUrl, title, mime, size);
|
||||
final JNIKiwixString mime = new JNIKiwixString();
|
||||
final JNIKiwixInt size = new JNIKiwixInt();
|
||||
final JNIKiwixString url = new JNIKiwixString(this.articleZimUrl);
|
||||
byte[] data = currentJNIReader.getContent(url, new JNIKiwixString(), mime, size);
|
||||
if (mime.value != null && mime.value.equals("text/css") && MainActivity.nightMode) {
|
||||
out.write(("img, video { \n" +
|
||||
" -webkit-filter: invert(1); \n" +
|
||||
@ -486,7 +484,7 @@ public class ZimContentProvider extends ContentProvider {
|
||||
out.write(data, 0, data.length);
|
||||
out.flush();
|
||||
|
||||
Log.d(TAG_KIWIX, "reading " + articleZimUrl
|
||||
Log.d(TAG_KIWIX, "reading " + url.value
|
||||
+ "(mime: " + mime.value + ", size: " + size.value + ") finished.");
|
||||
} catch (IOException | NullPointerException e) {
|
||||
Log.e(TAG_KIWIX, "Exception reading article " + articleZimUrl + " from zim file",
|
||||
|
Loading…
x
Reference in New Issue
Block a user