Skip to content

Commit

Permalink
correctly populate duration drop down in all cases
Browse files Browse the repository at this point in the history
  • Loading branch information
connyduck committed Oct 28, 2024
1 parent 53969a4 commit 6f09c93
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ class EditFilterActivity : BaseActivity() {

if (originalFilter == null) {
binding.filterActionWarn.isChecked = true
initializeDurationDropDown(false)
} else {
loadFilter()
}
Expand Down Expand Up @@ -178,7 +179,11 @@ class EditFilterActivity : BaseActivity() {
// Populate the UI from the filter's members
private fun loadFilter() {
viewModel.load(filter)
val durationNames = if (filter.expiresAt != null) {
initializeDurationDropDown(withNoChange = filter.expiresAt != null)
}

private fun initializeDurationDropDown(withNoChange: Boolean) {
val durationNames = if (withNoChange) {
arrayOf(getString(R.string.duration_no_change)) + resources.getStringArray(R.array.filter_duration_names)
} else {
resources.getStringArray(R.array.filter_duration_names)
Expand Down

0 comments on commit 6f09c93

Please sign in to comment.