changed Time increase and decrease functions
This commit is contained in:
parent
853a09866a
commit
e0f46d676b
5 changed files with 9 additions and 15 deletions
|
@ -4,7 +4,7 @@ class FunctionalCustomTimer(studyTime: Int) : FunctionalTimer(studyTime) {
|
||||||
|
|
||||||
override fun tick() {
|
override fun tick() {
|
||||||
if (!hasEnded()) {
|
if (!hasEnded()) {
|
||||||
time.minOne()
|
time++
|
||||||
totalStudyTime++
|
totalStudyTime++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ class FunctionalEndlessTimer : FunctionalTimer(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun tick() {
|
override fun tick() {
|
||||||
time.plusOne()
|
time++
|
||||||
totalStudyTime++
|
totalStudyTime++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class FunctionalPomodoroTimer(
|
||||||
}
|
}
|
||||||
isInBreak = !isInBreak
|
isInBreak = !isInBreak
|
||||||
}
|
}
|
||||||
time.minOne()
|
time--
|
||||||
|
|
||||||
if (!isInBreak) {
|
if (!isInBreak) {
|
||||||
totalStudyTime++
|
totalStudyTime++
|
||||||
|
|
|
@ -4,7 +4,7 @@ import be.ugent.sel.studeez.data.local.models.SessionReport
|
||||||
import com.google.firebase.Timestamp
|
import com.google.firebase.Timestamp
|
||||||
|
|
||||||
abstract class FunctionalTimer(initialValue: Int) {
|
abstract class FunctionalTimer(initialValue: Int) {
|
||||||
val time: Time = Time(initialValue)
|
var time: Time = Time(initialValue)
|
||||||
var totalStudyTime: Int = 0
|
var totalStudyTime: Int = 0
|
||||||
|
|
||||||
fun getHoursMinutesSeconds(): HoursMinutesSeconds {
|
fun getHoursMinutesSeconds(): HoursMinutesSeconds {
|
||||||
|
|
|
@ -1,19 +1,13 @@
|
||||||
package be.ugent.sel.studeez.data.local.models.timer_functional
|
package be.ugent.sel.studeez.data.local.models.timer_functional
|
||||||
|
|
||||||
class Time(initialTime: Int) {
|
class Time(var time: Int) {
|
||||||
|
operator fun invoke() = time
|
||||||
|
|
||||||
var time = initialTime
|
operator fun inc(): Time = Time(time + 1)
|
||||||
|
|
||||||
fun minOne() {
|
operator fun dec(): Time = Time(time - 1)
|
||||||
time--
|
|
||||||
}
|
|
||||||
|
|
||||||
fun plusOne() {
|
|
||||||
time++
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getAsHMS(): HoursMinutesSeconds {
|
fun getAsHMS(): HoursMinutesSeconds {
|
||||||
return HoursMinutesSeconds(time)
|
return HoursMinutesSeconds(time)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
Reference in a new issue