all dots green when ended
This commit is contained in:
parent
ad0780416d
commit
5f0bdc948f
1 changed files with 20 additions and 17 deletions
|
@ -4,18 +4,13 @@ import android.media.MediaPlayer
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.material.Text
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import be.ugent.sel.studeez.R
|
|
||||||
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalPomodoroTimer
|
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalPomodoroTimer
|
||||||
import be.ugent.sel.studeez.resources
|
import be.ugent.sel.studeez.resources
|
||||||
import be.ugent.sel.studeez.R.string as AppText
|
import be.ugent.sel.studeez.R.string as AppText
|
||||||
|
@ -23,7 +18,7 @@ import be.ugent.sel.studeez.R.string as AppText
|
||||||
class BreakSessionScreen(
|
class BreakSessionScreen(
|
||||||
private val funPomoDoroTimer: FunctionalPomodoroTimer,
|
private val funPomoDoroTimer: FunctionalPomodoroTimer,
|
||||||
private var mediaplayer: MediaPlayer?
|
private var mediaplayer: MediaPlayer?
|
||||||
): AbstractSessionScreen() {
|
) : AbstractSessionScreen() {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun MidSection() {
|
override fun MidSection() {
|
||||||
|
@ -37,23 +32,31 @@ class BreakSessionScreen(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
) {
|
) {
|
||||||
repeat(funPomoDoroTimer.repeats - funPomoDoroTimer.breaksRemaining - 1) {
|
if (funPomoDoroTimer.hasEnded()) {
|
||||||
Dot(color = Color.DarkGray)
|
repeat(funPomoDoroTimer.repeats) {
|
||||||
}
|
Dot(Color.Green)
|
||||||
if (!funPomoDoroTimer.isInBreak) Dot(Color.Green) else Dot(Color.DarkGray)
|
}
|
||||||
repeat(funPomoDoroTimer.breaksRemaining) {
|
} else {
|
||||||
Dot(color = Color.Gray)
|
repeat(funPomoDoroTimer.repeats - funPomoDoroTimer.breaksRemaining - 1) {
|
||||||
|
Dot(color = Color.DarkGray)
|
||||||
|
}
|
||||||
|
if (!funPomoDoroTimer.isInBreak) Dot(Color.Green) else Dot(Color.DarkGray)
|
||||||
|
repeat(funPomoDoroTimer.breaksRemaining) {
|
||||||
|
Dot(color = Color.Gray)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun Dot(color: Color) {
|
private fun Dot(color: Color) {
|
||||||
Box(modifier = Modifier
|
Box(
|
||||||
.padding(5.dp)
|
modifier = Modifier
|
||||||
.size(10.dp)
|
.padding(5.dp)
|
||||||
.clip(CircleShape)
|
.size(10.dp)
|
||||||
.background(color))
|
.clip(CircleShape)
|
||||||
|
.background(color)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
Reference in a new issue