From fff0788b8d1892fa1f2de332ac46d45791bfb0bf Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 15 Oct 2019 11:54:51 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/main/bookshelf/BooksFragment.kt | 8 ++++++-- .../io/legado/app/ui/main/bookshelf/BooksViewModel.kt | 10 ++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 app/src/main/java/io/legado/app/ui/main/bookshelf/BooksViewModel.kt diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BooksFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/BooksFragment.kt index 6575d4933..e9b5051b2 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BooksFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/BooksFragment.kt @@ -11,7 +11,7 @@ import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.LinearLayoutManager import io.legado.app.App import io.legado.app.R -import io.legado.app.base.BaseFragment +import io.legado.app.base.VMBaseFragment import io.legado.app.constant.Bus import io.legado.app.data.entities.Book import io.legado.app.lib.theme.ATH @@ -19,15 +19,19 @@ import io.legado.app.lib.theme.accentColor import io.legado.app.ui.book.info.BookInfoActivity import io.legado.app.ui.book.read.ReadBookActivity import io.legado.app.ui.main.MainViewModel +import io.legado.app.utils.getViewModel import io.legado.app.utils.getViewModelOfActivity import io.legado.app.utils.observeEvent import kotlinx.android.synthetic.main.fragment_books.* import org.jetbrains.anko.startActivity -class BooksFragment : BaseFragment(R.layout.fragment_books), +class BooksFragment : VMBaseFragment(R.layout.fragment_books), BooksAdapter.CallBack { + override val viewModel: BooksViewModel + get() = getViewModel(BooksViewModel::class.java) + companion object { fun newInstance(position: Int): BooksFragment { return BooksFragment().apply { diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BooksViewModel.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/BooksViewModel.kt new file mode 100644 index 000000000..ef6d08fbb --- /dev/null +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/BooksViewModel.kt @@ -0,0 +1,10 @@ +package io.legado.app.ui.main.bookshelf + +import android.app.Application +import io.legado.app.base.BaseViewModel + + +class BooksViewModel(application: Application) : BaseViewModel(application) { + + +} \ No newline at end of file