Skip to content

Commit 8b3d8d9

Browse files
feat: make date-picker show selected date when editing goals & more (#181)
- Date picker in goal editing now defaults to the selected date instead of the current date - Fixed date style option in settings not reflecting changes until reloading the screen - Cleaned up redundant settings screen states for simpler, more maintainable code Signed-off-by: starry-shivam <[email protected]>
1 parent be5e750 commit 8b3d8d9

File tree

11 files changed

+296
-241
lines changed

11 files changed

+296
-241
lines changed

.idea/deviceManager.xml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/starry/greenstash/ui/screens/archive/composables/ArchiveScreenComponents.kt

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -164,34 +164,34 @@ fun ArchiveDialogs(
164164
if (showRestoreDialog.value) {
165165
AlertDialog(
166166
onDismissRequest = {
167-
showRestoreDialog.value = false
168-
}, title = {
169-
Text(
170-
text = stringResource(id = R.string.goal_restore_confirmation),
171-
color = MaterialTheme.colorScheme.onSurface,
172-
fontFamily = greenstashFont,
173-
fontSize = 18.sp
174-
)
175-
}, confirmButton = {
176-
FilledTonalButton(
177-
onClick = {
178-
showRestoreDialog.value = false
179-
onRestoreConfirmed()
180-
},
181-
colors = ButtonDefaults.filledTonalButtonColors(
182-
containerColor = MaterialTheme.colorScheme.primaryContainer,
183-
contentColor = MaterialTheme.colorScheme.onPrimaryContainer
184-
)
185-
) {
186-
Text(stringResource(id = R.string.confirm), fontFamily = greenstashFont)
187-
}
188-
}, dismissButton = {
189-
TextButton(onClick = {
190167
showRestoreDialog.value = false
191-
}) {
192-
Text(stringResource(id = R.string.cancel), fontFamily = greenstashFont)
193-
}
194-
},
168+
}, title = {
169+
Text(
170+
text = stringResource(id = R.string.goal_restore_confirmation),
171+
color = MaterialTheme.colorScheme.onSurface,
172+
fontFamily = greenstashFont,
173+
fontSize = 18.sp
174+
)
175+
}, confirmButton = {
176+
FilledTonalButton(
177+
onClick = {
178+
showRestoreDialog.value = false
179+
onRestoreConfirmed()
180+
},
181+
colors = ButtonDefaults.filledTonalButtonColors(
182+
containerColor = MaterialTheme.colorScheme.primaryContainer,
183+
contentColor = MaterialTheme.colorScheme.onPrimaryContainer
184+
)
185+
) {
186+
Text(stringResource(id = R.string.confirm), fontFamily = greenstashFont)
187+
}
188+
}, dismissButton = {
189+
TextButton(onClick = {
190+
showRestoreDialog.value = false
191+
}) {
192+
Text(stringResource(id = R.string.cancel), fontFamily = greenstashFont)
193+
}
194+
},
195195
icon = {
196196
Icon(
197197
imageVector = Icons.Filled.Refresh,
@@ -204,34 +204,34 @@ fun ArchiveDialogs(
204204
if (showDeleteDialog.value) {
205205
AlertDialog(
206206
onDismissRequest = {
207-
showDeleteDialog.value = false
208-
}, title = {
209-
Text(
210-
text = stringResource(id = R.string.goal_delete_confirmation),
211-
color = MaterialTheme.colorScheme.onSurface,
212-
fontFamily = greenstashFont,
213-
fontSize = 18.sp
214-
)
215-
}, confirmButton = {
216-
FilledTonalButton(
217-
onClick = {
218-
showDeleteDialog.value = false
219-
onDeleteConfirmed()
220-
},
221-
colors = ButtonDefaults.filledTonalButtonColors(
222-
containerColor = MaterialTheme.colorScheme.errorContainer,
223-
contentColor = MaterialTheme.colorScheme.onErrorContainer
224-
)
225-
) {
226-
Text(stringResource(id = R.string.confirm), fontFamily = greenstashFont)
227-
}
228-
}, dismissButton = {
229-
TextButton(onClick = {
230207
showDeleteDialog.value = false
231-
}) {
232-
Text(stringResource(id = R.string.cancel), fontFamily = greenstashFont)
233-
}
234-
},
208+
}, title = {
209+
Text(
210+
text = stringResource(id = R.string.goal_delete_confirmation),
211+
color = MaterialTheme.colorScheme.onSurface,
212+
fontFamily = greenstashFont,
213+
fontSize = 18.sp
214+
)
215+
}, confirmButton = {
216+
FilledTonalButton(
217+
onClick = {
218+
showDeleteDialog.value = false
219+
onDeleteConfirmed()
220+
},
221+
colors = ButtonDefaults.filledTonalButtonColors(
222+
containerColor = MaterialTheme.colorScheme.errorContainer,
223+
contentColor = MaterialTheme.colorScheme.onErrorContainer
224+
)
225+
) {
226+
Text(stringResource(id = R.string.confirm), fontFamily = greenstashFont)
227+
}
228+
}, dismissButton = {
229+
TextButton(onClick = {
230+
showDeleteDialog.value = false
231+
}) {
232+
Text(stringResource(id = R.string.cancel), fontFamily = greenstashFont)
233+
}
234+
},
235235
icon = {
236236
Icon(
237237
imageVector = Icons.Outlined.Delete,

app/src/main/java/com/starry/greenstash/ui/screens/home/composables/HomeDialogs.kt

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -53,34 +53,34 @@ fun HomeDialogs(
5353

5454
AlertDialog(
5555
onDismissRequest = {
56-
openDeleteDialog.value = false
57-
}, title = {
58-
Text(
59-
text = stringResource(id = R.string.goal_delete_confirmation),
60-
color = MaterialTheme.colorScheme.onSurface,
61-
fontFamily = greenstashFont,
62-
fontSize = 18.sp
63-
)
64-
}, confirmButton = {
65-
FilledTonalButton(
66-
onClick = {
67-
openDeleteDialog.value = false
68-
onDeleteConfirmed()
69-
},
70-
colors = ButtonDefaults.filledTonalButtonColors(
71-
containerColor = MaterialTheme.colorScheme.errorContainer,
72-
contentColor = MaterialTheme.colorScheme.onErrorContainer
73-
)
74-
) {
75-
Text(stringResource(id = R.string.confirm), fontFamily = greenstashFont)
76-
}
77-
}, dismissButton = {
78-
TextButton(onClick = {
7956
openDeleteDialog.value = false
80-
}) {
81-
Text(stringResource(id = R.string.cancel), fontFamily = greenstashFont)
82-
}
83-
},
57+
}, title = {
58+
Text(
59+
text = stringResource(id = R.string.goal_delete_confirmation),
60+
color = MaterialTheme.colorScheme.onSurface,
61+
fontFamily = greenstashFont,
62+
fontSize = 18.sp
63+
)
64+
}, confirmButton = {
65+
FilledTonalButton(
66+
onClick = {
67+
openDeleteDialog.value = false
68+
onDeleteConfirmed()
69+
},
70+
colors = ButtonDefaults.filledTonalButtonColors(
71+
containerColor = MaterialTheme.colorScheme.errorContainer,
72+
contentColor = MaterialTheme.colorScheme.onErrorContainer
73+
)
74+
) {
75+
Text(stringResource(id = R.string.confirm), fontFamily = greenstashFont)
76+
}
77+
}, dismissButton = {
78+
TextButton(onClick = {
79+
openDeleteDialog.value = false
80+
}) {
81+
Text(stringResource(id = R.string.cancel), fontFamily = greenstashFont)
82+
}
83+
},
8484
icon = {
8585
Icon(
8686
imageVector = ImageVector.vectorResource(id = R.drawable.ic_goal_delete),
@@ -94,34 +94,34 @@ fun HomeDialogs(
9494

9595
AlertDialog(
9696
onDismissRequest = {
97-
openArchiveDialog.value = false
98-
}, title = {
99-
Text(
100-
text = stringResource(id = R.string.goal_archive_confirmation),
101-
color = MaterialTheme.colorScheme.onSurface,
102-
fontFamily = greenstashFont,
103-
fontSize = 18.sp
104-
)
105-
}, confirmButton = {
106-
FilledTonalButton(
107-
onClick = {
108-
openArchiveDialog.value = false
109-
onArchiveConfirmed()
110-
},
111-
colors = ButtonDefaults.filledTonalButtonColors(
112-
containerColor = MaterialTheme.colorScheme.primaryContainer,
113-
contentColor = MaterialTheme.colorScheme.onPrimaryContainer
114-
)
115-
) {
116-
Text(stringResource(id = R.string.confirm), fontFamily = greenstashFont)
117-
}
118-
}, dismissButton = {
119-
TextButton(onClick = {
12097
openArchiveDialog.value = false
121-
}) {
122-
Text(stringResource(id = R.string.cancel), fontFamily = greenstashFont)
123-
}
124-
},
98+
}, title = {
99+
Text(
100+
text = stringResource(id = R.string.goal_archive_confirmation),
101+
color = MaterialTheme.colorScheme.onSurface,
102+
fontFamily = greenstashFont,
103+
fontSize = 18.sp
104+
)
105+
}, confirmButton = {
106+
FilledTonalButton(
107+
onClick = {
108+
openArchiveDialog.value = false
109+
onArchiveConfirmed()
110+
},
111+
colors = ButtonDefaults.filledTonalButtonColors(
112+
containerColor = MaterialTheme.colorScheme.primaryContainer,
113+
contentColor = MaterialTheme.colorScheme.onPrimaryContainer
114+
)
115+
) {
116+
Text(stringResource(id = R.string.confirm), fontFamily = greenstashFont)
117+
}
118+
}, dismissButton = {
119+
TextButton(onClick = {
120+
openArchiveDialog.value = false
121+
}) {
122+
Text(stringResource(id = R.string.cancel), fontFamily = greenstashFont)
123+
}
124+
},
125125
icon = {
126126
Icon(
127127
imageVector = ImageVector.vectorResource(id = R.drawable.ic_compact_goal_archve),

app/src/main/java/com/starry/greenstash/ui/screens/info/composables/TransactionItems.kt

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -152,33 +152,33 @@ private fun TransactionItem(
152152
if (showDeleteDialog.value) {
153153
AlertDialog(
154154
onDismissRequest = {
155-
showDeleteDialog.value = false
156-
}, title = {
157-
Text(
158-
text = stringResource(id = R.string.goal_delete_confirmation),
159-
color = MaterialTheme.colorScheme.onSurface,
160-
fontFamily = greenstashFont,
161-
)
162-
}, confirmButton = {
163-
FilledTonalButton(
164-
onClick = {
165-
showDeleteDialog.value = false
166-
viewModel.deleteTransaction(transaction)
167-
},
168-
colors = ButtonDefaults.filledTonalButtonColors(
169-
containerColor = MaterialTheme.colorScheme.errorContainer,
170-
contentColor = MaterialTheme.colorScheme.onErrorContainer
171-
)
172-
) {
173-
Text(stringResource(id = R.string.confirm), fontFamily = greenstashFont)
174-
}
175-
}, dismissButton = {
176-
TextButton(onClick = {
177155
showDeleteDialog.value = false
178-
}) {
179-
Text(stringResource(id = R.string.cancel), fontFamily = greenstashFont)
180-
}
181-
},
156+
}, title = {
157+
Text(
158+
text = stringResource(id = R.string.goal_delete_confirmation),
159+
color = MaterialTheme.colorScheme.onSurface,
160+
fontFamily = greenstashFont,
161+
)
162+
}, confirmButton = {
163+
FilledTonalButton(
164+
onClick = {
165+
showDeleteDialog.value = false
166+
viewModel.deleteTransaction(transaction)
167+
},
168+
colors = ButtonDefaults.filledTonalButtonColors(
169+
containerColor = MaterialTheme.colorScheme.errorContainer,
170+
contentColor = MaterialTheme.colorScheme.onErrorContainer
171+
)
172+
) {
173+
Text(stringResource(id = R.string.confirm), fontFamily = greenstashFont)
174+
}
175+
}, dismissButton = {
176+
TextButton(onClick = {
177+
showDeleteDialog.value = false
178+
}) {
179+
Text(stringResource(id = R.string.cancel), fontFamily = greenstashFont)
180+
}
181+
},
182182
icon = {
183183
Icon(imageVector = Icons.Rounded.Delete, contentDescription = null)
184184
}

0 commit comments

Comments
 (0)