feat: 优化代码

pull/106/head
kunfei 5 years ago
parent cc3b58a867
commit 09910b8f32
  1. 3
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt
  3. 7
      app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt

@ -24,6 +24,7 @@ import io.legado.app.help.ReadBookConfig
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.dialogs.noButton
import io.legado.app.lib.dialogs.okButton
import io.legado.app.lib.theme.accentColor
import io.legado.app.receiver.TimeElectricityReceiver
import io.legado.app.service.BaseReadAloudService
import io.legado.app.service.help.ReadAloud
@ -114,6 +115,8 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
* 初始化View
*/
private fun initView() {
cursor_left.setColorFilter(accentColor)
cursor_right.setColorFilter(accentColor)
tv_chapter_name.onClick {
ReadBook.webBook?.let {
startActivityForResult<BookSourceEditActivity>(

@ -22,7 +22,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
var selectAble = context.getPrefBoolean(PreferKey.textSelectAble)
private val selectedPaint by lazy {
Paint().apply {
color = context.getCompatColor(R.color.btn_bg_press)
color = context.getCompatColor(R.color.btn_bg_press_2)
}
}
var textPage: TextPage? = null

@ -113,7 +113,12 @@ class ContentView : FrameLayout {
fun selectText(e: MotionEvent): SelectPoint? {
val y = e.y - headerHeight
return content_text_view.selectText(e.x, y)
val selectPoint = content_text_view.selectText(e.x, y)
selectPoint?.let {
it.startY = it.startY + headerHeight
it.endY = it.endY + headerHeight
}
return selectPoint
}
fun scrollTo(pos: Int?) {

Loading…
Cancel
Save