Merge remote-tracking branch 'origin/master'

pull/2296/head
kunfei 2 years ago
commit bb82f60e67
  1. 1
      app/src/main/java/io/legado/app/constant/PreferKey.kt
  2. 2
      app/src/main/java/io/legado/app/help/config/AppConfig.kt
  3. 8
      app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt
  4. 2
      app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt
  5. 1
      app/src/main/res/values-es-rES/strings.xml
  6. 1
      app/src/main/res/values-ja-rJP/strings.xml
  7. 1
      app/src/main/res/values-pt-rBR/strings.xml
  8. 1
      app/src/main/res/values-zh-rHK/strings.xml
  9. 1
      app/src/main/res/values-zh-rTW/strings.xml
  10. 1
      app/src/main/res/values-zh/strings.xml
  11. 1
      app/src/main/res/values/strings.xml
  12. 7
      app/src/main/res/xml/pref_config_read.xml

@ -111,6 +111,7 @@ object PreferKey {
const val welcomeShowIconDark = "welcomeShowIconDark"
const val pageTouchSlop = "pageTouchSlop"
const val showAddToShelfAlert = "showAddToShelfAlert"
const val asyncLoadImage = "asyncLoadImage"
const val cPrimary = "colorPrimary"
const val cAccent = "colorAccent"

@ -320,6 +320,8 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
val showAddToShelfAlert get() = appCtx.getPrefBoolean(PreferKey.showAddToShelfAlert, true)
val asyncLoadImage get() = appCtx.getPrefBoolean(PreferKey.asyncLoadImage, false)
val doublePageHorizontal: String?
get() = appCtx.getPrefString(PreferKey.doublePageHorizontal)

@ -4,6 +4,7 @@ import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.RectF
import android.os.Build
import android.util.AttributeSet
import android.view.View
import io.legado.app.R
@ -51,7 +52,11 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
private var drawVisibleImageOnly = false
private var cacheIncreased = false
private val increaseSize = 8 * 1024 * 1024
private val maxCacheSize = 256 * 1024 * 1024
private val maxCacheSize = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.N_MR1) {
min(128 * 1024 * 1024, Runtime.getRuntime().maxMemory())
} else {
256 * 1024 * 1024
}
//滚动参数
private val pageFactory: TextPageFactory get() = callBack.pageFactory
@ -203,7 +208,6 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
return
}
if (drawVisibleImageOnly &&
isVisible &&
!cacheIncreased &&
ImageProvider.isTriggerRecycled() &&
!ImageProvider.isImageAlive(book, column.src)

@ -131,7 +131,7 @@ object ImageProvider {
//bitmapLruCache的key同一改成缓存文件的路径
val cacheBitmap = bitmapLruCache.get(vFile.absolutePath)
if (cacheBitmap != null) return cacheBitmap
if (height != null && ReadBook.pageAnim() == PageAnim.scrollPageAnim) {
if (height != null && AppConfig.asyncLoadImage && ReadBook.pageAnim() == PageAnim.scrollPageAnim) {
Coroutine.async {
kotlin.runCatching {
val bitmap = BitmapUtils.decodeBitmap(vFile.absolutePath, width, height)

@ -1028,4 +1028,5 @@
<string name="rule_image_decode">Decode Image(imageDecode)</string>
<string name="like_source"></string>
<string name="not_like_source"></string>
<string name="async_load_image">异步加载图片</string>
</resources>

@ -1031,4 +1031,5 @@
<string name="rule_image_decode">Decode Image(imageDecode)</string>
<string name="like_source"></string>
<string name="not_like_source"></string>
<string name="async_load_image">异步加载图片</string>
</resources>

@ -1031,4 +1031,5 @@
<string name="rule_image_decode">Decode Image(imageDecode)</string>
<string name="like_source"></string>
<string name="not_like_source"></string>
<string name="async_load_image">异步加载图片</string>
</resources>

@ -1028,4 +1028,5 @@
<string name="rule_image_decode">图片解密(imageDecode)</string>
<string name="like_source"></string>
<string name="not_like_source"></string>
<string name="async_load_image">异步加载图片</string>
</resources>

@ -1030,4 +1030,5 @@
<string name="rule_image_decode">图片解密(imageDecode)</string>
<string name="like_source"></string>
<string name="not_like_source"></string>
<string name="async_load_image">异步加载图片</string>
</resources>

@ -1030,4 +1030,5 @@
<string name="rule_image_decode">图片解密(imageDecode)</string>
<string name="like_source"></string>
<string name="not_like_source"></string>
<string name="async_load_image">异步加载图片</string>
</resources>

@ -1031,4 +1031,5 @@
<string name="rule_image_decode">Decode Image(imageDecode)</string>
<string name="like_source"></string>
<string name="not_like_source"></string>
<string name="async_load_image">异步加载图片</string>
</resources>

@ -120,6 +120,13 @@
app:iconSpaceReserved="false"
app:isBottomBackground="true" />
<io.legado.app.lib.prefs.SwitchPreference
android:defaultValue="false"
android:key="asyncLoadImage"
android:title="@string/async_load_image"
app:iconSpaceReserved="false"
app:isBottomBackground="true" />
<io.legado.app.lib.prefs.Preference
android:key="clickRegionalConfig"
android:title="@string/click_regional_config"

Loading…
Cancel
Save