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