diff --git a/app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt b/app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt index d93baa8fb..832f877ea 100644 --- a/app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt @@ -48,4 +48,7 @@ interface BookSourceDao { @Delete fun delete(vararg bookSource: BookSource) + + @get:Query("select min(customOrder) from book_sources") + val minOrder: Int } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/booksource/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/booksource/BookSourceActivity.kt index 4be37daca..cd824cf00 100644 --- a/app/src/main/java/io/legado/app/ui/booksource/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/booksource/BookSourceActivity.kt @@ -19,7 +19,6 @@ import io.legado.app.base.VMBaseActivity import io.legado.app.data.entities.BookSource import io.legado.app.help.ItemTouchCallback import io.legado.app.lib.theme.ATH -import io.legado.app.ui.bookshelf.BookshelfViewModel import io.legado.app.ui.qrcode.QrCodeActivity import io.legado.app.ui.sourceedit.SourceEditActivity import io.legado.app.utils.getViewModel @@ -30,11 +29,11 @@ import kotlinx.coroutines.launch import org.jetbrains.anko.startActivity import org.jetbrains.anko.startActivityForResult -class BookSourceActivity : VMBaseActivity(R.layout.activity_book_source), +class BookSourceActivity : VMBaseActivity(R.layout.activity_book_source), BookSourceAdapter.CallBack, SearchView.OnQueryTextListener { - override val viewModel: BookshelfViewModel - get() = getViewModel(BookshelfViewModel::class.java) + override val viewModel: BookSourceViewModel + get() = getViewModel(BookSourceViewModel::class.java) private lateinit var adapter: BookSourceAdapter private var bookSourceLiveDate: LiveData>? = null @@ -139,6 +138,10 @@ class BookSourceActivity : VMBaseActivity(R.layout.activity_ startActivity(Pair("data", bookSource.bookSourceUrl)) } + override fun topSource(bookSource: BookSource) { + viewModel.topSource(bookSource) + } + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) when (requestCode) { diff --git a/app/src/main/java/io/legado/app/ui/booksource/BookSourceAdapter.kt b/app/src/main/java/io/legado/app/ui/booksource/BookSourceAdapter.kt index 60680e083..1d6869cb4 100644 --- a/app/src/main/java/io/legado/app/ui/booksource/BookSourceAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/booksource/BookSourceAdapter.kt @@ -83,7 +83,7 @@ class BookSourceAdapter : PagedListAdapter