mirror of
https://github.com/gedoor/legado.git
synced 2025-01-07 03:06:58 +08:00
优化
This commit is contained in:
parent
5477756783
commit
ac34ee8d1c
@ -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 {
|
||||
|
@ -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" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/barrier"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="top"
|
||||
app:constraint_referenced_ids="tv_word_count,tv_tag" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_word_count"
|
||||
android:layout_width="wrap_content"
|
||||
@ -29,7 +36,7 @@
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_chapter_name"
|
||||
app:layout_constraintTop_toBottomOf="@+id/barrier"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
|
||||
<TextView
|
||||
@ -42,7 +49,7 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/tv_word_count"
|
||||
app:layout_constraintRight_toLeftOf="@+id/iv_checked"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_chapter_name" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/barrier" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_checked"
|
||||
|
Loading…
Reference in New Issue
Block a user