mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-02 02:13:33 +00:00
Search page renewed
This commit is contained in:
parent
a4dc5f643d
commit
a7fd7688ab
13 changed files with 358 additions and 174 deletions
|
|
@ -7,6 +7,7 @@ import androidx.room.Insert;
|
|||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
|
||||
import com.cappielloantonio.play.model.Artist;
|
||||
import com.cappielloantonio.play.model.Genre;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -27,4 +28,10 @@ public interface GenreDao {
|
|||
|
||||
@Query("DELETE FROM genre")
|
||||
void deleteAll();
|
||||
|
||||
@Query("SELECT * FROM genre WHERE name LIKE '%' || :name || '%'")
|
||||
LiveData<List<Genre>> searchGenre(String name);
|
||||
|
||||
@Query("SELECT name FROM genre WHERE name LIKE :query || '%' OR name like '% ' || :query || '%' GROUP BY name LIMIT :number")
|
||||
List<String> searchSuggestions(String query, int number);
|
||||
}
|
||||
|
|
@ -13,12 +13,15 @@ import java.util.List;
|
|||
|
||||
@Dao
|
||||
public interface RecentSearchDao {
|
||||
@Query("SELECT * FROM recent_search GROUP BY search ORDER BY id DESC LIMIT :limit")
|
||||
LiveData<List<RecentSearch>> getLast(int limit);
|
||||
@Query("SELECT * FROM recent_search GROUP BY search ORDER BY search DESC LIMIT :limit")
|
||||
List<String> getRecent(int limit);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insert(RecentSearch search);
|
||||
|
||||
@Delete
|
||||
void delete(RecentSearch search);
|
||||
|
||||
@Query("DELETE FROM recent_search")
|
||||
void deleteAll();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue