Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 468ee5e4 authored by Kelly's avatar Kelly
Browse files

Adapt RTL for SPA progress bar.

Test: manually test on device
Bug: 254415883
Change-Id: Ib7c8d32d95f62df6c310c943896fd5eeb5bf2b61
parent 724fbcd7
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -30,9 +30,11 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.CornerRadius
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.drawscope.DrawScope
import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.dp

/**
@@ -62,13 +64,15 @@ fun LinearProgressBar(
}

private fun DrawScope.drawLinearBar(
    endFraction: Float,
    progress: Float,
    color: Color,
    roundedCorner: Boolean
) {
    val width = endFraction * size.width
    val isLtr = layoutDirection == LayoutDirection.Ltr
    val width = progress * size.width
    drawRoundRect(
        color = color,
        topLeft = if (isLtr) Offset.Zero else Offset((1 - progress) * size.width, 0f),
        size = Size(width, size.height),
        cornerRadius = if (roundedCorner) CornerRadius(
            size.height / 2,