mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-23 19:32:16 +00:00
Add: Favorites category
This commit is contained in:
parent
4a665df1f5
commit
5ed61120dd
@ -50,6 +50,7 @@ const val ROW_CAN_UPDATE = "can_update"
|
|||||||
const val ROW_MATCH_RANK = "match_rank"
|
const val ROW_MATCH_RANK = "match_rank"
|
||||||
const val ROW_IGNORED_VERSION = "ignoredVersion"
|
const val ROW_IGNORED_VERSION = "ignoredVersion"
|
||||||
const val ROW_IGNORE_UPDATES = "ignoreUpdates"
|
const val ROW_IGNORE_UPDATES = "ignoreUpdates"
|
||||||
|
const val ROW_FAVORITE = "favorite"
|
||||||
|
|
||||||
const val RELEASE_STATE_NONE = 0
|
const val RELEASE_STATE_NONE = 0
|
||||||
const val RELEASE_STATE_SUGGESTED = 1
|
const val RELEASE_STATE_SUGGESTED = 1
|
||||||
|
@ -16,6 +16,7 @@ import com.machiav3lli.fdroid.ROW_COMPATIBLE
|
|||||||
import com.machiav3lli.fdroid.ROW_DESCRIPTION
|
import com.machiav3lli.fdroid.ROW_DESCRIPTION
|
||||||
import com.machiav3lli.fdroid.ROW_DONATES
|
import com.machiav3lli.fdroid.ROW_DONATES
|
||||||
import com.machiav3lli.fdroid.ROW_ENABLED
|
import com.machiav3lli.fdroid.ROW_ENABLED
|
||||||
|
import com.machiav3lli.fdroid.ROW_FAVORITE
|
||||||
import com.machiav3lli.fdroid.ROW_ICON
|
import com.machiav3lli.fdroid.ROW_ICON
|
||||||
import com.machiav3lli.fdroid.ROW_ID
|
import com.machiav3lli.fdroid.ROW_ID
|
||||||
import com.machiav3lli.fdroid.ROW_IGNORED_VERSION
|
import com.machiav3lli.fdroid.ROW_IGNORED_VERSION
|
||||||
@ -191,6 +192,8 @@ interface ProductDao : BaseDao<Product> {
|
|||||||
} else if (section is Section.Repository) {
|
} else if (section is Section.Repository) {
|
||||||
builder += "AND $TABLE_PRODUCT.$ROW_REPOSITORY_ID = ?"
|
builder += "AND $TABLE_PRODUCT.$ROW_REPOSITORY_ID = ?"
|
||||||
builder %= section.id.toString()
|
builder %= section.id.toString()
|
||||||
|
} else if (section is Section.FAVORITE) {
|
||||||
|
builder += "AND COALESCE($TABLE_EXTRAS.$ROW_FAVORITE, 0) != 0"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter only apps that have some matching score to the search query
|
// Filter only apps that have some matching score to the search query
|
||||||
|
@ -10,6 +10,12 @@ sealed class Section : KParcelable {
|
|||||||
val CREATOR = KParcelable.creator { All }
|
val CREATOR = KParcelable.creator { All }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
object FAVORITE : Section() {
|
||||||
|
@Suppress("unused")
|
||||||
|
@JvmField
|
||||||
|
val CREATOR = KParcelable.creator { FAVORITE }
|
||||||
|
}
|
||||||
|
|
||||||
data class Category(val name: String) : Section() {
|
data class Category(val name: String) : Section() {
|
||||||
override fun writeToParcel(dest: Parcel, flags: Int) {
|
override fun writeToParcel(dest: Parcel, flags: Int) {
|
||||||
dest.writeString(name)
|
dest.writeString(name)
|
||||||
|
@ -120,12 +120,14 @@ class ExploreFragment : MainNavFragmentX() {
|
|||||||
CategoryChipList(
|
CategoryChipList(
|
||||||
list = listOf(
|
list = listOf(
|
||||||
stringResource(id = R.string.all_applications),
|
stringResource(id = R.string.all_applications),
|
||||||
|
stringResource(id = R.string.favorite_applications),
|
||||||
*categories.sorted().toTypedArray()
|
*categories.sorted().toTypedArray()
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
viewModel.sections.postValue(
|
viewModel.sections.postValue(
|
||||||
when (it) {
|
when (it) {
|
||||||
getString(R.string.all_applications) -> Section.All
|
getString(R.string.all_applications) -> Section.All
|
||||||
|
getString(R.string.favorite_applications) -> Section.FAVORITE
|
||||||
else -> Section.Category(it)
|
else -> Section.Category(it)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -208,4 +208,5 @@
|
|||||||
<string name="releases">Releases</string>
|
<string name="releases">Releases</string>
|
||||||
<string name="no_updates_available">No versions available</string>
|
<string name="no_updates_available">No versions available</string>
|
||||||
<string name="dynamic">System dynamic</string>
|
<string name="dynamic">System dynamic</string>
|
||||||
|
<string name="favorite_applications">Favorites</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user