从文字选择处开始朗读,未完成

pull/2160/head
kunfei 2 years ago
parent 0a5ca5cf88
commit 82b5244909
  1. 30
      app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt

@ -446,6 +446,10 @@ class ReadView(context: Context, attrs: AttributeSet) :
curPage.cancelSelect() curPage.cancelSelect()
} }
/**
* 翻页动画完成后事件
* @param direction 翻页翻页反向
*/
fun fillPage(direction: PageDirection): Boolean { fun fillPage(direction: PageDirection): Boolean {
return when (direction) { return when (direction) {
PageDirection.PREV -> { PageDirection.PREV -> {
@ -458,6 +462,9 @@ class ReadView(context: Context, attrs: AttributeSet) :
} }
} }
/**
* 更新翻页动画
*/
fun upPageAnim() { fun upPageAnim() {
isScroll = ReadBook.pageAnim() == 3 isScroll = ReadBook.pageAnim() == 3
ChapterProvider.upLayout() ChapterProvider.upLayout()
@ -480,6 +487,11 @@ class ReadView(context: Context, attrs: AttributeSet) :
} }
} }
/**
* 更新阅读内容
* @param relativePosition 相对位置 -1 上一页 0 当前页 1 下一页
* @param resetPageOffset 滚动阅读是是否重置位置
*/
override fun upContent(relativePosition: Int, resetPageOffset: Boolean) { override fun upContent(relativePosition: Int, resetPageOffset: Boolean) {
curPage.setContentDescription(pageFactory.curPage.text) curPage.setContentDescription(pageFactory.curPage.text)
if (isScroll && !callBack.isAutoPage) { if (isScroll && !callBack.isAutoPage) {
@ -499,6 +511,9 @@ class ReadView(context: Context, attrs: AttributeSet) :
callBack.screenOffTimerStart() callBack.screenOffTimerStart()
} }
/**
* 更新样式
*/
fun upStyle() { fun upStyle() {
ChapterProvider.upStyle() ChapterProvider.upStyle()
curPage.upStyle() curPage.upStyle()
@ -506,6 +521,9 @@ class ReadView(context: Context, attrs: AttributeSet) :
nextPage.upStyle() nextPage.upStyle()
} }
/**
* 更新背景
*/
fun upBg() { fun upBg() {
ReadBookConfig.upBg(width, height) ReadBookConfig.upBg(width, height)
curPage.upBg() curPage.upBg()
@ -513,18 +531,27 @@ class ReadView(context: Context, attrs: AttributeSet) :
nextPage.upBg() nextPage.upBg()
} }
/**
* 更新背景透明度
*/
fun upBgAlpha() { fun upBgAlpha() {
curPage.upBgAlpha() curPage.upBgAlpha()
prevPage.upBgAlpha() prevPage.upBgAlpha()
nextPage.upBgAlpha() nextPage.upBgAlpha()
} }
/**
* 更新时间信息
*/
fun upTime() { fun upTime() {
curPage.upTime() curPage.upTime()
prevPage.upTime() prevPage.upTime()
nextPage.upTime() nextPage.upTime()
} }
/**
* 更新电量信息
*/
fun upBattery(battery: Int) { fun upBattery(battery: Int) {
curPage.upBattery(battery) curPage.upBattery(battery)
prevPage.upBattery(battery) prevPage.upBattery(battery)
@ -542,6 +569,9 @@ class ReadView(context: Context, attrs: AttributeSet) :
//TODO 未完成 //TODO 未完成
} }
/**
* @return 选择的文本
*/
fun getSelectText(): String { fun getSelectText(): String {
return curPage.selectedText return curPage.selectedText
} }

Loading…
Cancel
Save