Change rate to a String since Java is mad about the enum.
This commit is contained in:
		@@ -7,7 +7,7 @@ import androidx.room.PrimaryKey
 | 
				
			|||||||
data class Expense (
 | 
					data class Expense (
 | 
				
			||||||
    val name: String,
 | 
					    val name: String,
 | 
				
			||||||
    val cost: String,
 | 
					    val cost: String,
 | 
				
			||||||
    val rate: Enum<Rate>,
 | 
					    val rate: String, //Enum<Rate>,
 | 
				
			||||||
    @PrimaryKey(autoGenerate = true)
 | 
					    @PrimaryKey(autoGenerate = true)
 | 
				
			||||||
    val ID: Int = 0,
 | 
					    val ID: Int = 0,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
@@ -53,7 +53,8 @@ fun ExpenseDialogAdd(
 | 
				
			|||||||
                    },
 | 
					                    },
 | 
				
			||||||
                    keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Decimal)
 | 
					                    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(
 | 
					                TextField(
 | 
				
			||||||
                    value = state.rate,
 | 
					                    value = state.rate,
 | 
				
			||||||
                    onValueChange = {
 | 
					                    onValueChange = {
 | 
				
			||||||
@@ -63,7 +64,7 @@ fun ExpenseDialogAdd(
 | 
				
			|||||||
                        Text(text = "Rate")
 | 
					                        Text(text = "Rate")
 | 
				
			||||||
                    },
 | 
					                    },
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
                */
 | 
					                // */
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        confirmButton = {
 | 
					        confirmButton = {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ sealed interface ExpenseEvent {
 | 
				
			|||||||
    object SaveExpense: ExpenseEvent
 | 
					    object SaveExpense: ExpenseEvent
 | 
				
			||||||
    data class SetName(val name: String): ExpenseEvent
 | 
					    data class SetName(val name: String): ExpenseEvent
 | 
				
			||||||
    data class SetCost(val cost: 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 ShowDialog: ExpenseEvent
 | 
				
			||||||
    object HideDialog: ExpenseEvent
 | 
					    object HideDialog: ExpenseEvent
 | 
				
			||||||
    data class SortExpenses(val sortType: SortType): ExpenseEvent
 | 
					    data class SortExpenses(val sortType: SortType): ExpenseEvent
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ data class ExpenseState(
 | 
				
			|||||||
    val expenses: List<Expense> = emptyList(),
 | 
					    val expenses: List<Expense> = emptyList(),
 | 
				
			||||||
    val name: String = "",
 | 
					    val name: String = "",
 | 
				
			||||||
    val cost: String = "",
 | 
					    val cost: String = "",
 | 
				
			||||||
    val rate: Rate = Rate.MONTHLY,
 | 
					    val rate: String = "", // TBD / TODO: Rate = Rate.MONTHLY,
 | 
				
			||||||
    val isAddingExpense: Boolean = false,
 | 
					    val isAddingExpense: Boolean = false,
 | 
				
			||||||
    val sortType: SortType = SortType.NAME,
 | 
					    val sortType: SortType = SortType.NAME,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,7 +52,7 @@ class ExpenseViewModel (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                if (name.isBlank()
 | 
					                if (name.isBlank()
 | 
				
			||||||
                    || cost.isBlank()
 | 
					                    || cost.isBlank()
 | 
				
			||||||
                    //|| rate.isBlank() # TBD / TODO: Enable this once Rate is working.
 | 
					                    || rate.isBlank() // TBD / TODO: Enable this once Rate is working.
 | 
				
			||||||
                ) {
 | 
					                ) {
 | 
				
			||||||
                    return
 | 
					                    return
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user