added soundplayer
This commit is contained in:
parent
4466f3646f
commit
4519bf2e30
4 changed files with 11 additions and 25 deletions
|
@ -1,18 +0,0 @@
|
|||
package be.ugent.sel.studeez.screens.session.sessionScreens
|
||||
|
||||
import android.media.MediaPlayer
|
||||
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalCustomTimer
|
||||
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalEndlessTimer
|
||||
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalPomodoroTimer
|
||||
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalTimerVisitor
|
||||
|
||||
class GetSessionScreen(private val mediaplayer: MediaPlayer?) : FunctionalTimerVisitor<AbstractSessionScreen> {
|
||||
override fun visitFunctionalCustomTimer(functionalCustomTimer: FunctionalCustomTimer): AbstractSessionScreen =
|
||||
CustomSessionScreen(functionalCustomTimer, mediaplayer)
|
||||
|
||||
override fun visitFunctionalEndlessTimer(functionalEndlessTimer: FunctionalEndlessTimer): AbstractSessionScreen =
|
||||
EndlessSessionScreen()
|
||||
|
||||
override fun visitFunctionalBreakTimer(functionalPomodoroTimer: FunctionalPomodoroTimer): AbstractSessionScreen =
|
||||
BreakSessionScreen(functionalPomodoroTimer, mediaplayer)
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package be.ugent.sel.studeez.screens.session.sessionScreens
|
||||
|
||||
class SoundPlayer {
|
||||
}
|
|
@ -3,7 +3,6 @@ package be.ugent.sel.studeez.screens.session.sessionScreens.composables
|
|||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
@ -14,17 +13,20 @@ import be.ugent.sel.studeez.R
|
|||
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalPomodoroTimer
|
||||
import be.ugent.sel.studeez.resources
|
||||
import be.ugent.sel.studeez.screens.session.SessionActions
|
||||
import be.ugent.sel.studeez.screens.session.sessionScreens.SoundPlayer
|
||||
|
||||
@Composable
|
||||
fun BreakSessionScreenComposable(
|
||||
open: (String) -> Unit,
|
||||
sessionActions: SessionActions,
|
||||
pomodoroTimer: FunctionalPomodoroTimer,
|
||||
soundPlayer: SoundPlayer,
|
||||
) {
|
||||
SessionScreen(
|
||||
open = open,
|
||||
sessionActions = sessionActions,
|
||||
midSection = { Dots(pomodoroTimer = pomodoroTimer) },
|
||||
callMediaPlayer = { soundPlayer.playOn(pomodoroTimer.hasCurrentCountdownEnded()) },
|
||||
motivationString = { motivationString (pomodoroTimer = pomodoroTimer) }
|
||||
)
|
||||
}
|
||||
|
@ -68,9 +70,4 @@ private fun motivationString(pomodoroTimer: FunctionalPomodoroTimer): String {
|
|||
}
|
||||
|
||||
return resources().getString(R.string.state_focus)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun test(pomodoroTimer: FunctionalPomodoroTimer): String {
|
||||
return pomodoroTimer.breaksRemaining.toString()
|
||||
}
|
|
@ -5,15 +5,18 @@ import be.ugent.sel.studeez.R
|
|||
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalCustomTimer
|
||||
import be.ugent.sel.studeez.resources
|
||||
import be.ugent.sel.studeez.screens.session.SessionActions
|
||||
import be.ugent.sel.studeez.screens.session.sessionScreens.SoundPlayer
|
||||
|
||||
@Composable
|
||||
fun CustomTimerSessionScreenComposable(
|
||||
open: (String) -> Unit,
|
||||
sessionActions: SessionActions,
|
||||
customTimer: FunctionalCustomTimer
|
||||
customTimer: FunctionalCustomTimer,
|
||||
soundPlayer: SoundPlayer
|
||||
) {
|
||||
SessionScreen(
|
||||
open = open,
|
||||
callMediaPlayer = { soundPlayer.playOn(customTimer.hasEnded()) },
|
||||
sessionActions = sessionActions
|
||||
) {
|
||||
motivationString(customTimer = customTimer)
|
||||
|
|
Reference in a new issue