mirror of
https://github.com/gedoor/legado.git
synced 2024-07-19 01:17:25 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
bb82f60e67
@ -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…
Reference in New Issue
Block a user