Minor fixes and improvements. Dependency updates. Drop support for the old armeabi and use arm64-v8a instead
This commit is contained in:
parent
e22b1661f4
commit
2230ad59f1
@ -30,7 +30,7 @@ ext {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 25
|
compileSdkVersion 25
|
||||||
buildToolsVersion "25.0.1"
|
buildToolsVersion "25.0.2"
|
||||||
publishNonDefault true
|
publishNonDefault true
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
@ -48,7 +48,7 @@ android {
|
|||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters "armeabi", "armeabi-v7a", "x86"
|
abiFilters "armeabi-v7a", "arm64-v8a", "x86"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
// Modified dependencies
|
// Modified dependencies
|
||||||
compile 'com.github.inorichi:subsampling-scale-image-view:41e76b5'
|
compile 'com.github.inorichi:subsampling-scale-image-view:8a22092'
|
||||||
compile 'com.github.inorichi:junrar-android:634c1f5'
|
compile 'com.github.inorichi:junrar-android:634c1f5'
|
||||||
|
|
||||||
// Android support library
|
// Android support library
|
||||||
@ -117,13 +117,13 @@ dependencies {
|
|||||||
|
|
||||||
// ReactiveX
|
// ReactiveX
|
||||||
compile 'io.reactivex:rxandroid:1.2.1'
|
compile 'io.reactivex:rxandroid:1.2.1'
|
||||||
compile 'io.reactivex:rxjava:1.2.5'
|
compile 'io.reactivex:rxjava:1.2.6'
|
||||||
compile 'com.jakewharton.rxrelay:rxrelay:1.2.0'
|
compile 'com.jakewharton.rxrelay:rxrelay:1.2.0'
|
||||||
compile 'com.f2prateek.rx.preferences:rx-preferences:1.0.2'
|
compile 'com.f2prateek.rx.preferences:rx-preferences:1.0.2'
|
||||||
compile 'com.github.pwittchen:reactivenetwork:0.7.0'
|
compile 'com.github.pwittchen:reactivenetwork:0.7.0'
|
||||||
|
|
||||||
// Network client
|
// Network client
|
||||||
compile "com.squareup.okhttp3:okhttp:3.5.0"
|
compile "com.squareup.okhttp3:okhttp:3.6.0"
|
||||||
compile 'com.squareup.okio:okio:1.11.0'
|
compile 'com.squareup.okio:okio:1.11.0'
|
||||||
|
|
||||||
// REST
|
// REST
|
||||||
@ -150,14 +150,14 @@ dependencies {
|
|||||||
compile 'org.jsoup:jsoup:1.10.2'
|
compile 'org.jsoup:jsoup:1.10.2'
|
||||||
|
|
||||||
// Job scheduling
|
// Job scheduling
|
||||||
compile 'com.evernote:android-job:1.1.4'
|
compile 'com.evernote:android-job:1.1.6'
|
||||||
compile 'com.google.android.gms:play-services-gcm:10.0.1'
|
compile 'com.google.android.gms:play-services-gcm:10.0.1'
|
||||||
|
|
||||||
// Changelog
|
// Changelog
|
||||||
compile 'com.github.gabrielemariotti.changeloglib:changelog:2.1.0'
|
compile 'com.github.gabrielemariotti.changeloglib:changelog:2.1.0'
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
compile "com.pushtorefresh.storio:sqlite:1.12.1"
|
compile "com.pushtorefresh.storio:sqlite:1.12.2"
|
||||||
|
|
||||||
// Model View Presenter
|
// Model View Presenter
|
||||||
final nucleus_version = '3.0.0'
|
final nucleus_version = '3.0.0'
|
||||||
@ -175,7 +175,7 @@ dependencies {
|
|||||||
compile 'jp.wasabeef:glide-transformations:2.0.1'
|
compile 'jp.wasabeef:glide-transformations:2.0.1'
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
compile 'com.jakewharton.timber:timber:4.5.0'
|
compile 'com.jakewharton.timber:timber:4.5.1'
|
||||||
|
|
||||||
// Crash reports
|
// Crash reports
|
||||||
compile 'ch.acra:acra:4.9.2'
|
compile 'ch.acra:acra:4.9.2'
|
||||||
@ -190,8 +190,8 @@ dependencies {
|
|||||||
compile 'com.github.inorichi:FlexibleAdapter:93985fe' // v4.2.0 to be removed
|
compile 'com.github.inorichi:FlexibleAdapter:93985fe' // v4.2.0 to be removed
|
||||||
compile 'com.nononsenseapps:filepicker:2.5.2'
|
compile 'com.nononsenseapps:filepicker:2.5.2'
|
||||||
compile 'com.github.amulyakhare:TextDrawable:558677e'
|
compile 'com.github.amulyakhare:TextDrawable:558677e'
|
||||||
compile 'com.afollestad.material-dialogs:core:0.9.2.3'
|
compile 'com.afollestad.material-dialogs:core:0.9.3.0'
|
||||||
compile 'net.xpece.android:support-preference:1.2.2'
|
compile 'net.xpece.android:support-preference:1.2.5'
|
||||||
compile 'me.zhanghai.android.systemuihelper:library:1.0.0'
|
compile 'me.zhanghai.android.systemuihelper:library:1.0.0'
|
||||||
compile 'de.hdodenhof:circleimageview:2.1.0'
|
compile 'de.hdodenhof:circleimageview:2.1.0'
|
||||||
|
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
package eu.kanade.tachiyomi.data.glide
|
||||||
|
|
||||||
|
import com.bumptech.glide.Priority
|
||||||
|
import com.bumptech.glide.load.data.DataFetcher
|
||||||
|
import java.io.File
|
||||||
|
import java.io.IOException
|
||||||
|
import java.io.InputStream
|
||||||
|
|
||||||
|
open class FileFetcher(private val file: File) : DataFetcher<InputStream> {
|
||||||
|
|
||||||
|
private var data: InputStream? = null
|
||||||
|
|
||||||
|
override fun loadData(priority: Priority): InputStream {
|
||||||
|
data = file.inputStream()
|
||||||
|
return data!!
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun cleanup() {
|
||||||
|
data?.let { data ->
|
||||||
|
try {
|
||||||
|
data.close()
|
||||||
|
} catch (e: IOException) {
|
||||||
|
// Ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun cancel() {
|
||||||
|
// Do nothing.
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getId(): String {
|
||||||
|
return file.toString()
|
||||||
|
}
|
||||||
|
}
|
@ -1,29 +1,18 @@
|
|||||||
package eu.kanade.tachiyomi.data.glide
|
package eu.kanade.tachiyomi.data.glide
|
||||||
|
|
||||||
import com.bumptech.glide.Priority
|
|
||||||
import com.bumptech.glide.load.data.DataFetcher
|
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.InputStream
|
|
||||||
|
|
||||||
class MangaFileFetcher(private val fetcher: DataFetcher<InputStream>,
|
open class MangaFileFetcher(private val file: File, private val manga: Manga) : FileFetcher(file) {
|
||||||
private val file: File,
|
|
||||||
private val manga: Manga) : DataFetcher<InputStream> {
|
|
||||||
|
|
||||||
|
|
||||||
override fun loadData(priority: Priority?): InputStream? {
|
|
||||||
return fetcher.loadData(priority)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the id for this manga's cover.
|
||||||
|
*
|
||||||
|
* Appending the file's modified date to the url, we can force Glide to skip its memory and disk
|
||||||
|
* lookup step and fetch from our custom cache. This allows us to invalidate Glide's cache when
|
||||||
|
* the file has changed. If the file doesn't exist it will append a 0.
|
||||||
|
*/
|
||||||
override fun getId(): String {
|
override fun getId(): String {
|
||||||
return manga.thumbnail_url + file.lastModified()
|
return manga.thumbnail_url + file.lastModified()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun cancel() {
|
|
||||||
fetcher.cancel()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun cleanup() {
|
|
||||||
fetcher.cleanup()
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -44,12 +44,6 @@ class MangaModelLoader(context: Context) : StreamModelLoader<Manga> {
|
|||||||
private val baseUrlLoader = Glide.buildModelLoader(GlideUrl::class.java,
|
private val baseUrlLoader = Glide.buildModelLoader(GlideUrl::class.java,
|
||||||
InputStream::class.java, context)
|
InputStream::class.java, context)
|
||||||
|
|
||||||
/**
|
|
||||||
* Base file loader.
|
|
||||||
*/
|
|
||||||
private val baseFileLoader = Glide.buildModelLoader(File::class.java,
|
|
||||||
InputStream::class.java, context)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LRU cache whose key is the thumbnail url of the manga, and the value contains the request url
|
* LRU cache whose key is the thumbnail url of the manga, and the value contains the request url
|
||||||
* and the file where it should be stored in case the manga is a favorite.
|
* and the file where it should be stored in case the manga is a favorite.
|
||||||
@ -109,11 +103,8 @@ class MangaModelLoader(context: Context) : StreamModelLoader<Manga> {
|
|||||||
// Get the file from the url, removing the scheme if present.
|
// Get the file from the url, removing the scheme if present.
|
||||||
val file = File(url.substringAfter("file://"))
|
val file = File(url.substringAfter("file://"))
|
||||||
|
|
||||||
// Get the resource fetcher for the given file.
|
|
||||||
val fileFetcher = baseFileLoader.getResourceFetcher(file, width, height)
|
|
||||||
|
|
||||||
// Return an instance of the fetcher providing the needed elements.
|
// Return an instance of the fetcher providing the needed elements.
|
||||||
return MangaFileFetcher(fileFetcher, file, manga)
|
return MangaFileFetcher(file, manga)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,10 +21,9 @@ import java.io.InputStream
|
|||||||
class MangaUrlFetcher(private val networkFetcher: DataFetcher<InputStream>,
|
class MangaUrlFetcher(private val networkFetcher: DataFetcher<InputStream>,
|
||||||
private val file: File,
|
private val file: File,
|
||||||
private val manga: Manga)
|
private val manga: Manga)
|
||||||
: DataFetcher<InputStream> {
|
: MangaFileFetcher(file, manga) {
|
||||||
|
|
||||||
@Throws(Exception::class)
|
override fun loadData(priority: Priority): InputStream {
|
||||||
override fun loadData(priority: Priority): InputStream? {
|
|
||||||
if (manga.favorite) {
|
if (manga.favorite) {
|
||||||
synchronized(file) {
|
synchronized(file) {
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
@ -51,7 +50,7 @@ class MangaUrlFetcher(private val networkFetcher: DataFetcher<InputStream>,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return file.inputStream()
|
return super.loadData(priority)
|
||||||
} else {
|
} else {
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
file.delete()
|
file.delete()
|
||||||
@ -60,22 +59,12 @@ class MangaUrlFetcher(private val networkFetcher: DataFetcher<InputStream>,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the id for this manga's cover.
|
|
||||||
*
|
|
||||||
* Appending the file's modified date to the url, we can force Glide to skip its memory and disk
|
|
||||||
* lookup step and fetch from our custom cache. This allows us to invalidate Glide's cache when
|
|
||||||
* the file has changed. If the file doesn't exist it will append a 0.
|
|
||||||
*/
|
|
||||||
override fun getId(): String {
|
|
||||||
return manga.thumbnail_url + file.lastModified()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun cancel() {
|
override fun cancel() {
|
||||||
networkFetcher.cancel()
|
networkFetcher.cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun cleanup() {
|
override fun cleanup() {
|
||||||
|
super.cleanup()
|
||||||
networkFetcher.cleanup()
|
networkFetcher.cleanup()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ class LibraryPresenter : BasePresenter<LibraryFragment>() {
|
|||||||
*/
|
*/
|
||||||
private fun applyFilters(map: Map<Int, List<Manga>>): Map<Int, List<Manga>> {
|
private fun applyFilters(map: Map<Int, List<Manga>>): Map<Int, List<Manga>> {
|
||||||
// Cached list of downloaded manga directories given a source id.
|
// Cached list of downloaded manga directories given a source id.
|
||||||
val mangaDirectories = mutableMapOf<Long, Array<UniFile>>()
|
val mangaDirsForSource = mutableMapOf<Long, Map<String?, UniFile>>()
|
||||||
|
|
||||||
// Cached list of downloaded chapter directories for a manga.
|
// Cached list of downloaded chapter directories for a manga.
|
||||||
val chapterDirectories = mutableMapOf<Long, Boolean>()
|
val chapterDirectories = mutableMapOf<Long, Boolean>()
|
||||||
@ -147,15 +147,17 @@ class LibraryPresenter : BasePresenter<LibraryFragment>() {
|
|||||||
|
|
||||||
// Filter when the download directory doesn't exist or is null.
|
// Filter when the download directory doesn't exist or is null.
|
||||||
if (filterDownloaded) {
|
if (filterDownloaded) {
|
||||||
val mangaDirs = mangaDirectories.getOrPut(source.id) {
|
// Get the directories for the source of the manga.
|
||||||
downloadManager.findSourceDir(source)?.listFiles() ?: emptyArray()
|
val dirsForSource = mangaDirsForSource.getOrPut(source.id) {
|
||||||
|
val sourceDir = downloadManager.findSourceDir(source)
|
||||||
|
sourceDir?.listFiles()?.associateBy { it.name }.orEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
val mangaDirName = downloadManager.getMangaDirName(manga)
|
val mangaDirName = downloadManager.getMangaDirName(manga)
|
||||||
val mangaDir = mangaDirs.find { it.name == mangaDirName } ?: return@f false
|
val mangaDir = dirsForSource[mangaDirName] ?: return@f false
|
||||||
|
|
||||||
val hasDirs = chapterDirectories.getOrPut(manga.id!!) {
|
val hasDirs = chapterDirectories.getOrPut(manga.id!!) {
|
||||||
(mangaDir.listFiles() ?: emptyArray()).isNotEmpty()
|
mangaDir.listFiles()?.isNotEmpty() ?: false
|
||||||
}
|
}
|
||||||
if (!hasDirs) {
|
if (!hasDirs) {
|
||||||
return@f false
|
return@f false
|
||||||
|
Loading…
Reference in New Issue
Block a user