AddRegex updated

This commit is contained in:
Florian 2025-01-17 09:44:43 +01:00
parent b908de01ba
commit de6dea515f
3 changed files with 2 additions and 9 deletions

View File

@ -87,12 +87,10 @@ fun EditCategory(
} }
) )
}else if(deleteStarted && !showError){ }else if(deleteStarted && !showError){
Log.w("xaver", "delete")
editCategoryViewModel.deleteEntry() editCategoryViewModel.deleteEntry()
onButtonClick() onButtonClick()
} }
Log.w("xaver", "deleteStarted $deleteStarted : showError $showError" )
Column( Column(
modifier = modifier modifier = modifier

View File

@ -105,7 +105,6 @@ fun Add(
.fillMaxWidth() .fillMaxWidth()
) )
ExposedDropdownMenuBox( ExposedDropdownMenuBox(
expanded = expanded, expanded = expanded,
onExpandedChange = { expanded = it } onExpandedChange = { expanded = it }
@ -167,11 +166,8 @@ fun Add(
modifier = Modifier, modifier = Modifier,
"Add Transaction", "Add Transaction",
onClick = { onClick = {
val isValidSpending = spending.matches(Regex("^[+-]?\\d*(\\.\\d+)?$")) val isValidSpending = spending.matches(Regex("^[+-]?\\d*(\\.\\d{0,2})?$"))
Log.w("xaxaxa", name.isNotBlank().toString() )
Log.w("xaxaxa", isValidSpending.toString() )
Log.w("xaxaxa", (selectedDate != 0L).toString() )
Log.w("xaxaxa", (selectedCategory != -1).toString() )
if (name.isNotBlank() && isValidSpending && selectedDate != 0L && selectedCategory != -1) { if (name.isNotBlank() && isValidSpending && selectedDate != 0L && selectedCategory != -1) {
val newEntry = Entry( val newEntry = Entry(
id = 0, id = 0,

View File

@ -41,7 +41,6 @@ class AddViewModel(
} }
fun addEntryToDB(entry: Entry) { fun addEntryToDB(entry: Entry) {
//Log.d("KRAUSI", "WE ARE INNNN")
viewModelScope.launch { viewModelScope.launch {
try { try {
val entryEntity = Entry( val entryEntity = Entry(