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() { | ||||
|         if (!hasEnded()) { | ||||
|             time.minOne() | ||||
|             time++ | ||||
|             totalStudyTime++ | ||||
|         } | ||||
|     } | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ class FunctionalEndlessTimer : FunctionalTimer(0) { | |||
|     } | ||||
| 
 | ||||
|     override fun tick() { | ||||
|         time.plusOne() | ||||
|         time++ | ||||
|         totalStudyTime++ | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -22,7 +22,7 @@ class FunctionalPomodoroTimer( | |||
|             } | ||||
|             isInBreak = !isInBreak | ||||
|         } | ||||
|         time.minOne() | ||||
|         time-- | ||||
| 
 | ||||
|         if (!isInBreak) { | ||||
|             totalStudyTime++ | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ import be.ugent.sel.studeez.data.local.models.SessionReport | |||
| import com.google.firebase.Timestamp | ||||
| 
 | ||||
| abstract class FunctionalTimer(initialValue: Int) { | ||||
|     val time: Time = Time(initialValue) | ||||
|     var time: Time = Time(initialValue) | ||||
|     var totalStudyTime: Int = 0 | ||||
| 
 | ||||
|     fun getHoursMinutesSeconds(): HoursMinutesSeconds { | ||||
|  |  | |||
|  | @ -1,19 +1,13 @@ | |||
| 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() { | ||||
|         time-- | ||||
|     } | ||||
| 
 | ||||
|     fun plusOne() { | ||||
|         time++ | ||||
|     } | ||||
|     operator fun dec(): Time = Time(time - 1) | ||||
| 
 | ||||
|     fun getAsHMS(): HoursMinutesSeconds { | ||||
|         return HoursMinutesSeconds(time) | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| } | ||||
|  |  | |||
		Reference in a new issue
	
	 Lukas Barragan Torres
						Lukas Barragan Torres