|
|
@ -89,7 +89,8 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo |
|
|
|
override val isInitFinish: Boolean get() = viewModel.isInitFinish |
|
|
|
override val isInitFinish: Boolean get() = viewModel.isInitFinish |
|
|
|
|
|
|
|
|
|
|
|
private val mHandler = Handler() |
|
|
|
private val mHandler = Handler() |
|
|
|
private val keepScreenRunnable: Runnable = Runnable { Help.keepScreenOn(window, false) } |
|
|
|
private val keepScreenRunnable: Runnable = |
|
|
|
|
|
|
|
Runnable { ReadBookActivityHelp.keepScreenOn(window, false) } |
|
|
|
private val autoPageRunnable: Runnable = Runnable { autoPagePlus() } |
|
|
|
private val autoPageRunnable: Runnable = Runnable { autoPagePlus() } |
|
|
|
override var autoPageProgress = 0 |
|
|
|
override var autoPageProgress = 0 |
|
|
|
override var isAutoPage = false |
|
|
|
override var isAutoPage = false |
|
|
@ -100,12 +101,12 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo |
|
|
|
|
|
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) { |
|
|
|
override fun onCreate(savedInstanceState: Bundle?) { |
|
|
|
ReadBook.msg = null |
|
|
|
ReadBook.msg = null |
|
|
|
Help.setOrientation(this) |
|
|
|
ReadBookActivityHelp.setOrientation(this) |
|
|
|
super.onCreate(savedInstanceState) |
|
|
|
super.onCreate(savedInstanceState) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onActivityCreated(savedInstanceState: Bundle?) { |
|
|
|
override fun onActivityCreated(savedInstanceState: Bundle?) { |
|
|
|
Help.upLayoutInDisplayCutoutMode(window) |
|
|
|
ReadBookActivityHelp.upLayoutInDisplayCutoutMode(window) |
|
|
|
initView() |
|
|
|
initView() |
|
|
|
upScreenTimeOut() |
|
|
|
upScreenTimeOut() |
|
|
|
ReadBook.callBack = this |
|
|
|
ReadBook.callBack = this |
|
|
@ -248,8 +249,8 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo |
|
|
|
viewModel.refreshContent(it) |
|
|
|
viewModel.refreshContent(it) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
R.id.menu_download -> Help.showDownloadDialog(this) |
|
|
|
R.id.menu_download -> ReadBookActivityHelp.showDownloadDialog(this) |
|
|
|
R.id.menu_add_bookmark -> Help.showBookMark(this) |
|
|
|
R.id.menu_add_bookmark -> ReadBookActivityHelp.showBookMark(this) |
|
|
|
R.id.menu_copy_text -> |
|
|
|
R.id.menu_copy_text -> |
|
|
|
TextDialog.show(supportFragmentManager, ReadBook.curTextChapter?.getContent()) |
|
|
|
TextDialog.show(supportFragmentManager, ReadBook.curTextChapter?.getContent()) |
|
|
|
R.id.menu_update_toc -> ReadBook.book?.let { |
|
|
|
R.id.menu_update_toc -> ReadBook.book?.let { |
|
|
@ -276,7 +277,7 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo |
|
|
|
Pair("loginUrl", it.loginUrl) |
|
|
|
Pair("loginUrl", it.loginUrl) |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
R.id.menu_set_charset -> Help.showCharsetConfig(this) |
|
|
|
R.id.menu_set_charset -> ReadBookActivityHelp.showCharsetConfig(this) |
|
|
|
} |
|
|
|
} |
|
|
|
return super.onCompatOptionsItemSelected(item) |
|
|
|
return super.onCompatOptionsItemSelected(item) |
|
|
|
} |
|
|
|
} |
|
|
@ -693,7 +694,7 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo |
|
|
|
* 更新状态栏,导航栏 |
|
|
|
* 更新状态栏,导航栏 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
override fun upSystemUiVisibility() { |
|
|
|
override fun upSystemUiVisibility() { |
|
|
|
Help.upSystemUiVisibility(window, !read_menu.isVisible) |
|
|
|
ReadBookActivityHelp.upSystemUiVisibility(window, !read_menu.isVisible) |
|
|
|
upNavigationBarColor() |
|
|
|
upNavigationBarColor() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -854,16 +855,16 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
override fun screenOffTimerStart() { |
|
|
|
override fun screenOffTimerStart() { |
|
|
|
if (screenTimeOut < 0) { |
|
|
|
if (screenTimeOut < 0) { |
|
|
|
Help.keepScreenOn(window, true) |
|
|
|
ReadBookActivityHelp.keepScreenOn(window, true) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
val t = screenTimeOut - sysScreenOffTime |
|
|
|
val t = screenTimeOut - sysScreenOffTime |
|
|
|
if (t > 0) { |
|
|
|
if (t > 0) { |
|
|
|
mHandler.removeCallbacks(keepScreenRunnable) |
|
|
|
mHandler.removeCallbacks(keepScreenRunnable) |
|
|
|
Help.keepScreenOn(window, true) |
|
|
|
ReadBookActivityHelp.keepScreenOn(window, true) |
|
|
|
mHandler.postDelayed(keepScreenRunnable, screenTimeOut) |
|
|
|
mHandler.postDelayed(keepScreenRunnable, screenTimeOut) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Help.keepScreenOn(window, false) |
|
|
|
ReadBookActivityHelp.keepScreenOn(window, false) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |