|
|
|
@ -416,7 +416,7 @@ class ReadBookActivity : ReadBookBaseActivity(), |
|
|
|
|
* view触摸,文字选择 |
|
|
|
|
*/ |
|
|
|
|
@SuppressLint("ClickableViewAccessibility") |
|
|
|
|
override fun onTouch(v: View, event: MotionEvent): Boolean = with(binding) { |
|
|
|
|
override fun onTouch(v: View, event: MotionEvent): Boolean = binding.run { |
|
|
|
|
when (event.action) { |
|
|
|
|
MotionEvent.ACTION_DOWN -> textActionMenu.dismiss() |
|
|
|
|
MotionEvent.ACTION_MOVE -> { |
|
|
|
@ -439,7 +439,7 @@ class ReadBookActivity : ReadBookBaseActivity(), |
|
|
|
|
/** |
|
|
|
|
* 更新文字选择开始位置 |
|
|
|
|
*/ |
|
|
|
|
override fun upSelectedStart(x: Float, y: Float, top: Float) = with(binding) { |
|
|
|
|
override fun upSelectedStart(x: Float, y: Float, top: Float) = binding.run { |
|
|
|
|
cursorLeft.x = x - cursorLeft.width |
|
|
|
|
cursorLeft.y = y |
|
|
|
|
cursorLeft.visible(true) |
|
|
|
@ -450,7 +450,7 @@ class ReadBookActivity : ReadBookBaseActivity(), |
|
|
|
|
/** |
|
|
|
|
* 更新文字选择结束位置 |
|
|
|
|
*/ |
|
|
|
|
override fun upSelectedEnd(x: Float, y: Float) = with(binding) { |
|
|
|
|
override fun upSelectedEnd(x: Float, y: Float) = binding.run { |
|
|
|
|
cursorRight.x = x |
|
|
|
|
cursorRight.y = y |
|
|
|
|
cursorRight.visible(true) |
|
|
|
@ -459,7 +459,7 @@ class ReadBookActivity : ReadBookBaseActivity(), |
|
|
|
|
/** |
|
|
|
|
* 取消文字选择 |
|
|
|
|
*/ |
|
|
|
|
override fun onCancelSelect() = with(binding) { |
|
|
|
|
override fun onCancelSelect() = binding.run { |
|
|
|
|
cursorLeft.invisible() |
|
|
|
|
cursorRight.invisible() |
|
|
|
|
textActionMenu.dismiss() |
|
|
|
@ -468,7 +468,7 @@ class ReadBookActivity : ReadBookBaseActivity(), |
|
|
|
|
/** |
|
|
|
|
* 显示文本操作菜单 |
|
|
|
|
*/ |
|
|
|
|
override fun showTextActionMenu() = with(binding) { |
|
|
|
|
override fun showTextActionMenu() = binding.run { |
|
|
|
|
textActionMenu.contentView.measure( |
|
|
|
|
View.MeasureSpec.UNSPECIFIED, |
|
|
|
|
View.MeasureSpec.UNSPECIFIED |
|
|
|
@ -543,7 +543,7 @@ class ReadBookActivity : ReadBookBaseActivity(), |
|
|
|
|
/** |
|
|
|
|
* 文本选择菜单操作完成 |
|
|
|
|
*/ |
|
|
|
|
override fun onMenuActionFinally() = with(binding) { |
|
|
|
|
override fun onMenuActionFinally() = binding.run { |
|
|
|
|
textActionMenu.dismiss() |
|
|
|
|
readView.curPage.cancelSelect() |
|
|
|
|
readView.isTextSelected = false |
|
|
|
@ -796,7 +796,7 @@ class ReadBookActivity : ReadBookBaseActivity(), |
|
|
|
|
/** |
|
|
|
|
* colorSelectDialog |
|
|
|
|
*/ |
|
|
|
|
override fun onColorSelected(dialogId: Int, color: Int) = with(ReadBookConfig.durConfig) { |
|
|
|
|
override fun onColorSelected(dialogId: Int, color: Int) = ReadBookConfig.durConfig.run { |
|
|
|
|
when (dialogId) { |
|
|
|
|
TEXT_COLOR -> { |
|
|
|
|
setCurTextColor(color) |
|
|
|
@ -899,7 +899,7 @@ class ReadBookActivity : ReadBookBaseActivity(), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun observeLiveBus() = with(binding) { |
|
|
|
|
override fun observeLiveBus() = binding.run { |
|
|
|
|
super.observeLiveBus() |
|
|
|
|
observeEvent<String>(EventBus.TIME_CHANGED) { readView.upTime() } |
|
|
|
|
observeEvent<Int>(EventBus.BATTERY_CHANGED) { readView.upBattery(it) } |
|
|
|
|