Added colour to StudIPEvent.kt to implement at a later date in an effort to prepare the app for release without needing to migrate (= nuke) the database once the functionality will be implemented

This commit is contained in:
denizk0461
2023-04-23 21:40:04 +02:00
parent ca89e68a91
commit 8d6a15c4d5
10 changed files with 168 additions and 66 deletions
@@ -17,7 +17,7 @@ import com.denizk0461.studip.model.*
OfferCategory::class,
OfferItem::class
],
version = 11,
version = 12,
)
abstract class AppDatabase : RoomDatabase() {
@@ -0,0 +1,26 @@
package com.denizk0461.studip.model
import com.denizk0461.studip.R
/**
* Enumeration used to save and apply custom colours to Stud.IP events.
* TODO finish implementation
*
* @param colourId resource ID of the colour
*/
enum class StudIPColour(val colourId: Int) {
DEFAULT(R.attr.scheduleColorDefault);
companion object {
/**
* Retrieve a StudIPColour object by its ordinal.
*
* @param ordinal numeric position of the colour in the enumeration
* @return enum object
*/
fun getEnumValue(ordinal: Int): StudIPColour =
StudIPColour.values()[ordinal]
}
}
@@ -24,7 +24,7 @@ data class StudIPEvent(
val day: Int,
val timeslotStart: String,
val timeslotEnd: String,
val colour: String = "000000",
val colour: Int = 0,
) {
/**