From f916b66f2046b44bf3e543b7c96815aadda7790b Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 9 Aug 2019 22:41:48 +0800 Subject: [PATCH] up --- .../java/io/legado/app/ui/chapterlist/BookmarkFragment.kt | 3 ++- .../java/io/legado/app/ui/chapterlist/ChapterListActivity.kt | 1 + .../java/io/legado/app/ui/chapterlist/ChapterListFragment.kt | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/chapterlist/BookmarkFragment.kt b/app/src/main/java/io/legado/app/ui/chapterlist/BookmarkFragment.kt index ecb17d9cb..43c583e7f 100644 --- a/app/src/main/java/io/legado/app/ui/chapterlist/BookmarkFragment.kt +++ b/app/src/main/java/io/legado/app/ui/chapterlist/BookmarkFragment.kt @@ -25,6 +25,7 @@ class BookmarkFragment : VMBaseFragment(R.layout.fragment_ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) initRecyclerView() + initData() } private fun initRecyclerView() { @@ -36,7 +37,7 @@ class BookmarkFragment : VMBaseFragment(R.layout.fragment_ private fun initData() { bookmarkLiveData?.removeObservers(viewLifecycleOwner) - bookmarkLiveData = LivePagedListBuilder(App.db.bookmarkDao().observeByBook(""), 20).build() + bookmarkLiveData = LivePagedListBuilder(App.db.bookmarkDao().observeByBook(viewModel.bookUrl ?: ""), 20).build() bookmarkLiveData?.observe(viewLifecycleOwner, Observer { adapter.submitList(it) }) } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListActivity.kt b/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListActivity.kt index 62996558e..24576fe41 100644 --- a/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListActivity.kt +++ b/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListActivity.kt @@ -26,6 +26,7 @@ class ChapterListActivity : VMBaseActivity(R.layout.activi override fun onActivityCreated(savedInstanceState: Bundle?) { setSupportActionBar(toolbar) + viewModel.bookUrl = intent.getStringExtra("bookUrl") view_pager.adapter = TabFragmentPageAdapter(supportFragmentManager) tab_layout.setupWithViewPager(view_pager) } diff --git a/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListFragment.kt b/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListFragment.kt index ec6418a73..2435bb07a 100644 --- a/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListFragment.kt +++ b/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListFragment.kt @@ -19,7 +19,7 @@ class ChapterListFragment : VMBaseFragment(R.layout.fragme get() = getViewModelOfActivity(ChapterListViewModel::class.java) lateinit var adapter: ChapterListAdapter - var liveData: LiveData>? = null + private var liveData: LiveData>? = null override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -35,7 +35,7 @@ class ChapterListFragment : VMBaseFragment(R.layout.fragme private fun initData() { liveData?.removeObservers(viewLifecycleOwner) - liveData = LivePagedListBuilder(App.db.bookChapterDao().observeByBook(""), 30).build() + liveData = LivePagedListBuilder(App.db.bookChapterDao().observeByBook(viewModel.bookUrl ?: ""), 30).build() liveData?.observe(viewLifecycleOwner, Observer { adapter.submitList(it) }) } } \ No newline at end of file