Skip to content

Commit 84da0ec

Browse files
committed
fix pomodoro not stopping on timer deleted manually
1 parent f1ca703 commit 84da0ec

4 files changed

Lines changed: 12 additions & 20 deletions

File tree

domain/src/main/java/com/example/util/simpletimetracker/domain/record/interactor/RemoveRunningRecordMediator.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,20 @@ class RemoveRunningRecordMediator @Inject constructor(
4747
updateWidgets = updateWidgets,
4848
updateNotificationSwitch = updateNotificationSwitch,
4949
)
50-
pomodoroStopInteractor.checkAndStop(runningRecord.id)
5150
}
5251

5352
suspend fun remove(
5453
typeId: Long,
5554
updateWidgets: Boolean = true,
5655
updateNotificationSwitch: Boolean = true,
56+
checkPomodoroStop: Boolean = true,
5757
) {
5858
runningRecordInteractor.remove(typeId)
5959
updateExternalViewsInteractor.onRunningRecordRemove(
6060
typeId = typeId,
6161
updateWidgets = updateWidgets,
6262
updateNotificationSwitch = updateNotificationSwitch,
6363
)
64+
if (checkPomodoroStop) pomodoroStopInteractor.checkAndStop(typeId)
6465
}
6566
}

features/feature_change_running_record/src/main/java/com/example/util/simpletimetracker/feature_change_running_record/viewModel/ChangeRunningRecordViewModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ class ChangeRunningRecordViewModel @Inject constructor(
140140
typeId = extra.id,
141141
updateWidgets = false,
142142
updateNotificationSwitch = false,
143+
checkPomodoroStop = extra.id != newTypeId,
143144
)
144145
addRunningRecordMediator.addAfterChange(
145146
typeId = newTypeId,

features/feature_dialogs/src/main/java/com/example/util/simpletimetracker/feature_dialogs/recordQuickActions/interactor/RecordQuickActionsInteractor.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ class RecordQuickActionsInteractor @Inject constructor(
141141
typeId = old.id,
142142
updateWidgets = false,
143143
updateNotificationSwitch = false,
144+
checkPomodoroStop = old.id != newTypeId
144145
)
145146
addRunningRecordMediator.addAfterChange(
146147
typeId = newTypeId,

features/feature_pomodoro/src/main/res/layout/pomodoro_fragment.xml

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,15 @@
55
android:layout_width="match_parent"
66
android:layout_height="match_parent">
77

8-
<androidx.cardview.widget.CardView
8+
<com.google.android.material.button.MaterialButton
99
android:id="@+id/btnPomodoroSettings"
10-
style="@style/SettingsCard"
11-
android:layout_width="44dp"
12-
android:layout_height="44dp"
13-
android:layout_margin="8dp"
14-
android:foreground="?selectableItemBackground"
15-
app:cardBackgroundColor="?appCardBackgroundColor"
16-
app:layout_constraintDimensionRatio="h,1:1"
17-
app:layout_constraintEnd_toEndOf="parent"
18-
app:layout_constraintTop_toTopOf="parent">
19-
20-
<androidx.appcompat.widget.AppCompatImageView
21-
android:layout_width="match_parent"
22-
android:layout_height="match_parent"
23-
android:scaleType="center"
24-
android:tint="?appInactiveColor"
25-
app:srcCompat="@drawable/tab_settings" />
26-
27-
</androidx.cardview.widget.CardView>
10+
style="@style/ContainerRangeOptionsButton"
11+
android:layout_marginEnd="8dp"
12+
android:backgroundTint="?appCardBackgroundColor"
13+
app:icon="@drawable/tab_settings"
14+
app:iconTint="?appInactiveColor"
15+
app:layout_constraintBottom_toBottomOf="parent"
16+
app:layout_constraintEnd_toEndOf="parent" />
2817

2918
<androidx.constraintlayout.widget.ConstraintLayout
3019
android:layout_width="0dp"

0 commit comments

Comments
 (0)