From a4513394d1187a44c1cdf3e6a8305673e3c4afb9 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Thu, 9 Jan 2025 14:19:03 -0700 Subject: [PATCH] Add state as well as fix SortType needs. --- .../java/com/hyperling/expensetracker/ExpenseEvent.kt | 2 +- .../java/com/hyperling/expensetracker/ExpenseState.kt | 10 ++++++++++ .../main/java/com/hyperling/expensetracker/SortType.kt | 7 +++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/com/hyperling/expensetracker/ExpenseState.kt create mode 100644 app/src/main/java/com/hyperling/expensetracker/SortType.kt diff --git a/app/src/main/java/com/hyperling/expensetracker/ExpenseEvent.kt b/app/src/main/java/com/hyperling/expensetracker/ExpenseEvent.kt index b342f92..5e474dd 100644 --- a/app/src/main/java/com/hyperling/expensetracker/ExpenseEvent.kt +++ b/app/src/main/java/com/hyperling/expensetracker/ExpenseEvent.kt @@ -7,6 +7,6 @@ sealed interface ExpenseEvent { data class SetRate(val rate: Rate): ExpenseEvent object ShowDialog: ExpenseEvent object HideDialog: ExpenseEvent - data class SortExpenses(val rate: Rate): ExpenseEvent + data class SortExpenses(val sortType: SortType): ExpenseEvent data class DeleteExpense(val expense: Expense): ExpenseEvent } \ No newline at end of file diff --git a/app/src/main/java/com/hyperling/expensetracker/ExpenseState.kt b/app/src/main/java/com/hyperling/expensetracker/ExpenseState.kt new file mode 100644 index 0000000..620c14e --- /dev/null +++ b/app/src/main/java/com/hyperling/expensetracker/ExpenseState.kt @@ -0,0 +1,10 @@ +package com.hyperling.expensetracker + +data class ExpenseState( + val expenses: List = emptyList(), + val firstName: String = "", + val lastName: String = "", + val phoneNumber: String = "", + val isAddingExpense: Boolean = false, + val sortType: SortType = SortType.NAME, +) diff --git a/app/src/main/java/com/hyperling/expensetracker/SortType.kt b/app/src/main/java/com/hyperling/expensetracker/SortType.kt new file mode 100644 index 0000000..21e3d7f --- /dev/null +++ b/app/src/main/java/com/hyperling/expensetracker/SortType.kt @@ -0,0 +1,7 @@ +package com.hyperling.expensetracker + +enum class SortType { + NAME, + COST, + RATE, +} \ No newline at end of file