Skip to content

Commit

Permalink
Merge pull request #1144 from Mzazi25/plus1-minus1-increments
Browse files Browse the repository at this point in the history
+ - 1 min Custom Increments on the Sleep timer
  • Loading branch information
ashiagr authored Jul 4, 2023
2 parents ee7fae3 + 782a16f commit 9c6091a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
-----
* New Feature:
* Add capability to add +1 minute on the sleep timer
([#1139](https://github.com/Automattic/pocket-casts-android/pull/1139)).
([#1139](https://github.com/Automattic/pocket-casts-android/pull/1139))
* Adds +- 1 increments to the sleep timer if the custom timer is less than 5 Min
([#1144](https://github.com/Automattic/pocket-casts-android/pull/1144)).


7.42
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,20 @@ class SleepFragment : BaseDialogFragment() {
}

private fun plusButtonClicked() {
viewModel.sleepCustomTimeMins = viewModel.sleepCustomTimeMins + 5
if (viewModel.sleepCustomTimeMins < 5) {
viewModel.sleepCustomTimeMins += 1
} else {
viewModel.sleepCustomTimeMins += 5
}
binding?.root?.announceForAccessibility("Custom sleep time ${viewModel.sleepCustomTimeMins}")
}

private fun minusButtonClicked() {
viewModel.sleepCustomTimeMins = viewModel.sleepCustomTimeMins - 5
if (viewModel.sleepCustomTimeMins <= 5) {
viewModel.sleepCustomTimeMins -= 1
} else {
viewModel.sleepCustomTimeMins -= 5
}
binding?.root?.announceForAccessibility("Custom sleep time ${viewModel.sleepCustomTimeMins}")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class PlayerViewModel @Inject constructor(
}
var sleepCustomTimeMins: Int = 5
set(value) {
field = value.coerceIn(5, 240)
field = value.coerceIn(1, 240)
settings.setSleepTimerCustomMins(field)
sleepCustomTimeText.postValue(calcCustomTimeText())
updateSleepTimer()
Expand Down

0 comments on commit 9c6091a

Please sign in to comment.