Merge remote-tracking branch 'origin/master'

# Conflicts:
#	app/src/main/assets/updateLog.md
#	app/src/main/res/values-es-rES/strings.xml
#	app/src/main/res/values-ja-rJP/strings.xml
#	app/src/main/res/values-pt-rBR/strings.xml
#	app/src/main/res/values-zh-rHK/strings.xml
#	app/src/main/res/values-zh-rTW/strings.xml
#	app/src/main/res/values-zh/strings.xml
#	app/src/main/res/values/strings.xml
pull/1931/head
kunfei 3 years ago
commit bacfe8f3e2
  1. 15
      .github/scripts/cronet.sh
  2. BIN
      app/cronetlib/cronet_api.jar
  3. BIN
      app/cronetlib/cronet_impl_common_java.jar
  4. BIN
      app/cronetlib/cronet_impl_native_java.jar
  5. BIN
      app/cronetlib/cronet_impl_platform_java.jar
  6. 2
      app/src/main/assets/cronet.json
  7. 5
      app/src/main/assets/updateLog.md
  8. 4
      app/src/main/java/io/legado/app/constant/PreferKey.kt
  9. 11
      app/src/main/java/io/legado/app/help/config/AppConfig.kt
  10. 3
      app/src/main/java/io/legado/app/help/storage/BackupConfig.kt
  11. 2
      app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt
  12. 21
      app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt
  13. 6
      app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt
  14. 17
      app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt
  15. 7
      app/src/main/res/menu/book_cache.xml
  16. 4
      app/src/main/res/values-es-rES/strings.xml
  17. 4
      app/src/main/res/values-ja-rJP/strings.xml
  18. 4
      app/src/main/res/values-pt-rBR/strings.xml
  19. 4
      app/src/main/res/values-zh-rHK/strings.xml
  20. 4
      app/src/main/res/values-zh-rTW/strings.xml
  21. 4
      app/src/main/res/values-zh/strings.xml
  22. 4
      app/src/main/res/values/strings.xml
  23. 6
      app/src/main/res/xml/pref_config_other.xml
  24. 2
      gradle.properties

@ -1,10 +1,21 @@
#bin/sh
#!/usr/bin/env bash
echo "fetch release info from https://chromiumdash.appspot.com ..."
branch="Stable"
lastest_cronet_version=`curl -s "https://chromiumdash.appspot.com/fetch_releases?channel=$branch&platform=Android&num=1&offset=0" | jq .[0].version -r`
echo "lastest_cronet_version: $lastest_cronet_version"
#lastest_cronet_version=100.0.4845.0
function checkVersionExit() {
local jar_url="https://storage.googleapis.com/chromium-cronet/android/$lastest_cronet_version/Release/cronet/cronet_api.jar"
statusCode=$(curl -s -I -w %{http_code} "$jar_url" -o /dev/null)
if [ $statusCode == "404" ];then
echo "storage.googleapis.com return 404 for cronet $lastest_cronet_version"
exit
fi
}
path=$GITHUB_WORKSPACE/gradle.properties
current_cronet_version=`cat $path | grep CronetVersion | sed s/CronetVersion=//`
@ -13,9 +24,11 @@ echo "current_cronet_version: $current_cronet_version"
if [[ $current_cronet_version == $lastest_cronet_version ]];then
echo "cronet is already latest"
else
checkVersionExit
sed -i s/CronetVersion=.*/CronetVersion=$lastest_cronet_version/ $path
sed "15a* 更新cronet: $lastest_cronet_version" -i $GITHUB_WORKSPACE/app/src/main/assets/updateLog.md
echo "start download latest cronet"
chmod +x gradlew
./gradlew app:downloadCronet
fi

Binary file not shown.

@ -1 +1 @@
{"arm64-v8a":"3a835986e6e32bb3925905088dcdbd36","x86":"07c42a1c86c6d2e84a248e8b29e5d68e","armeabi-v7a":"071eb2907e2ffae4a1d105977ee5009d","x86_64":"6d2ef0cf34b92d58a3ee391b15f8bc1d","version":"101.0.4951.61"}
{"arm64-v8a":"3361d1edbf6fb07e905e07a69df2b7f3","x86":"84aef5ef1dc2815ce8ed23d1bc59487e","armeabi-v7a":"e8015c995f72baae1d86388a55415b33","x86_64":"ad4c32cfa06dad191fd2d96f65d5d866","version":"102.0.5005.78"}

@ -11,8 +11,11 @@
* 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则或简繁转换出现问题。
* 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源!
**2022/05/28**
**2022/05/30**
* 更新cronet: 102.0.5005.78
* 缓存导出添加导出图片文件选项
* 其他设置添加图片绘制缓存选项
* 移除刷新时重新获取目录页链接Url的配置
* 添加刷新前Js,功能更强大

@ -55,6 +55,7 @@ object PreferKey {
const val exportToWebDav = "webDavCacheBackup"
const val exportNoChapterName = "exportNoChapterName"
const val exportType = "exportType"
const val exportPictureFile = "exportPictureFile"
const val changeSourceCheckAuthor = "changeSourceCheckAuthor"
const val changeSourceLoadToc = "changeSourceLoadToc"
const val changeSourceLoadInfo = "changeSourceLoadInfo"
@ -82,6 +83,7 @@ object PreferKey {
const val syncBookProgress = "syncBookProgress"
const val cronet = "Cronet"
const val antiAlias = "antiAlias"
const val bitmapCacheSize = "bitmapCacheSize"
const val preDownloadNum = "preDownloadNum"
const val autoRefresh = "auto_refresh"
const val defaultToRead = "defaultToRead"
@ -107,7 +109,6 @@ object PreferKey {
const val welcomeShowIcon = "welcomeShowIcon"
const val welcomeShowIconDark = "welcomeShowIconDark"
const val cPrimary = "colorPrimary"
const val cAccent = "colorAccent"
const val cBackground = "colorBackground"
@ -121,4 +122,5 @@ object PreferKey {
const val cNBBackground = "colorBottomBackgroundNight"
const val bgImageN = "backgroundImageNight"
const val bgImageNBlurring = "backgroundImageNightBlurring"
}

@ -243,6 +243,11 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
set(value) {
appCtx.putPrefInt(PreferKey.exportType, value)
}
var exportPictureFile: Boolean
get() = appCtx.getPrefBoolean(PreferKey.exportPictureFile, false)
set(value) {
appCtx.putPrefBoolean(PreferKey.exportPictureFile, value)
}
var changeSourceCheckAuthor: Boolean
get() = appCtx.getPrefBoolean(PreferKey.changeSourceCheckAuthor)
@ -323,5 +328,11 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
}
return ua
}
var bitmapCacheSize: Int
get() = appCtx.getPrefInt(PreferKey.bitmapCacheSize, 50)
set(value) {
appCtx.putPrefInt(PreferKey.bitmapCacheSize, value)
}
}

@ -27,7 +27,8 @@ object BackupConfig {
PreferKey.webDavDir,
PreferKey.webDavAccount,
PreferKey.webDavPassword,
PreferKey.launcherIcon
PreferKey.launcherIcon,
PreferKey.bitmapCacheSize
)
//配置忽略标题

@ -93,6 +93,7 @@ class CacheActivity : VMBaseActivity<ActivityCacheBookBinding, CacheViewModel>()
menu.findItem(R.id.menu_enable_replace)?.isChecked = AppConfig.exportUseReplace
menu.findItem(R.id.menu_export_no_chapter_name)?.isChecked = AppConfig.exportNoChapterName
menu.findItem(R.id.menu_export_web_dav)?.isChecked = AppConfig.exportToWebDav
menu.findItem(R.id.menu_export_pics_file)?.isChecked = AppConfig.exportPictureFile
menu.findItem(R.id.menu_export_type)?.title =
"${getString(R.string.export_type)}(${getTypeName()})"
menu.findItem(R.id.menu_export_charset)?.title =
@ -129,6 +130,7 @@ class CacheActivity : VMBaseActivity<ActivityCacheBookBinding, CacheViewModel>()
R.id.menu_enable_replace -> AppConfig.exportUseReplace = !item.isChecked
R.id.menu_export_no_chapter_name -> AppConfig.exportNoChapterName = !item.isChecked
R.id.menu_export_web_dav -> AppConfig.exportToWebDav = !item.isChecked
R.id.menu_export_pics_file -> AppConfig.exportPictureFile = !item.isChecked
R.id.menu_export_folder -> {
selectExportFolder(-1)
}

@ -168,17 +168,22 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
chineseConvert = false,
reSegment = false
).joinToString("\n")
val srcList = arrayListOf<Triple<String, Int, String>>()
content?.split("\n")?.forEachIndexed { index, text ->
val matcher = AppPattern.imgPattern.matcher(text)
while (matcher.find()) {
matcher.group(1)?.let {
val src = NetworkUtils.getAbsoluteURL(chapter.url, it)
srcList.add(Triple(chapter.title, index, src))
if (AppConfig.exportPictureFile) {
//txt导出图片文件
val srcList = arrayListOf<Triple<String, Int, String>>()
content?.split("\n")?.forEachIndexed { index, text ->
val matcher = AppPattern.imgPattern.matcher(text)
while (matcher.find()) {
matcher.group(1)?.let {
val src = NetworkUtils.getAbsoluteURL(chapter.url, it)
srcList.add(Triple(chapter.title, index, src))
}
}
}
append.invoke("\n\n$content1", srcList)
} else {
append.invoke("\n\n$content1", null)
}
append.invoke("\n\n$content1", srcList)
}
}
}

@ -10,6 +10,7 @@ import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookSource
import io.legado.app.exception.NoStackTraceException
import io.legado.app.help.BookHelp
import io.legado.app.help.config.AppConfig
import io.legado.app.help.coroutine.Coroutine
import io.legado.app.model.localBook.EpubFile
import io.legado.app.utils.BitmapUtils
@ -19,8 +20,6 @@ import kotlinx.coroutines.withContext
import splitties.init.appCtx
import java.io.File
import java.io.FileOutputStream
import kotlin.math.max
import kotlin.math.min
object ImageProvider {
@ -32,8 +31,7 @@ object ImageProvider {
*缓存bitmap LruCache实现
*/
private const val M = 1024 * 1024
private val cacheSize =
max(50 * M, min(100 * M, (Runtime.getRuntime().maxMemory() / 8).toInt()))
val cacheSize get() = AppConfig.bitmapCacheSize * M
val bitmapLruCache = object : LruCache<String, Bitmap>(cacheSize) {
override fun sizeOf(key: String, bitmap: Bitmap): Int {

@ -21,6 +21,7 @@ import io.legado.app.lib.theme.primaryColor
import io.legado.app.model.CheckSource
import io.legado.app.receiver.SharedReceiverActivity
import io.legado.app.service.WebService
import io.legado.app.ui.book.read.page.provider.ImageProvider
import io.legado.app.ui.document.HandleFileContract
import io.legado.app.ui.widget.number.NumberPickerDialog
import io.legado.app.utils.*
@ -56,6 +57,7 @@ class OtherConfigFragment : PreferenceFragment(),
upPreferenceSummary(PreferKey.defaultBookTreeUri, it)
}
upPreferenceSummary(PreferKey.checkSource, CheckSource.summary)
upPreferenceSummary(PreferKey.bitmapCacheSize, AppConfig.bitmapCacheSize.toString())
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@ -104,6 +106,17 @@ class OtherConfigFragment : PreferenceFragment(),
PreferKey.cleanCache -> clearCache()
PreferKey.uploadRule -> showDialogFragment<DirectLinkUploadConfig>()
PreferKey.checkSource -> showDialogFragment<CheckSourceConfig>()
PreferKey.bitmapCacheSize -> {
NumberPickerDialog(requireContext())
.setTitle(getString(R.string.bitmap_cache_size))
.setMaxValue(9999)
.setMinValue(1)
.setValue(AppConfig.bitmapCacheSize)
.show {
AppConfig.bitmapCacheSize = it
ImageProvider.bitmapLruCache.resize(ImageProvider.cacheSize)
}
}
}
return super.onPreferenceTreeClick(preference)
}
@ -141,6 +154,9 @@ class OtherConfigFragment : PreferenceFragment(),
PreferKey.checkSource -> listView.post {
upPreferenceSummary(PreferKey.checkSource, CheckSource.summary)
}
PreferKey.bitmapCacheSize -> {
upPreferenceSummary(key, AppConfig.bitmapCacheSize.toString())
}
}
}
@ -151,6 +167,7 @@ class OtherConfigFragment : PreferenceFragment(),
getString(R.string.pre_download_s, value)
PreferKey.threadCount -> preference.summary = getString(R.string.threads_num, value)
PreferKey.webPort -> preference.summary = getString(R.string.web_port_summary, value)
PreferKey.bitmapCacheSize -> preference.summary = getString(R.string.bitmap_cache_size_summary, value)
else -> if (preference is ListPreference) {
val index = preference.findIndexOfValue(value)
// Set the summary to reflect the new value.

@ -36,12 +36,19 @@
android:title="@string/export_to_web_dav"
android:checkable="true"
app:showAsAction="never" />
<item
android:id="@+id/menu_export_no_chapter_name"
android:title="@string/export_no_chapter_name"
android:checkable="true"
app:showAsAction="never" />
<item
android:id="@+id/menu_export_pics_file"
android:title="@string/export_pics_file"
android:checkable="true"
app:showAsAction="never" />
<item
android:id="@+id/menu_export_folder"
android:title="@string/export_folder"

@ -989,6 +989,8 @@
<string name="download_book_fail">Download Fail</string>
<string name="upload_to_remote">Upload</string>
<string name="add_remote_book">WebDavBook</string>
<string name="bitmap_cache_size_summary">Current cache max size %1$s MB</string>
<string name="bitmap_cache_size">bitmap cache size</string>
<string name="export_pics_file">Export Picture Files</string>
<!-- string end -->
</resources>

@ -992,6 +992,8 @@
<string name="download_book_fail">Download Fail</string>
<string name="upload_to_remote">Upload</string>
<string name="add_remote_book">WebDavBook</string>
<string name="bitmap_cache_size_summary">Current cache max size %1$s MB</string>
<string name="bitmap_cache_size">bitmap cache size</string>
<string name="export_pics_file">Export Picture Files</string>
<!-- string end -->
</resources>

@ -992,6 +992,8 @@
<string name="download_book_fail">Download Fail</string>
<string name="upload_to_remote">Upload</string>
<string name="add_remote_book">WebDavBook</string>
<string name="bitmap_cache_size_summary">Current cache max size %1$s MB</string>
<string name="bitmap_cache_size">bitmap cache size</string>
<string name="export_pics_file">Export Picture Files</string>
<!-- string end -->
</resources>

@ -989,6 +989,8 @@
<string name="download_book_fail">Download Fail</string>
<string name="upload_to_remote">Upload</string>
<string name="add_remote_book">WebDav书籍</string>
<string name="bitmap_cache_size_summary">当前最大缓存 %1$s MB</string>
<string name="bitmap_cache_size">图片绘制缓存</string>
<string name="export_pics_file">TXT导出图片</string>
<!-- string end -->
</resources>

@ -991,6 +991,8 @@
<string name="download_book_fail">Download Fail</string>
<string name="upload_to_remote">Upload</string>
<string name="add_remote_book">WebDav书籍</string>
<string name="bitmap_cache_size_summary">当前最大缓存 %1$s MB</string>
<string name="bitmap_cache_size">图片绘制缓存</string>
<string name="export_pics_file">TXT导出图片</string>
<!-- string end -->
</resources>

@ -991,6 +991,8 @@
<string name="download_book_fail">Download Fail</string>
<string name="upload_to_remote">上传WebDav</string>
<string name="add_remote_book">WebDav书籍</string>
<string name="bitmap_cache_size_summary">当前最大缓存 %1$s MB</string>
<string name="bitmap_cache_size">图片绘制缓存</string>
<string name="export_pics_file">TXT导出图片</string>
<!-- string end -->
</resources>

@ -992,6 +992,8 @@
<string name="download_book_fail">Download Fail</string>
<string name="upload_to_remote">Upload</string>
<string name="add_remote_book">WebDavBook</string>
<string name="bitmap_cache_size_summary">Current cache max size %1$s MB</string>
<string name="bitmap_cache_size">bitmap cache size</string>
<string name="export_pics_file">Export Picture Files</string>
<!-- string end -->
</resources>

@ -75,12 +75,18 @@
android:key="Cronet"
android:summary="@string/pref_cronet_summary"
android:title="Cronet" />
<io.legado.app.lib.prefs.SwitchPreference
android:defaultValue="false"
android:key="antiAlias"
android:summary="@string/pref_anti_alias_summary"
android:title="@string/anti_alias" />
<io.legado.app.lib.prefs.Preference
android:key="bitmapCacheSize"
android:summary="@string/bitmap_cache_size_summary"
android:title="@string/bitmap_cache_size" />
<io.legado.app.lib.prefs.Preference
android:key="preDownloadNum"
android:summary="@string/pre_download_s"

@ -26,4 +26,4 @@ android.experimental.enableNewResourceShrinker.preciseShrinking=true
# and none from the library's dependencies, thereby reducing the size of the R class for that library.
android.nonTransitiveRClass=true
#https://chromiumdash.appspot.com/releases?platform=Android
CronetVersion=101.0.4951.61
CronetVersion=102.0.5005.78

Loading…
Cancel
Save