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

Commit 15d2f177 authored by Ellen Poe's avatar Ellen Poe
Browse files

feat: larger text for route progress indicators

parent 435c335c
Loading
Loading
Loading
Loading
Loading
+63 −8
Original line number Diff line number Diff line
@@ -5,28 +5,80 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import com.stadiamaps.ferrostar.composeui.config.NavigationViewComponentBuilder
import com.stadiamaps.ferrostar.composeui.models.CameraControlState
import com.stadiamaps.ferrostar.composeui.theme.DefaultNavigationUITheme
import com.stadiamaps.ferrostar.composeui.theme.DefaultInstructionRowTheme
import com.stadiamaps.ferrostar.composeui.theme.DefaultRoadNameViewTheme
import com.stadiamaps.ferrostar.composeui.theme.InstructionRowTheme
import com.stadiamaps.ferrostar.composeui.theme.NavigationUITheme
import com.stadiamaps.ferrostar.composeui.theme.RoadNameViewTheme
import com.stadiamaps.ferrostar.composeui.theme.TripProgressViewStyle
import com.stadiamaps.ferrostar.composeui.theme.TripProgressViewTheme
import com.stadiamaps.ferrostar.composeui.views.components.CurrentRoadNameView
import com.stadiamaps.ferrostar.composeui.views.components.InstructionsView
import com.stadiamaps.ferrostar.composeui.views.components.TripProgressView
import com.stadiamaps.ferrostar.core.NavigationUiState
import kotlin.time.ExperimentalTime

object CardinalNavigationUITheme : NavigationUITheme {
    override val instructionRowTheme: InstructionRowTheme
        @Composable get() = DefaultInstructionRowTheme

    override val roadNameViewTheme: RoadNameViewTheme
        @Composable get() = DefaultRoadNameViewTheme

    override val tripProgressViewTheme: TripProgressViewTheme
        @Composable get() = CardinalTripProgressViewTheme

    override val buttonSize: DpSize
        @Composable get() = DpSize(56.dp, 56.dp)
}

object CardinalTripProgressViewTheme : TripProgressViewTheme {
    override val style: TripProgressViewStyle
        @Composable get() = TripProgressViewStyle.SIMPLIFIED

    override val measurementTextStyle: TextStyle
        @Composable
        get() =
            MaterialTheme.typography.titleLarge.copy(
                color = MaterialTheme.colorScheme.onSurface, fontWeight = FontWeight.Normal)

    override val secondaryTextStyle: TextStyle
        @Composable
        get() =
            MaterialTheme.typography.labelSmall.copy(color = MaterialTheme.colorScheme.onSurfaceVariant)

    override val exitIconColor: Color
        @Composable get() = MaterialTheme.colorScheme.onSecondary

    override val exitButtonBackgroundColor: Color
        @Composable get() = MaterialTheme.colorScheme.secondary

    override val backgroundColor: Color
        @Composable get() = MaterialTheme.colorScheme.surface
}


@Composable
fun CardinalInstructionsView(modifier: Modifier, uiState: NavigationUiState) {
    uiState.visualInstruction?.let { instructions ->
        InstructionsView(
            modifier = modifier,
            instructions = instructions,
            theme = DefaultNavigationUITheme.instructionRowTheme,
            theme = CardinalNavigationUITheme.instructionRowTheme,
            remainingSteps = uiState.remainingSteps,
            distanceToNextManeuver = uiState.progress?.distanceToNextManeuver)
            distanceToNextManeuver = uiState.progress?.distanceToNextManeuver
        )
    }
}

@@ -40,9 +92,10 @@ fun CardinalProgressView(
    uiState.progress?.let { progress ->
        TripProgressView(
            modifier = modifier,
            theme = DefaultNavigationUITheme.tripProgressViewTheme,
            theme = CardinalNavigationUITheme.tripProgressViewTheme,
            progress = progress,
            onTapExit = onTapExit)
            onTapExit = onTapExit
        )
    }
}

@@ -57,11 +110,13 @@ fun CardinalRoadNameView(
            Row(
                modifier.fillMaxWidth(),
                verticalAlignment = Alignment.Bottom,
                horizontalArrangement = Arrangement.Center) {
                horizontalArrangement = Arrangement.Center
            ) {
                CurrentRoadNameView(
                    modifier = modifier,
                    theme = DefaultNavigationUITheme.roadNameViewTheme,
                    currentRoadName = roadName)
                    theme = CardinalNavigationUITheme.roadNameViewTheme,
                    currentRoadName = roadName
                )

                Spacer(modifier = Modifier.height(8.dp))
            }