feat: 优化代码

pull/111/head
kunfei 5 years ago
parent cf8c7f216b
commit 793d13e9dd
  1. 21
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt

@ -385,8 +385,14 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
}
}
/**
* 当前选择的文本
*/
override val selectedText: String get() = page_view.curPage.selectedText
/**
* 文本选择菜单操作
*/
override fun onMenuItemSelected(item: MenuItemImpl): Boolean {
when (item.itemId) {
R.id.menu_replace -> ReplaceEditDialog
@ -395,6 +401,9 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
return false
}
/**
* 文本选择菜单操作完成
*/
override fun onMenuActionFinally() {
textActionMenu?.dismiss()
page_view.pageDelegate?.isTextSelected = false
@ -431,12 +440,18 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
}
}
/**
* 更新内容
*/
override fun upContent(position: Int) {
launch {
page_view.upContent(position)
}
}
/**
* 更新视图
*/
override fun upView() {
launch {
ReadBook.curTextChapter?.let {
@ -454,12 +469,18 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
}
}
/**
* 更新进度条
*/
override fun upPageProgress() {
launch {
seek_read_page.progress = ReadBook.durPageIndex
}
}
/**
* 显示菜单
*/
override fun showMenuBar() {
read_menu.runMenuIn()
}

Loading…
Cancel
Save