pull/1738/head
kunfei 3 years ago
parent 3086b51c92
commit 314292979c
  1. 4
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeBookSourceDialog.kt
  2. 4
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeChapterSourceDialog.kt

@ -10,6 +10,7 @@ import androidx.appcompat.widget.Toolbar
import androidx.core.os.bundleOf
import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
@ -213,7 +214,8 @@ class ChangeBookSourceDialog() : BaseDialogFragment(R.layout.dialog_book_change_
private fun scrollToDurSource() {
adapter.getItems().forEachIndexed { index, searchBook ->
if (searchBook.bookUrl == bookUrl) {
binding.recyclerView.scrollToPosition(index)
(binding.recyclerView.layoutManager as LinearLayoutManager)
.scrollToPositionWithOffset(index, 60.dpToPx())
return
}
}

@ -10,6 +10,7 @@ import androidx.core.os.bundleOf
import androidx.core.view.isVisible
import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
@ -247,7 +248,8 @@ class ChangeChapterSourceDialog() : BaseDialogFragment(R.layout.dialog_chapter_c
private fun scrollToDurSource() {
searchBookAdapter.getItems().forEachIndexed { index, searchBook ->
if (searchBook.bookUrl == bookUrl) {
binding.recyclerView.scrollToPosition(index)
(binding.recyclerView.layoutManager as LinearLayoutManager)
.scrollToPositionWithOffset(index, 60.dpToPx())
return
}
}

Loading…
Cancel
Save