mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-08 23:07:26 -04:00
Merge branch 'master' into fix-library-report
This commit is contained in:
commit
d99c5826ad
@ -1,15 +1,5 @@
|
||||
package org.kiwix.kiwixmobile.utils;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.os.StatFs;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.UUID;
|
||||
|
||||
public class StorageUtils {
|
||||
|
||||
public static String getFileNameFromUrl(String url) {
|
||||
|
@ -181,17 +181,24 @@ public class FileSearch {
|
||||
// This is not a great solution as we shouldn't need to fully open our ZIM files to get their metadata
|
||||
if (ZimContentProvider.canIterate) {
|
||||
if (ZimContentProvider.setZimFile(filePath) != null) {
|
||||
book = new LibraryNetworkEntity.Book();
|
||||
book.title = ZimContentProvider.getZimFileTitle();
|
||||
book.id = ZimContentProvider.getId();
|
||||
book.file = new File(filePath);
|
||||
book.size = String.valueOf(ZimContentProvider.getFileSize());
|
||||
book.favicon = ZimContentProvider.getFavicon();
|
||||
book.creator = ZimContentProvider.getCreator();
|
||||
book.publisher = ZimContentProvider.getPublisher();
|
||||
book.date = ZimContentProvider.getDate();
|
||||
book.description = ZimContentProvider.getDescription();
|
||||
book.language = ZimContentProvider.getLanguage();
|
||||
try {
|
||||
book = new LibraryNetworkEntity.Book();
|
||||
book.title = ZimContentProvider.getZimFileTitle();
|
||||
book.id = ZimContentProvider.getId();
|
||||
book.file = new File(filePath);
|
||||
book.size = String.valueOf(ZimContentProvider.getFileSize());
|
||||
book.favicon = ZimContentProvider.getFavicon();
|
||||
book.creator = ZimContentProvider.getCreator();
|
||||
book.publisher = ZimContentProvider.getPublisher();
|
||||
book.date = ZimContentProvider.getDate();
|
||||
book.description = ZimContentProvider.getDescription();
|
||||
book.language = ZimContentProvider.getLanguage();
|
||||
} catch (Exception e) {
|
||||
// TODO 20171215 Consider more elegant approaches.
|
||||
// This is to see if we can catch the exception at all!
|
||||
Log.e("kiwix-filesearch", "Problem parsing a book entry from the library file. ", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Return content provider to its previous state
|
||||
|
@ -62,7 +62,8 @@
|
||||
<org.kiwix.kiwixmobile.settings.CustomSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="pref_wifi_only"
|
||||
android:title="@string/pref_wifi_only"/>
|
||||
android:title="@string/pref_wifi_only"
|
||||
android:summary="@string/pref_wifi_only"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
|
Loading…
x
Reference in New Issue
Block a user