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