mirror of
https://github.com/gedoor/legado.git
synced 2024-09-01 09:34:25 +08:00
完善段评开启关闭功能,准备实装
This commit is contained in:
parent
e2af0a43ba
commit
f0ead5b488
@ -32,6 +32,7 @@ object PreferKey {
|
|||||||
const val prevKeys = "prevKeyCodes"
|
const val prevKeys = "prevKeyCodes"
|
||||||
const val nextKeys = "nextKeyCodes"
|
const val nextKeys = "nextKeyCodes"
|
||||||
const val showDiscovery = "showDiscovery"
|
const val showDiscovery = "showDiscovery"
|
||||||
|
const val enableReview = "enableReview"
|
||||||
const val showRss = "showRss"
|
const val showRss = "showRss"
|
||||||
const val bookshelfLayout = "bookshelfLayout"
|
const val bookshelfLayout = "bookshelfLayout"
|
||||||
const val bookshelfSort = "bookshelfSort"
|
const val bookshelfSort = "bookshelfSort"
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package io.legado.app.data.entities
|
||||||
|
|
||||||
|
import android.os.Parcelable
|
||||||
|
import androidx.room.ColumnInfo
|
||||||
|
import kotlinx.parcelize.Parcelize
|
||||||
|
|
||||||
|
@Parcelize
|
||||||
|
class BookChapterReview(
|
||||||
|
@ColumnInfo(defaultValue = "0")
|
||||||
|
var bookId: Long = 0,
|
||||||
|
var chapterId: Long = 0,
|
||||||
|
var summaryUrl: String = "",
|
||||||
|
): Parcelable {
|
||||||
|
|
||||||
|
}
|
@ -154,6 +154,12 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
|
|||||||
val autoRefreshBook: Boolean
|
val autoRefreshBook: Boolean
|
||||||
get() = appCtx.getPrefBoolean(PreferKey.autoRefresh)
|
get() = appCtx.getPrefBoolean(PreferKey.autoRefresh)
|
||||||
|
|
||||||
|
var enableReview: Boolean
|
||||||
|
get() = appCtx.getPrefBoolean(PreferKey.enableReview, false)
|
||||||
|
set(value) {
|
||||||
|
appCtx.putPrefBoolean(PreferKey.enableReview, value)
|
||||||
|
}
|
||||||
|
|
||||||
var threadCount: Int
|
var threadCount: Int
|
||||||
get() = appCtx.getPrefInt(PreferKey.threadCount, 16)
|
get() = appCtx.getPrefInt(PreferKey.threadCount, 16)
|
||||||
set(value) {
|
set(value) {
|
||||||
|
@ -300,6 +300,13 @@ object WebBook {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取段评
|
||||||
|
*/
|
||||||
|
fun getReview() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 精准搜索
|
* 精准搜索
|
||||||
*/
|
*/
|
||||||
|
@ -255,6 +255,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
else -> when (item.itemId) {
|
else -> when (item.itemId) {
|
||||||
R.id.menu_enable_replace -> item.isChecked = book.getUseReplaceRule()
|
R.id.menu_enable_replace -> item.isChecked = book.getUseReplaceRule()
|
||||||
R.id.menu_re_segment -> item.isChecked = book.getReSegment()
|
R.id.menu_re_segment -> item.isChecked = book.getReSegment()
|
||||||
|
R.id.menu_enable_review -> item.isChecked = AppConfig.enableReview
|
||||||
R.id.menu_reverse_content -> item.isVisible = onLine
|
R.id.menu_reverse_content -> item.isVisible = onLine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -355,8 +356,10 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
menu?.findItem(R.id.menu_re_segment)?.isChecked = it.getReSegment()
|
menu?.findItem(R.id.menu_re_segment)?.isChecked = it.getReSegment()
|
||||||
ReadBook.loadContent(false)
|
ReadBook.loadContent(false)
|
||||||
}
|
}
|
||||||
R.id.menu_enable_review -> ReadBook.book?.let {
|
R.id.menu_enable_review -> {
|
||||||
// TODO
|
AppConfig.enableReview = !AppConfig.enableReview
|
||||||
|
menu?.findItem(R.id.menu_enable_review)?.isChecked = AppConfig.enableReview
|
||||||
|
ReadBook.loadContent(false)
|
||||||
}
|
}
|
||||||
R.id.menu_page_anim -> showPageAnimConfig {
|
R.id.menu_page_anim -> showPageAnimConfig {
|
||||||
binding.readView.upPageAnim()
|
binding.readView.upPageAnim()
|
||||||
|
@ -16,10 +16,7 @@ import io.legado.app.help.config.AppConfig
|
|||||||
import io.legado.app.help.config.ReadBookConfig
|
import io.legado.app.help.config.ReadBookConfig
|
||||||
import io.legado.app.lib.theme.accentColor
|
import io.legado.app.lib.theme.accentColor
|
||||||
import io.legado.app.model.ReadBook
|
import io.legado.app.model.ReadBook
|
||||||
import io.legado.app.ui.book.read.page.entities.TextColumn
|
import io.legado.app.ui.book.read.page.entities.*
|
||||||
import io.legado.app.ui.book.read.page.entities.TextLine
|
|
||||||
import io.legado.app.ui.book.read.page.entities.TextPage
|
|
||||||
import io.legado.app.ui.book.read.page.entities.TextPos
|
|
||||||
import io.legado.app.ui.book.read.page.provider.ChapterProvider
|
import io.legado.app.ui.book.read.page.provider.ChapterProvider
|
||||||
import io.legado.app.ui.book.read.page.provider.ImageProvider
|
import io.legado.app.ui.book.read.page.provider.ImageProvider
|
||||||
import io.legado.app.ui.book.read.page.provider.TextPageFactory
|
import io.legado.app.ui.book.read.page.provider.TextPageFactory
|
||||||
@ -30,7 +27,7 @@ import io.legado.app.utils.toastOnUi
|
|||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 阅读内容视图
|
* 阅读内容界面
|
||||||
*/
|
*/
|
||||||
class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, attrs) {
|
class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, attrs) {
|
||||||
var selectAble = context.getPrefBoolean(PreferKey.textSelectAble, true)
|
var selectAble = context.getPrefBoolean(PreferKey.textSelectAble, true)
|
||||||
@ -67,18 +64,12 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
|
|||||||
callBack = activity as CallBack
|
callBack = activity as CallBack
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置内容
|
|
||||||
*/
|
|
||||||
fun setContent(textPage: TextPage) {
|
fun setContent(textPage: TextPage) {
|
||||||
this.textPage = textPage
|
this.textPage = textPage
|
||||||
imagePaint.isAntiAlias = AppConfig.useAntiAlias
|
imagePaint.isAntiAlias = AppConfig.useAntiAlias
|
||||||
invalidate()
|
invalidate()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新绘制区域
|
|
||||||
*/
|
|
||||||
fun upVisibleRect() {
|
fun upVisibleRect() {
|
||||||
visibleRect.set(
|
visibleRect.set(
|
||||||
ChapterProvider.paddingLeft.toFloat(),
|
ChapterProvider.paddingLeft.toFloat(),
|
||||||
|
@ -11,7 +11,7 @@ import io.legado.app.utils.textHeight
|
|||||||
data class TextLine(
|
data class TextLine(
|
||||||
var text: String = "",
|
var text: String = "",
|
||||||
val textChars: ArrayList<TextColumn> = arrayListOf(),
|
val textChars: ArrayList<TextColumn> = arrayListOf(),
|
||||||
val reviewCount: Int = 1,
|
val reviewCount: Int = 0,
|
||||||
var lineTop: Float = 0f,
|
var lineTop: Float = 0f,
|
||||||
var lineBase: Float = 0f,
|
var lineBase: Float = 0f,
|
||||||
var lineBottom: Float = 0f,
|
var lineBottom: Float = 0f,
|
||||||
|
@ -119,7 +119,7 @@ object ChapterProvider {
|
|||||||
book,
|
book,
|
||||||
absStartX,
|
absStartX,
|
||||||
durY,
|
durY,
|
||||||
text + "\ud83d\udcac",
|
if (AppConfig.enableReview) text + "\ud83d\udcac" else text,
|
||||||
textPages,
|
textPages,
|
||||||
stringBuilder,
|
stringBuilder,
|
||||||
titlePaint,
|
titlePaint,
|
||||||
@ -180,7 +180,7 @@ object ChapterProvider {
|
|||||||
book,
|
book,
|
||||||
absStartX,
|
absStartX,
|
||||||
durY,
|
durY,
|
||||||
text + "\ud83d\udcac",
|
if (AppConfig.enableReview) text + "\ud83d\udcac" else text,
|
||||||
textPages,
|
textPages,
|
||||||
stringBuilder,
|
stringBuilder,
|
||||||
contentPaint
|
contentPaint
|
||||||
|
Loading…
Reference in New Issue
Block a user