mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
chore(coil): Move stuff around
This commit is contained in:
parent
103fae06d3
commit
b220705492
1 changed files with 24 additions and 24 deletions
|
@ -78,6 +78,30 @@ class MangaCoverFetcher(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun fileLoader(file: File): FetchResult {
|
||||||
|
return SourceFetchResult(
|
||||||
|
source = ImageSource(
|
||||||
|
file = file.toOkioPath(),
|
||||||
|
fileSystem = FileSystem.SYSTEM,
|
||||||
|
diskCacheKey = diskCacheKey,
|
||||||
|
),
|
||||||
|
mimeType = "image/*",
|
||||||
|
dataSource = DataSource.DISK,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun fileUriLoader(uri: String): FetchResult {
|
||||||
|
val source = UniFile.fromUri(options.context, uri.toUri())!!
|
||||||
|
.openInputStream()
|
||||||
|
.source()
|
||||||
|
.buffer()
|
||||||
|
return SourceFetchResult(
|
||||||
|
source = ImageSource(source = source, fileSystem = FileSystem.SYSTEM),
|
||||||
|
mimeType = "image/*",
|
||||||
|
dataSource = DataSource.DISK,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private suspend fun httpLoader(): FetchResult {
|
private suspend fun httpLoader(): FetchResult {
|
||||||
val coverFile = coverFileLazy.value
|
val coverFile = coverFileLazy.value
|
||||||
if (coverFile?.exists() == true && options.diskCachePolicy.readEnabled) {
|
if (coverFile?.exists() == true && options.diskCachePolicy.readEnabled) {
|
||||||
|
@ -285,30 +309,6 @@ class MangaCoverFetcher(
|
||||||
return getMimeTypeFromExtension(extension)
|
return getMimeTypeFromExtension(extension)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun fileLoader(file: File): FetchResult {
|
|
||||||
return SourceFetchResult(
|
|
||||||
source = ImageSource(
|
|
||||||
file = file.toOkioPath(),
|
|
||||||
fileSystem = FileSystem.SYSTEM,
|
|
||||||
diskCacheKey = diskCacheKey,
|
|
||||||
),
|
|
||||||
mimeType = "image/*",
|
|
||||||
dataSource = DataSource.DISK,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun fileUriLoader(uri: String): FetchResult {
|
|
||||||
val source = UniFile.fromUri(options.context, uri.toUri())!!
|
|
||||||
.openInputStream()
|
|
||||||
.source()
|
|
||||||
.buffer()
|
|
||||||
return SourceFetchResult(
|
|
||||||
source = ImageSource(source = source, fileSystem = FileSystem.SYSTEM),
|
|
||||||
mimeType = "image/*",
|
|
||||||
dataSource = DataSource.DISK,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getResourceType(cover: String?): Type? {
|
private fun getResourceType(cover: String?): Type? {
|
||||||
return when {
|
return when {
|
||||||
cover.isNullOrEmpty() -> null
|
cover.isNullOrEmpty() -> null
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue