pull/1705/head
kunfei 3 years ago
parent 79b3f148b4
commit 66e1f22ef0
  1. 2
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt
  2. 2
      app/src/main/java/io/legado/app/ui/replace/edit/ReplaceEditActivity.kt
  3. 2
      app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt
  4. 4
      app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt

@ -65,6 +65,7 @@ class BookSourceEditActivity :
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
softKeyboardTool.attachToWindow(window)
initView()
viewModel.initData(intent) {
upRecyclerView()
@ -135,7 +136,6 @@ class BookSourceEditActivity :
private fun initView() {
binding.recyclerView.setEdgeEffectColor(primaryColor)
window.decorView.viewTreeObserver.addOnGlobalLayoutListener(softKeyboardTool)
binding.recyclerView.layoutManager = LinearLayoutManager(this)
binding.recyclerView.adapter = adapter
binding.tabLayout.setBackgroundColor(backgroundColor)

@ -52,7 +52,7 @@ class ReplaceEditActivity :
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
window.decorView.viewTreeObserver.addOnGlobalLayoutListener(softKeyboardTool)
softKeyboardTool.attachToWindow(window)
viewModel.initData(intent) {
upReplaceView(it)
}

@ -44,6 +44,7 @@ class RssSourceEditActivity :
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
softKeyboardTool.attachToWindow(window)
initView()
viewModel.initData(intent) {
upRecyclerView()
@ -136,7 +137,6 @@ class RssSourceEditActivity :
private fun initView() {
binding.recyclerView.setEdgeEffectColor(primaryColor)
window.decorView.viewTreeObserver.addOnGlobalLayoutListener(softKeyboardTool)
binding.recyclerView.adapter = adapter
}

@ -47,6 +47,10 @@ class KeyboardToolPop(
upAdapterData()
}
fun attachToWindow(window: Window) {
window.decorView.viewTreeObserver.addOnGlobalLayoutListener(this)
}
override fun onGlobalLayout() {
val rect = Rect()
// 获取当前页面窗口的显示范围

Loading…
Cancel
Save