Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android route overview #345

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cargo-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env:

jobs:
publish_crate:
runs-on: macos-14
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- name: Cargo Publish
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
build:

runs-on: macos-13
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ios-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
ios-release:
runs-on: macos-14
runs-on: macos-15

permissions:
contents: write
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
format-lint:
runs-on: macos-14
runs-on: macos-15
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-ios-swiftformat
cancel-in-progress: true
Expand All @@ -24,7 +24,7 @@ jobs:
run: swiftformat . --lint

build-ferrostar:
runs-on: macos-14
runs-on: macos-15
permissions:
contents: write # To auto-commit Package.swift and binding changes

Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
retention-days: 5

build-demo:
runs-on: macos-14
runs-on: macos-15
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-ios-build-demo
cancel-in-progress: true
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
retention-days: 5

test:
runs-on: macos-14
runs-on: macos-15
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-ios-test
cancel-in-progress: true
Expand All @@ -131,7 +131,7 @@ jobs:
]
destination: [
# TODO: Add more destinations
'platform=iOS Simulator,name=iPhone 15,OS=17.2'
'platform=iOS Simulator,name=iPhone 16 Pro,OS=18.1'
]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:

jobs:
build:
runs-on: macos-13
runs-on: macos-15

steps:
- name: Checkout code
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:

jobs:
msrv:
runs-on: macos-14
runs-on: macos-15
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-rust-msrv
cancel-in-progress: true
Expand All @@ -27,7 +27,7 @@ jobs:
working-directory: common

semver-checks:
runs-on: macos-14
runs-on: macos-15
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-rust-semver
cancel-in-progress: true
Expand All @@ -41,7 +41,7 @@ jobs:
feature-group: default-features

rustfmt:
runs-on: macos-14
runs-on: macos-15
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-rust-rustfmt
cancel-in-progress: true
Expand All @@ -53,7 +53,7 @@ jobs:
working-directory: common

build:
runs-on: macos-14
runs-on: macos-15
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-rust-build
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/typos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
typos:
runs-on: macos-14
runs-on: macos-15
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-ios-swiftformat
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wasm-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:

jobs:
build:
runs-on: macos-14
runs-on: macos-15
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-wasm-build
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion android/composeui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {

android {
namespace 'com.stadiamaps.ferrostar.composeui'
compileSdk 34
compileSdk 35

defaultConfig {
minSdk 25
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.stadiamaps.ferrostar.composeui.config

import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp

sealed class CameraControlState {
data object Hidden : CameraControlState()

data class ShowRecenter(val updateCamera: () -> Unit) : CameraControlState()

data class ShowRouteOverview(val updateCamera: () -> Unit) : CameraControlState()
}

data class VisualNavigationViewConfig(
var showMute: Boolean = false,
var showZoom: Boolean = false,
var buttonSize: DpSize = DpSize(56.dp, 56.dp)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was previously an informal constant that was copied everywhere. This at least gives it a place to live, and opens the path for button scaling enhancements if needed.

) {
companion object {
fun Default() = VisualNavigationViewConfig(showMute = true, showZoom = true)
}
}

/** Enables the mute button in the navigation view. */
fun VisualNavigationViewConfig.useMuteButton(): VisualNavigationViewConfig {
showMute = true
return this
}

/** Enables the zoom button in the navigation view. */
fun VisualNavigationViewConfig.useZoomButton(): VisualNavigationViewConfig {
showZoom = true
return this
}

/** Changes the size of navigation buttons. */
fun VisualNavigationViewConfig.buttonSize(size: DpSize): VisualNavigationViewConfig {
buttonSize = size
return this
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import uniffi.ferrostar.VisualInstructionContent
fun InstructionsView(
instructions: VisualInstruction,
distanceToNextManeuver: Double?,
modifier: Modifier = Modifier,
distanceFormatter: DistanceFormatter = LocalizedDistanceFormatter(),
theme: InstructionRowTheme = DefaultInstructionRowTheme,
remainingSteps: List<RouteStep>? = null,
Expand All @@ -69,7 +70,8 @@ fun InstructionsView(

Box(
modifier =
Modifier.fillMaxWidth()
modifier
.fillMaxWidth()
.heightIn(max = screenHeight)
.animateContentSize(animationSpec = spring(stiffness = Spring.StiffnessHigh))
.background(theme.backgroundColor, RoundedCornerShape(10.dp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package com.stadiamaps.ferrostar.composeui.views.controls

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
Expand All @@ -18,6 +17,7 @@ import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import com.stadiamaps.ferrostar.composeui.R

Expand All @@ -32,13 +32,14 @@ import com.stadiamaps.ferrostar.composeui.R
@Composable
fun NavigationUIButton(
onClick: () -> Unit,
buttonSize: DpSize,
containerColor: Color = FloatingActionButtonDefaults.containerColor,
contentColor: Color = contentColorFor(containerColor),
content: @Composable () -> Unit
) {
FloatingActionButton(
onClick,
modifier = Modifier.width(56.dp).height(56.dp).shadow(6.dp, shape = CircleShape),
modifier = Modifier.size(buttonSize).shadow(6.dp, shape = CircleShape),
shape = CircleShape,
containerColor,
contentColor) {
Expand All @@ -50,7 +51,7 @@ fun NavigationUIButton(
@Composable
fun NavigationUIButtonPreview() {
Box(Modifier.background(Color.LightGray).padding(16.dp)) {
NavigationUIButton({}) {
NavigationUIButton({}, DpSize(56.dp, 56.dp)) {
Icon(Icons.Filled.Close, contentDescription = stringResource(id = R.string.end_navigation))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
Expand All @@ -22,11 +23,13 @@ import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import com.stadiamaps.ferrostar.composeui.R

@Composable
fun NavigationUIZoomButton(
buttonSize: DpSize,
onClickZoomIn: () -> Unit,
onClickZoomOut: () -> Unit,
containerColor: Color = FloatingActionButtonDefaults.containerColor,
Expand All @@ -38,7 +41,7 @@ fun NavigationUIZoomButton(
Column(modifier = Modifier.shadow(6.dp, shape = RoundedCornerShape(50))) {
FloatingActionButton(
onClick = onClickZoomIn,
modifier = Modifier.height(56.dp).width(56.dp),
modifier = Modifier.size(buttonSize),
shape = RoundedCornerShape(topStartPercent = 50, topEndPercent = 50),
containerColor = containerColor,
contentColor = contentColor,
Expand All @@ -48,13 +51,13 @@ fun NavigationUIZoomButton(
contentDescription = stringResource(id = R.string.zoom_in))
}

Box(modifier = Modifier.height(1.dp).width(56.dp)) {
Box(modifier = Modifier.height(1.dp).width(buttonSize.width)) {
HorizontalDivider(color = MaterialTheme.colorScheme.surfaceVariant)
}

FloatingActionButton(
onClick = onClickZoomOut,
modifier = Modifier.height(56.dp).width(56.dp),
modifier = Modifier.size(buttonSize),
shape = RoundedCornerShape(bottomStartPercent = 50, bottomEndPercent = 50),
containerColor = containerColor,
contentColor = contentColor,
Expand All @@ -69,5 +72,8 @@ fun NavigationUIZoomButton(
@Preview
@Composable
fun NavigationUIZoomButtonPreview() {
Box(Modifier.background(Color.LightGray).padding(16.dp)) { NavigationUIZoomButton({}, {}) }
Box(Modifier.background(Color.LightGray).padding(16.dp)) {
NavigationUIZoomButton(
buttonSize = DpSize(56.dp, 56.dp), onClickZoomIn = {}, onClickZoomOut = {})
}
}
Loading
Loading