pull/36/head
kunfei 5 years ago
parent 149dd41544
commit 39c8a1d06b
  1. 2
      app/src/main/java/io/legado/app/data/dao/BookDao.kt
  2. 2
      app/src/main/java/io/legado/app/data/dao/SearchKeywordDao.kt
  3. 6
      app/src/main/res/layout/activity_book_search.xml

@ -24,7 +24,7 @@ interface BookDao {
@Query("SELECT bookUrl FROM books WHERE `group` = :group")
fun observeUrlsByGroup(group: Int): LiveData<List<String>>
@Query("SELECT bookUrl FROM books WHERE name like '%' || :key || '%' or author like '%' || :key || '%'")
@Query("SELECT * FROM books WHERE name like '%'||:key||'%' or author like '%'||:key||'%'")
fun liveDataSearch(key: String): LiveData<List<Book>>
@Query("SELECT * FROM books WHERE `name` in (:names)")

@ -14,7 +14,7 @@ interface SearchKeywordDao {
@Query("SELECT * FROM search_keywords ORDER BY lastUseTime DESC")
fun liveDataByTime(): LiveData<List<SearchKeyword>>
@Query("SELECT * FROM search_keywords where word like '%' || :key || '%' ORDER BY usage DESC")
@Query("SELECT * FROM search_keywords where word like '%'||:key||'%' ORDER BY usage DESC")
fun liveDataSearch(key: String): LiveData<List<SearchKeyword>>
@Insert(onConflict = OnConflictStrategy.REPLACE)

@ -49,12 +49,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="6dp"
android:text="@string/bookshelf" />
android:text="@string/bookshelf"
android:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_bookshelf_search"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:visibility="gone" />
<TextView
android:id="@+id/tv_history"

Loading…
Cancel
Save