From 4d5efafe57097480a719e8911eec918099532d48 Mon Sep 17 00:00:00 2001
From: Caleb Langat <95022986+Mzazi25@users.noreply.github.com>
Date: Fri, 30 Jun 2023 22:04:26 +0300
Subject: [PATCH 1/7] Added 1 minute TextView to the fragment xml
---
.../src/main/res/layout/fragment_sleep.xml | 88 +++++++++++++++----
1 file changed, 71 insertions(+), 17 deletions(-)
diff --git a/modules/features/player/src/main/res/layout/fragment_sleep.xml b/modules/features/player/src/main/res/layout/fragment_sleep.xml
index 0f318f57678..c659471eccb 100644
--- a/modules/features/player/src/main/res/layout/fragment_sleep.xml
+++ b/modules/features/player/src/main/res/layout/fragment_sleep.xml
@@ -26,7 +26,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="@{!safeUnbox(viewModel.isSleepRunning)}"
- app:constraint_referenced_ids="sleepTitle,labelMins5,buttonMins5,separator1,labelMins15,buttonMins15,separator2,labelMins30,buttonMins30,separator3,labelMins60,buttonMins60,separator4,labelEndOfEpisode,buttonEndOfEpisode,separator5,labelCustom,buttonCustom,customMinusButton,customPlusButton"
+ app:constraint_referenced_ids="sleepTitle,labelMins1,buttonMins1,separator1,labelMins5,buttonMins5,separator2,labelMins15,buttonMins15,separator3,labelMins30,buttonMins30,separator4,labelMins60,buttonMins60,separator5,labelEndOfEpisode,buttonEndOfEpisode,separator6,labelCustom,buttonCustom,customMinusButton,customPlusButton"
tools:ignore="MissingConstraints" />
+
+
+
+
+
+
+ app:layout_constraintTop_toBottomOf="@+id/separator2" />
+ app:layout_constraintTop_toBottomOf="@+id/separator3" />
+ app:layout_constraintTop_toBottomOf="@+id/separator4" />
+ app:layout_constraintTop_toBottomOf="@+id/separator5" />
+ app:layout_constraintTop_toBottomOf="@+id/separator6" />
+
+
From 4293a661c0ee01cfba20c52f5f218269c5131e98 Mon Sep 17 00:00:00 2001
From: Caleb Langat <95022986+Mzazi25@users.noreply.github.com>
Date: Fri, 30 Jun 2023 22:05:08 +0300
Subject: [PATCH 2/7] Added strings.xml for the 1 minute textview
---
modules/services/localization/src/main/res/values/strings.xml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/modules/services/localization/src/main/res/values/strings.xml b/modules/services/localization/src/main/res/values/strings.xml
index f8a01e1c3dd..721e6811b52 100644
--- a/modules/services/localization/src/main/res/values/strings.xml
+++ b/modules/services/localization/src/main/res/values/strings.xml
@@ -265,8 +265,10 @@
15 minutes
30 minutes
5 minutes
+ 1 minute
60 minutes
+ 5 minutes
+ + 1 minutes
Cancel timer
Custom minus
Custom plus
From de469b8b079e04d4f1b10db4ee9762c3b956fab0 Mon Sep 17 00:00:00 2001
From: Caleb Langat <95022986+Mzazi25@users.noreply.github.com>
Date: Fri, 30 Jun 2023 22:05:49 +0300
Subject: [PATCH 3/7] updated SleepFragment with 1 minute and 5 minute timers
---
.../pocketcasts/player/view/SleepFragment.kt | 20 +++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/modules/features/player/src/main/java/au/com/shiftyjelly/pocketcasts/player/view/SleepFragment.kt b/modules/features/player/src/main/java/au/com/shiftyjelly/pocketcasts/player/view/SleepFragment.kt
index 75bfcd66cd7..b7fed267a81 100644
--- a/modules/features/player/src/main/java/au/com/shiftyjelly/pocketcasts/player/view/SleepFragment.kt
+++ b/modules/features/player/src/main/java/au/com/shiftyjelly/pocketcasts/player/view/SleepFragment.kt
@@ -64,6 +64,7 @@ class SleepFragment : BaseDialogFragment() {
binding.lifecycleOwner = viewLifecycleOwner
binding.viewModel = viewModel
+ binding.buttonMins1.setOnClickListener { startTimer(mins = 1) }
binding.buttonMins5.setOnClickListener { startTimer(mins = 5) }
binding.buttonMins15.setOnClickListener { startTimer(mins = 15) }
binding.buttonMins30.setOnClickListener { startTimer(mins = 30) }
@@ -75,7 +76,8 @@ class SleepFragment : BaseDialogFragment() {
binding.customMinusButton.setOnClickListener { minusButtonClicked() }
binding.customPlusButton.setOnClickListener { plusButtonClicked() }
binding.buttonCustom.setOnClickListener { startCustomTimer() }
- binding.buttonAddTime.setOnClickListener { addExtraMins() }
+ binding.buttonAdd5Minute.setOnClickListener { addExtra5minute() }
+ binding.buttonAdd1Minute.setOnClickListener { addExtra1minute() }
binding.buttonEndOfEpisode2.setOnClickListener {
analyticsTracker.track(AnalyticsEvent.PLAYER_SLEEP_TIMER_EXTENDED, mapOf(AMOUNT_KEY to END_OF_EPISODE))
startTimerEndOfEpisode()
@@ -98,8 +100,10 @@ class SleepFragment : BaseDialogFragment() {
val tintColor = theme.playerHighlightColor(viewModel.podcast)
val tintColorStateList = ColorStateList.valueOf(tintColor)
val binding = binding ?: return@Observer
- binding.buttonAddTime.strokeColor = tintColorStateList
- binding.buttonAddTime.setTextColor(tintColorStateList)
+ binding.buttonAdd5Minute.strokeColor = tintColorStateList
+ binding.buttonAdd5Minute.setTextColor(tintColorStateList)
+ binding.buttonAdd1Minute.strokeColor = tintColorStateList
+ binding.buttonAdd1Minute.setTextColor(tintColorStateList)
binding.buttonCancelEndOfEpisode.strokeColor = tintColorStateList
binding.buttonCancelEndOfEpisode.setTextColor(tintColorStateList)
binding.buttonCancelTime.strokeColor = tintColorStateList
@@ -116,7 +120,7 @@ class SleepFragment : BaseDialogFragment() {
(dialog as? BottomSheetDialog)?.behavior?.state = BottomSheetBehavior.STATE_EXPANDED
}
- private fun addExtraMins() {
+ private fun addExtra5minute() {
viewModel.sleepTimerAddExtraMins(mins = 5)
analyticsTracker.track(AnalyticsEvent.PLAYER_SLEEP_TIMER_EXTENDED, mapOf(AMOUNT_KEY to TimeUnit.MILLISECONDS.toSeconds(5.minutes())))
viewModel.timeLeftInSeconds()?.let { timeLeft ->
@@ -124,6 +128,14 @@ class SleepFragment : BaseDialogFragment() {
}
}
+ private fun addExtra1minute() {
+ viewModel.sleepTimerAddExtraMins(mins = 1)
+ analyticsTracker.track(AnalyticsEvent.PLAYER_SLEEP_TIMER_EXTENDED, mapOf(AMOUNT_KEY to TimeUnit.MILLISECONDS.toSeconds(1.minutes())))
+ viewModel.timeLeftInSeconds()?.let { timeLeft ->
+ binding?.root?.announceForAccessibility("1 minute added to sleep timer. ${timeLeft / 60} minutes ${timeLeft % 60} seconds remaining")
+ }
+ }
+
private fun startCustomTimer() {
viewModel.sleepTimerAfter(mins = viewModel.sleepCustomTimeMins)
binding?.root?.announceForAccessibility("Sleep timer set for ${viewModel.sleepCustomTimeMins} minutes")
From 969ad96712d52f95846fde5775c375613abe7915 Mon Sep 17 00:00:00 2001
From: Caleb Langat <95022986+Mzazi25@users.noreply.github.com>
Date: Fri, 30 Jun 2023 22:40:00 +0300
Subject: [PATCH 4/7] updated strings.xml with correct values
---
modules/services/localization/src/main/res/values/strings.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/services/localization/src/main/res/values/strings.xml b/modules/services/localization/src/main/res/values/strings.xml
index 721e6811b52..a218b0da267 100644
--- a/modules/services/localization/src/main/res/values/strings.xml
+++ b/modules/services/localization/src/main/res/values/strings.xml
@@ -268,7 +268,7 @@
1 minute
60 minutes
+ 5 minutes
- + 1 minutes
+ + 1 minute
Cancel timer
Custom minus
Custom plus
From 32a4d5bebc044218620f2a770b39afba47d2d23f Mon Sep 17 00:00:00 2001
From: Caleb Langat <95022986+Mzazi25@users.noreply.github.com>
Date: Fri, 30 Jun 2023 23:29:00 +0300
Subject: [PATCH 5/7] UI cleanup
---
.../pocketcasts/player/view/SleepFragment.kt | 1 -
.../src/main/res/layout/fragment_sleep.xml | 61 ++++---------------
2 files changed, 13 insertions(+), 49 deletions(-)
diff --git a/modules/features/player/src/main/java/au/com/shiftyjelly/pocketcasts/player/view/SleepFragment.kt b/modules/features/player/src/main/java/au/com/shiftyjelly/pocketcasts/player/view/SleepFragment.kt
index b7fed267a81..ea14f8d0066 100644
--- a/modules/features/player/src/main/java/au/com/shiftyjelly/pocketcasts/player/view/SleepFragment.kt
+++ b/modules/features/player/src/main/java/au/com/shiftyjelly/pocketcasts/player/view/SleepFragment.kt
@@ -64,7 +64,6 @@ class SleepFragment : BaseDialogFragment() {
binding.lifecycleOwner = viewLifecycleOwner
binding.viewModel = viewModel
- binding.buttonMins1.setOnClickListener { startTimer(mins = 1) }
binding.buttonMins5.setOnClickListener { startTimer(mins = 5) }
binding.buttonMins15.setOnClickListener { startTimer(mins = 15) }
binding.buttonMins30.setOnClickListener { startTimer(mins = 30) }
diff --git a/modules/features/player/src/main/res/layout/fragment_sleep.xml b/modules/features/player/src/main/res/layout/fragment_sleep.xml
index c659471eccb..e8404ac8148 100644
--- a/modules/features/player/src/main/res/layout/fragment_sleep.xml
+++ b/modules/features/player/src/main/res/layout/fragment_sleep.xml
@@ -26,7 +26,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="@{!safeUnbox(viewModel.isSleepRunning)}"
- app:constraint_referenced_ids="sleepTitle,labelMins1,buttonMins1,separator1,labelMins5,buttonMins5,separator2,labelMins15,buttonMins15,separator3,labelMins30,buttonMins30,separator4,labelMins60,buttonMins60,separator5,labelEndOfEpisode,buttonEndOfEpisode,separator6,labelCustom,buttonCustom,customMinusButton,customPlusButton"
+ app:constraint_referenced_ids="sleepTitle,labelMins5,buttonMins5,separator1,labelMins15,buttonMins15,separator2,labelMins30,buttonMins30,separator3,labelMins60,buttonMins60,separator4,labelEndOfEpisode,buttonEndOfEpisode,separator5,labelCustom,buttonCustom,customMinusButton,customPlusButton"
tools:ignore="MissingConstraints" />
-
-
-
-
-
-
+ app:layout_constraintTop_toBottomOf="@+id/sleepTitle" />
+ app:layout_constraintTop_toBottomOf="@+id/separator1" />
+ app:layout_constraintTop_toBottomOf="@+id/separator2" />
+ app:layout_constraintTop_toBottomOf="@+id/separator3" />
+ app:layout_constraintTop_toBottomOf="@+id/separator4" />
+ app:layout_constraintTop_toBottomOf="@+id/separator5" />
Date: Fri, 30 Jun 2023 23:48:03 +0300
Subject: [PATCH 6/7] changed +1 and +5 layout to ConstraintLayout
---
.../src/main/res/layout/fragment_sleep.xml | 22 ++++++++++---------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/modules/features/player/src/main/res/layout/fragment_sleep.xml b/modules/features/player/src/main/res/layout/fragment_sleep.xml
index e8404ac8148..f2c613e5c4a 100644
--- a/modules/features/player/src/main/res/layout/fragment_sleep.xml
+++ b/modules/features/player/src/main/res/layout/fragment_sleep.xml
@@ -332,17 +332,18 @@
From 9335c29d99c293f77280edb03a8282e8fad86cb6 Mon Sep 17 00:00:00 2001
From: Caleb Langat <95022986+Mzazi25@users.noreply.github.com>
Date: Mon, 3 Jul 2023 10:08:11 +0300
Subject: [PATCH 7/7] updated changelog with new +1 minute feature
---
CHANGELOG.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 74da4b1f41e..0701ad2ef9b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,8 @@
7.43
-----
-
+* New Feature:
+ * Add capability to add +1 minute on the sleep timer
+ ([#1139](https://github.com/Automattic/pocket-casts-android/pull/1139)).
7.42
-----