Add more quick filters
This commit is contained in:
@@ -211,7 +211,10 @@ abstract class FavouritesDao {
|
||||
private fun ListFilterOption.getCondition(): String = when (this) {
|
||||
ListFilterOption.Macro.COMPLETED -> "EXISTS(SELECT * FROM history WHERE history.manga_id = favourites.manga_id AND history.percent >= 0.9999)"
|
||||
ListFilterOption.Macro.NEW_CHAPTERS -> "(SELECT chapters_new FROM tracks WHERE tracks.manga_id = favourites.manga_id) > 0"
|
||||
ListFilterOption.Macro.NSFW -> "manga.nsfw = 1"
|
||||
is ListFilterOption.Tag -> "EXISTS(SELECT * FROM manga_tags WHERE favourites.manga_id = manga_tags.manga_id AND tag_id = ${tag.toEntity().id})"
|
||||
else -> throw IllegalArgumentException("Unsupported option $this")
|
||||
ListFilterOption.Downloaded,
|
||||
is ListFilterOption.Favorite,
|
||||
ListFilterOption.Macro.FAVORITE -> throw IllegalArgumentException("Unsupported option $this")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,6 +175,7 @@ abstract class HistoryDao {
|
||||
ListFilterOption.Macro.COMPLETED -> "percent >= 0.9999"
|
||||
ListFilterOption.Macro.NEW_CHAPTERS -> "(SELECT chapters_new FROM tracks WHERE tracks.manga_id = history.manga_id) > 0"
|
||||
ListFilterOption.Macro.FAVORITE -> "EXISTS(SELECT * FROM favourites WHERE history.manga_id = favourites.manga_id)"
|
||||
ListFilterOption.Macro.NSFW -> "manga.nsfw = 1"
|
||||
is ListFilterOption.Tag -> "EXISTS(SELECT * FROM manga_tags WHERE history.manga_id = manga_tags.manga_id AND tag_id = ${tag.toEntity().id})"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ class HistoryListQuickFilter @Inject constructor(
|
||||
}
|
||||
add(ListFilterOption.Macro.COMPLETED)
|
||||
add(ListFilterOption.Macro.FAVORITE)
|
||||
add(ListFilterOption.Macro.NSFW)
|
||||
repository.getPopularTags(3).mapTo(this) {
|
||||
ListFilterOption.Tag(it)
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ sealed interface ListFilterOption {
|
||||
COMPLETED(R.string.status_completed, R.drawable.ic_state_finished),
|
||||
NEW_CHAPTERS(R.string.new_chapters, R.drawable.ic_updated),
|
||||
FAVORITE(R.string.favourites, R.drawable.ic_heart_outline),
|
||||
NSFW(R.string.nsfw, R.drawable.ic_nsfw),
|
||||
;
|
||||
|
||||
override val titleText: CharSequence?
|
||||
|
||||
20
app/src/main/res/drawable/ic_nsfw.xml
Normal file
20
app/src/main/res/drawable/ic_nsfw.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#0f0f0f"
|
||||
android:pathData="m4.8,1.4c-0.258,-0.344 -0.708,-0.485 -1.116,-0.349 -0.408,0.136 -0.684,0.518 -0.684,0.949v8c0,0.552 0.448,1 1,1s1,-0.448 1,-1v-5l4.2,5.6c0.258,0.344 0.708,0.485 1.116,0.349 0.408,-0.136 0.684,-0.518 0.684,-0.949v-8c0,-0.552 -0.448,-1 -1,-1 -0.552,0 -1,0.448 -1,1v5z" />
|
||||
<path
|
||||
android:fillColor="#0f0f0f"
|
||||
android:pathData="m15,1c-1.105,0 -2,0.895 -2,2v2c0,1.105 0.895,2 2,2h4v2h-5c-0.552,0 -1,0.448 -1,1 0,0.552 0.448,1 1,1h5c1.105,0 2,-0.896 2,-2v-2c0,-1.105 -0.895,-2 -2,-2h-4v-2h5c0.552,0 1,-0.448 1,-1 0,-0.552 -0.448,-1 -1,-1z" />
|
||||
<path
|
||||
android:fillColor="#0f0f0f"
|
||||
android:pathData="m3,14c0,-0.552 0.448,-1 1,-1h6c0.552,0 1,0.448 1,1s-0.448,1 -1,1h-5v2h5c0.552,0 1,0.448 1,1 0,0.552 -0.448,1 -1,1h-5v3c0,0.552 -0.448,1 -1,1s-1,-0.448 -1,-1z" />
|
||||
<path
|
||||
android:fillColor="#0f0f0f"
|
||||
android:pathData="m15,14c0,-0.552 -0.448,-1 -1,-1s-1,0.448 -1,1v8c0,0.449 0.3,0.844 0.733,0.964 0.433,0.12 0.893,-0.064 1.124,-0.449l2.142,-3.571 2.142,3.571c0.231,0.385 0.691,0.569 1.124,0.449 0.433,-0.12 0.733,-0.514 0.733,-0.964v-8c0,-0.552 -0.448,-1 -1,-1s-1,0.448 -1,1v4.39l-1.143,-1.904c-0.181,-0.301 -0.506,-0.486 -0.858,-0.486s-0.677,0.184 -0.858,0.486l-1.143,1.904z" />
|
||||
</vector>
|
||||
Reference in New Issue
Block a user