优化
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -152,6 +152,10 @@ class ChapterListFragment : VMBaseFragment<TocViewModel>(R.layout.fragment_chapt
|
||||
adapter.upDisplayTitles(mLayoutManager.findFirstVisibleItemPosition())
|
||||
}
|
||||
|
||||
override fun upAdapter() {
|
||||
adapter.notifyItemRangeChanged(0, adapter.itemCount)
|
||||
}
|
||||
|
||||
override val scope: CoroutineScope
|
||||
get() = lifecycleScope
|
||||
|
||||
|
||||
@@ -169,6 +169,7 @@ class TocActivity : VMBaseActivity<ActivityChapterListBinding, TocViewModel>(),
|
||||
|
||||
R.id.menu_load_word_count -> {
|
||||
AppConfig.tocCountWords = !item.isChecked
|
||||
viewModel.upChapterListAdapter()
|
||||
}
|
||||
|
||||
R.id.menu_export_bookmark -> exportDir.launch {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user