diff --git a/app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt b/app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt index 80015d2a6..462c68eff 100644 --- a/app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt @@ -52,6 +52,7 @@ class ChapterListAdapter(context: Context, val callback: Callback) : && oldItem.isPay == newItem.isPay && oldItem.title == newItem.title && oldItem.tag == newItem.tag + && oldItem.wordCount == newItem.wordCount && oldItem.isVolume == newItem.isVolume } diff --git a/app/src/main/java/io/legado/app/ui/book/toc/ChapterListFragment.kt b/app/src/main/java/io/legado/app/ui/book/toc/ChapterListFragment.kt index 460ae7132..37f87cbd3 100644 --- a/app/src/main/java/io/legado/app/ui/book/toc/ChapterListFragment.kt +++ b/app/src/main/java/io/legado/app/ui/book/toc/ChapterListFragment.kt @@ -152,6 +152,10 @@ class ChapterListFragment : VMBaseFragment(R.layout.fragment_chapt adapter.upDisplayTitles(mLayoutManager.findFirstVisibleItemPosition()) } + override fun upAdapter() { + adapter.notifyItemRangeChanged(0, adapter.itemCount) + } + override val scope: CoroutineScope get() = lifecycleScope diff --git a/app/src/main/java/io/legado/app/ui/book/toc/TocActivity.kt b/app/src/main/java/io/legado/app/ui/book/toc/TocActivity.kt index 6bd508d3a..bc7c0542a 100644 --- a/app/src/main/java/io/legado/app/ui/book/toc/TocActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/toc/TocActivity.kt @@ -169,6 +169,7 @@ class TocActivity : VMBaseActivity(), R.id.menu_load_word_count -> { AppConfig.tocCountWords = !item.isChecked + viewModel.upChapterListAdapter() } R.id.menu_export_bookmark -> exportDir.launch { diff --git a/app/src/main/java/io/legado/app/ui/book/toc/TocViewModel.kt b/app/src/main/java/io/legado/app/ui/book/toc/TocViewModel.kt index 8914b39bb..316ac5bca 100644 --- a/app/src/main/java/io/legado/app/ui/book/toc/TocViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/toc/TocViewModel.kt @@ -73,6 +73,10 @@ class TocViewModel(application: Application) : BaseViewModel(application) { bookMarkCallBack?.upBookmark(newText) } + fun upChapterListAdapter() { + chapterListCallBack?.upAdapter() + } + fun saveBookmark(treeUri: Uri) { execute { val book = bookData.value @@ -119,6 +123,8 @@ class TocViewModel(application: Application) : BaseViewModel(application) { fun upChapterList(searchKey: String?) fun clearDisplayTitle() + + fun upAdapter() } interface BookmarkCallBack { diff --git a/app/src/main/res/layout/item_chapter_list.xml b/app/src/main/res/layout/item_chapter_list.xml index 9ea8805d8..879053eb1 100644 --- a/app/src/main/res/layout/item_chapter_list.xml +++ b/app/src/main/res/layout/item_chapter_list.xml @@ -14,11 +14,18 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:singleLine="true" - app:layout_constraintBottom_toTopOf="@id/tv_word_count" + app:layout_constraintBottom_toTopOf="@id/barrier" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toLeftOf="@+id/iv_checked" app:layout_constraintTop_toTopOf="parent" /> + + + app:layout_constraintTop_toBottomOf="@+id/barrier" />