This commit is contained in:
ag2s20150909
2023-09-24 18:19:42 +08:00
committed by GitHub
parent 2c76551ef4
commit 3fb3a615ec
16 changed files with 47 additions and 65 deletions

View File

@@ -214,10 +214,10 @@ dependencies {
//网络
implementation('com.squareup.okhttp3:okhttp:4.11.0')
implementation(fileTree(dir: 'cronetlib', include: ['*.jar', '*.aar']))
implementation 'com.google.protobuf:protobuf-javalite:3.23.4'
implementation 'com.google.protobuf:protobuf-javalite:3.24.3'
//Glide
def glideVersion = "4.15.1"
def glideVersion = "4.16.0"
implementation("com.github.bumptech.glide:glide:$glideVersion")
//kapt("com.github.bumptech.glide:compiler:$glideVersion")
ksp("com.github.bumptech.glide:ksp:$glideVersion")
@@ -233,6 +233,7 @@ dependencies {
implementation("org.nanohttpd:nanohttpd-websocket:$nanoHttpdVersion")
//二维码
//noinspection GradleDependency
implementation('com.github.jenly1314:zxing-lite:2.4.0')
//颜色选择

View File

@@ -28,7 +28,7 @@ static def generateMD5(final file) {
/**
* 下载Cronet相关的jar
*/
task downloadJar(type: Download) {
tasks.register('downloadJar', Download) {
src([
BASE_PATH + "cronet_api.jar",
BASE_PATH + "cronet_impl_common_java.jar",
@@ -42,7 +42,7 @@ task downloadJar(type: Download) {
/**
* 下载Cronet的arm64-v8a so
*/
task downloadARM64(type: Download) {
tasks.register('downloadARM64', Download) {
src BASE_PATH + "libs/arm64-v8a/libcronet." + CronetVersion + ".so"
dest soPath + "/arm64-v8a.so"
overwrite true
@@ -51,7 +51,7 @@ task downloadARM64(type: Download) {
/**
* 下载Cronet的armeabi-v7a so
*/
task downloadARMv7(type: Download) {
tasks.register('downloadARMv7', Download) {
src BASE_PATH + "libs/armeabi-v7a/libcronet." + CronetVersion + ".so"
dest soPath + "/armeabi-v7a.so"
overwrite true
@@ -60,7 +60,7 @@ task downloadARMv7(type: Download) {
/**
* 下载Cronet的x86_64 so
*/
task downloadX86_64(type: Download) {
tasks.register('downloadX86_64', Download) {
src BASE_PATH + "libs/x86_64/libcronet." + CronetVersion + ".so"
dest soPath + "/x86_64.so"
overwrite true
@@ -69,7 +69,7 @@ task downloadX86_64(type: Download) {
/**
* 下载Cronet的x86 so
*/
task downloadX86(type: Download) {
tasks.register('downloadX86', Download) {
src BASE_PATH + "libs/x86/libcronet." + CronetVersion + ".so"
dest soPath + "/x86.so"
overwrite true
@@ -81,7 +81,7 @@ task downloadX86(type: Download) {
* 先更改gradle.properties 里面的版本号,然后再执行
* gradlew app:downloadCronet
*/
task downloadCronet() {
tasks.register('downloadCronet') {
dependsOn downloadJar, downloadARM64, downloadARMv7, downloadX86_64, downloadX86
doLast {

View File

@@ -50,7 +50,7 @@ class RssArticlesAdapter(context: Context, callBack: CallBack) :
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Drawable>?,
target: Target<Drawable>,
isFirstResource: Boolean
): Boolean {
imageView.gone()
@@ -58,10 +58,10 @@ class RssArticlesAdapter(context: Context, callBack: CallBack) :
}
override fun onResourceReady(
resource: Drawable?,
model: Any?,
resource: Drawable,
model: Any,
target: Target<Drawable>?,
dataSource: DataSource?,
dataSource: DataSource,
isFirstResource: Boolean
): Boolean {
imageView.visible()

View File

@@ -50,7 +50,7 @@ class RssArticlesAdapter1(context: Context, callBack: CallBack) :
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Drawable>?,
target: Target<Drawable>,
isFirstResource: Boolean
): Boolean {
imageView.gone()
@@ -58,10 +58,10 @@ class RssArticlesAdapter1(context: Context, callBack: CallBack) :
}
override fun onResourceReady(
resource: Drawable?,
model: Any?,
resource: Drawable,
model: Any,
target: Target<Drawable>?,
dataSource: DataSource?,
dataSource: DataSource,
isFirstResource: Boolean
): Boolean {
imageView.visible()

View File

@@ -50,7 +50,7 @@ class RssArticlesAdapter2(context: Context, callBack: CallBack) :
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Drawable>?,
target: Target<Drawable>,
isFirstResource: Boolean
): Boolean {
imageView.gone()
@@ -58,10 +58,10 @@ class RssArticlesAdapter2(context: Context, callBack: CallBack) :
}
override fun onResourceReady(
resource: Drawable?,
model: Any?,
resource: Drawable,
model: Any,
target: Target<Drawable>?,
dataSource: DataSource?,
dataSource: DataSource,
isFirstResource: Boolean
): Boolean {
imageView.visible()

View File

@@ -45,7 +45,7 @@ class RssFavoritesAdapter(context: Context, val callBack: CallBack) :
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Drawable>?,
target: Target<Drawable>,
isFirstResource: Boolean
): Boolean {
imageView.gone()
@@ -53,10 +53,10 @@ class RssFavoritesAdapter(context: Context, val callBack: CallBack) :
}
override fun onResourceReady(
resource: Drawable?,
model: Any?,
resource: Drawable,
model: Any,
target: Target<Drawable>?,
dataSource: DataSource?,
dataSource: DataSource,
isFirstResource: Boolean
): Boolean {
imageView.visible()

View File

@@ -1,7 +1,11 @@
package io.legado.app.ui.widget.image
import android.content.Context
import android.graphics.*
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.graphics.Path
import android.graphics.Typeface
import android.graphics.drawable.Drawable
import android.text.TextPaint
import android.util.AttributeSet
@@ -150,7 +154,7 @@ class CoverImageView @JvmOverloads constructor(
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Drawable>?,
target: Target<Drawable>,
isFirstResource: Boolean
): Boolean {
defaultCover = true
@@ -158,10 +162,10 @@ class CoverImageView @JvmOverloads constructor(
}
override fun onResourceReady(
resource: Drawable?,
model: Any?,
resource: Drawable,
model: Any,
target: Target<Drawable>?,
dataSource: DataSource?,
dataSource: DataSource,
isFirstResource: Boolean
): Boolean {
defaultCover = false

View File

@@ -4,7 +4,6 @@ import android.os.ParcelFileDescriptor
import android.system.ErrnoException
import android.system.Os
import android.system.OsConstants
import android.system.OsConstants.S_IFDIR
import android.system.OsConstants.S_ISDIR
import io.legado.app.lib.icu4j.CharsetDetector
import me.zhanghai.android.libarchive.Archive
@@ -231,8 +230,9 @@ object LibArchiveUtils {
try {
var entry = Archive.readNextHeader(archive)
while (entry != 0L) {
var entry: Long
while (Archive.readNextHeader(archive).also { entry = it } != 0L) {
val entryName =
getEntryString(ArchiveEntry.pathnameUtf8(entry), ArchiveEntry.pathname(entry))
?: continue
@@ -243,11 +243,10 @@ object LibArchiveUtils {
val entryStat = ArchiveEntry.stat(entry)
//判断是否是文件夹
if (S_ISDIR(entryStat.stMode)) {
if (entryStat.isDir()) {
if (!entryFile.exists()) {
entryFile.mkdirs()
}
entry = Archive.readNextHeader(archive)
continue
}
@@ -268,8 +267,6 @@ object LibArchiveUtils {
files.add(entryFile)
}
entry = Archive.readNextHeader(archive)
}
} finally {
@@ -287,8 +284,8 @@ object LibArchiveUtils {
fun getByteArrayContent(inputStream: InputStream, path: String): ByteArray? {
val archive = openArchive(inputStream)
try {
var entry = Archive.readNextHeader(archive)
while (entry != 0L) {
var entry: Long
while (Archive.readNextHeader(archive).also { entry = it } != 0L) {
val entryName =
getEntryString(ArchiveEntry.pathnameUtf8(entry), ArchiveEntry.pathname(entry))
?: continue
@@ -296,8 +293,7 @@ object LibArchiveUtils {
val entryStat = ArchiveEntry.stat(entry)
//判断是否是文件夹
if (S_ISDIR(entryStat.stMode)) {
entry = Archive.readNextHeader(archive)
if (entryStat.isDir()) {
continue
}
@@ -315,7 +311,6 @@ object LibArchiveUtils {
}
}
entry = Archive.readNextHeader(archive)
}
} finally {
@@ -331,22 +326,19 @@ object LibArchiveUtils {
): List<String> {
val fileNames = mutableListOf<String>()
try {
//Archive.readOpenFd(archive, pfd.fd, 8192)
var entry = Archive.readNextHeader(archive)
//val formatName: String = newStringFromBytes(Archive.formatName(archive))
while (entry != 0L) {
var entry: Long
while (Archive.readNextHeader(archive).also { entry = it } != 0L) {
val fileName =
getEntryString(ArchiveEntry.pathnameUtf8(entry), ArchiveEntry.pathname(entry))
?: continue
val entryStat = ArchiveEntry.stat(entry)
val fileType = entryStat.stMode and S_IFDIR
if (S_ISDIR(entryStat.stMode)) {
entry = Archive.readNextHeader(archive)
if (entryStat.isDir()) {
continue
}
@@ -363,6 +355,7 @@ object LibArchiveUtils {
return fileNames
}
private fun ArchiveEntry.StructStat.isDir() = S_ISDIR(this.stMode)
private fun getEntryString(utf8: String?, bytes: ByteArray?): String? {
return utf8 ?: newStringFromBytes(bytes)

View File

@@ -1129,7 +1129,5 @@
<string name="open_book_info_by_click_title">点击书名打开详情</string>
<string name="export_wait">等待导出</string>
<string name="default_home_page">默认主页</string>
<string name="use_lib_archive">Use LibArchive</string>
<string name="pref_use_lib_archive_summary">Using libarchive to extract files, it supports extracting RAR5.</string>
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
</resources>

View File

@@ -1132,7 +1132,5 @@
<string name="open_book_info_by_click_title">点击书名打开详情</string>
<string name="export_wait">等待导出</string>
<string name="default_home_page">默认主页</string>
<string name="use_lib_archive">Use LibArchive</string>
<string name="pref_use_lib_archive_summary">Using libarchive to extract files, it supports extracting RAR5.</string>
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
</resources>

View File

@@ -1132,7 +1132,5 @@
<string name="open_book_info_by_click_title">点击书名打开详情</string>
<string name="export_wait">等待导出</string>
<string name="default_home_page">默认主页</string>
<string name="use_lib_archive">Use LibArchive</string>
<string name="pref_use_lib_archive_summary">Using libarchive to extract files, it supports extracting RAR5.</string>
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
</resources>

View File

@@ -1127,7 +1127,5 @@ Còn </string>
<string name="change_source_delay">换源间隔</string>
<string name="open_book_info_by_click_title">点击书名打开详情</string>
<string name="export_wait">等待导出</string>
<string name="use_lib_archive">Use LibArchive</string>
<string name="pref_use_lib_archive_summary">Using libarchive to extract files, it supports extracting RAR5.</string>
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
</resources>

View File

@@ -1128,7 +1128,5 @@
<string name="change_source_delay">换源间隔</string>
<string name="open_book_info_by_click_title">点击书名打开详情</string>
<string name="export_wait">等待导出</string>
<string name="use_lib_archive">使用LibArchive</string>
<string name="pref_use_lib_archive_summary">使用libarchive解壓檔案支持解壓RAR5。</string>
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
</resources>

View File

@@ -1130,7 +1130,5 @@
<string name="change_source_delay">换源间隔</string>
<string name="open_book_info_by_click_title">点击书名打开详情</string>
<string name="export_wait">等待导出</string>
<string name="use_lib_archive">使用LibArchive</string>
<string name="pref_use_lib_archive_summary">使用libarchive解壓檔案支持解壓RAR5。</string>
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
</resources>

View File

@@ -1130,7 +1130,5 @@
<string name="change_source_delay">换源间隔</string>
<string name="open_book_info_by_click_title">点击书名打开详情</string>
<string name="export_wait">等待导出</string>
<string name="use_lib_archive">使用LibArchive</string>
<string name="pref_use_lib_archive_summary">使用libarchive解压文件支持解压RAR5。</string>
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
</resources>

View File

@@ -1132,7 +1132,5 @@
<string name="open_book_info_by_click_title">点击书名打开详情</string>
<string name="export_wait">等待导出</string>
<string name="default_home_page">默认主页</string>
<string name="use_lib_archive">Use LibArchive</string>
<string name="pref_use_lib_archive_summary">Using libarchive to extract files, it supports extracting RAR5.</string>
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
</resources>