Skip to content

Commit

Permalink
Merge branch 'main' into android_annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedre committed Nov 11, 2024
2 parents 455a7c7 + 2021ded commit f8d902d
Show file tree
Hide file tree
Showing 127 changed files with 606 additions and 309 deletions.
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
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ if useLocalFramework {
path: "./common/target/ios/libferrostar-rs.xcframework"
)
} else {
let releaseTag = "0.20.1"
let releaseChecksum = "a5d8ecc5b4d4b77e2e9fd237b3c6ffd62772606a996a0e34f0fc7ecadc19fb9c"
let releaseTag = "0.21.0"
let releaseChecksum = "1086da6011e474aaaae97555e33204afa6626df2f3c9042b2c1a91949d400066"
binaryTarget = .binaryTarget(
name: "FerrostarCoreRS",
url:
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ ext {

allprojects {
group = "com.stadiamaps.ferrostar"
version = "0.20.1"
version = "0.21.0"
}
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)
) {
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

0 comments on commit f8d902d

Please sign in to comment.