Change rate to a String since Java is mad about the enum.
This commit is contained in:
parent
8b8ef62cbf
commit
6e05298f3d
@ -7,7 +7,7 @@ import androidx.room.PrimaryKey
|
||||
data class Expense (
|
||||
val name: String,
|
||||
val cost: String,
|
||||
val rate: Enum<Rate>,
|
||||
val rate: String, //Enum<Rate>,
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
val ID: Int = 0,
|
||||
)
|
@ -53,7 +53,8 @@ fun ExpenseDialogAdd(
|
||||
},
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Decimal)
|
||||
)
|
||||
/* Unsure what to do here yet, a simple Picker type does not seems to exist?
|
||||
// TBD / TODO: Unsure what to do here yet so that an Enum is possible.
|
||||
// A simple Picker type does not seems to exist? Why? Whyyy???
|
||||
TextField(
|
||||
value = state.rate,
|
||||
onValueChange = {
|
||||
@ -63,7 +64,7 @@ fun ExpenseDialogAdd(
|
||||
Text(text = "Rate")
|
||||
},
|
||||
)
|
||||
*/
|
||||
// */
|
||||
}
|
||||
},
|
||||
confirmButton = {
|
||||
|
@ -4,7 +4,7 @@ sealed interface ExpenseEvent {
|
||||
object SaveExpense: ExpenseEvent
|
||||
data class SetName(val name: String): ExpenseEvent
|
||||
data class SetCost(val cost: String): ExpenseEvent
|
||||
data class SetRate(val rate: Rate): ExpenseEvent
|
||||
data class SetRate(val rate: String): ExpenseEvent // TBD / TODO: Make this the enum.
|
||||
object ShowDialog: ExpenseEvent
|
||||
object HideDialog: ExpenseEvent
|
||||
data class SortExpenses(val sortType: SortType): ExpenseEvent
|
||||
|
@ -4,7 +4,7 @@ data class ExpenseState(
|
||||
val expenses: List<Expense> = emptyList(),
|
||||
val name: String = "",
|
||||
val cost: String = "",
|
||||
val rate: Rate = Rate.MONTHLY,
|
||||
val rate: String = "", // TBD / TODO: Rate = Rate.MONTHLY,
|
||||
val isAddingExpense: Boolean = false,
|
||||
val sortType: SortType = SortType.NAME,
|
||||
)
|
||||
|
@ -52,7 +52,7 @@ class ExpenseViewModel (
|
||||
|
||||
if (name.isBlank()
|
||||
|| cost.isBlank()
|
||||
//|| rate.isBlank() # TBD / TODO: Enable this once Rate is working.
|
||||
|| rate.isBlank() // TBD / TODO: Enable this once Rate is working.
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user