Merge branch 'development' into session_recap
This commit is contained in:
commit
75429b2638
11 changed files with 66 additions and 45 deletions
|
@ -21,8 +21,8 @@ class FunctionalCustomTimer(studyTime: Int) : FunctionalTimer(studyTime) {
|
|||
return hasEnded()
|
||||
}
|
||||
|
||||
override fun getView(): AbstractSessionScreen {
|
||||
return CustomSessionScreen(this)
|
||||
override fun <T> accept(visitor: FunctionalTimerVisitor<T>): T {
|
||||
return visitor.visitFunctionalCustomTimer(this)
|
||||
}
|
||||
|
||||
}
|
|
@ -1,8 +1,5 @@
|
|||
package be.ugent.sel.studeez.data.local.models.timer_functional
|
||||
|
||||
import be.ugent.sel.studeez.screens.session.sessionScreens.EndlessSessionScreen
|
||||
import be.ugent.sel.studeez.screens.session.sessionScreens.AbstractSessionScreen
|
||||
|
||||
class FunctionalEndlessTimer : FunctionalTimer(0) {
|
||||
|
||||
override fun hasEnded(): Boolean {
|
||||
|
@ -18,7 +15,7 @@ class FunctionalEndlessTimer : FunctionalTimer(0) {
|
|||
totalStudyTime++
|
||||
}
|
||||
|
||||
override fun getView(): AbstractSessionScreen {
|
||||
return EndlessSessionScreen()
|
||||
override fun <T> accept(visitor: FunctionalTimerVisitor<T>): T {
|
||||
return visitor.visitFunctionalEndlessTimer(this)
|
||||
}
|
||||
}
|
|
@ -44,7 +44,7 @@ class FunctionalPomodoroTimer(
|
|||
return time.time == 0
|
||||
}
|
||||
|
||||
override fun getView(): AbstractSessionScreen {
|
||||
return BreakSessionScreen(this)
|
||||
override fun <T> accept(visitor: FunctionalTimerVisitor<T>): T {
|
||||
return visitor.visitFunctionalBreakTimer(this)
|
||||
}
|
||||
}
|
|
@ -18,7 +18,6 @@ abstract class FunctionalTimer(initialValue: Int) {
|
|||
|
||||
abstract fun hasCurrentCountdownEnded(): Boolean
|
||||
|
||||
abstract fun getView(): AbstractSessionScreen
|
||||
fun getSessionReport(): SessionReport {
|
||||
return SessionReport(
|
||||
id = "",
|
||||
|
@ -27,4 +26,5 @@ abstract class FunctionalTimer(initialValue: Int) {
|
|||
)
|
||||
}
|
||||
|
||||
abstract fun <T> accept(visitor: FunctionalTimerVisitor<T>): T
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package be.ugent.sel.studeez.data.local.models.timer_functional
|
||||
|
||||
interface FunctionalTimerVisitor<T> {
|
||||
|
||||
fun visitFunctionalCustomTimer(functionalCustomTimer: FunctionalCustomTimer): T
|
||||
|
||||
fun visitFunctionalEndlessTimer(functionalEndlessTimer: FunctionalEndlessTimer): T
|
||||
|
||||
fun visitFunctionalBreakTimer(functionalPomodoroTimer: FunctionalPomodoroTimer): T
|
||||
|
||||
}
|
Reference in a new issue