Added category-wise display setting (#5232)

* Added category-wise display setting

Co-authored-by: Rogavactive <30288842+Rogavactive@users.noreply.github.com>

* Use flag instead of preference

* Remove database call in LibraryItem

* Remove unnecessary code

Co-authored-by: Rogavactive <30288842+Rogavactive@users.noreply.github.com>
This commit is contained in:
Andreas
2021-06-05 16:25:34 +02:00
committed by GitHub
parent fff72b61df
commit a906e9b302
11 changed files with 153 additions and 25 deletions
@@ -12,8 +12,21 @@ interface Category : Serializable {
var flags: Int
private fun setFlags(flag: Int, mask: Int) {
flags = flags and mask.inv() or (flag and mask)
}
var displayMode: Int
get() = flags and MASK
set(mode) = setFlags(mode, MASK)
companion object {
const val COMPACT_GRID = 0b00000000
const val COMFORTABLE_GRID = 0b00000001
const val LIST = 0b00000010
const val MASK = 0b00000011
fun create(name: String): Category = CategoryImpl().apply {
this.name = name
}