Skip to content
Closed
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
1 change: 1 addition & 0 deletions maps-compose/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ android {

kotlinOptions {
jvmTarget = '1.8'
freeCompilerArgs += '-Xexplicit-api=strict'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import org.junit.Assert.*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
internal class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import kotlin.coroutines.resumeWithException
* initial state.
*/
@Composable
inline fun rememberCameraPositionState(
public inline fun rememberCameraPositionState(
key: String? = null,
crossinline init: CameraPositionState.() -> Unit = {}
): CameraPositionState = rememberSaveable(key = key, saver = CameraPositionState.Saver) {
Expand All @@ -57,21 +57,21 @@ inline fun rememberCameraPositionState(
*
* @param position the initial camera position
*/
class CameraPositionState(
public class CameraPositionState(
position: CameraPosition = CameraPosition(LatLng(0.0, 0.0), 0f, 0f, 0f)
) {
/**
* Whether the camera is currently moving or not. This includes any kind of movement:
* panning, zooming, or rotation.
*/
var isMoving by mutableStateOf(false)
public var isMoving: Boolean by mutableStateOf(false)
internal set

/**
* Returns the current [Projection] to be used for converting between screen
* coordinates and lat/lng.
*/
val projection: Projection?
public val projection: Projection?
get() = map?.projection

/**
Expand All @@ -85,7 +85,7 @@ class CameraPositionState(
/**
* Current position of the camera on the map.
*/
var position: CameraPosition
public var position: CameraPosition
get() = rawPosition
set(value) {
synchronized(lock) {
Expand Down Expand Up @@ -181,7 +181,7 @@ class CameraPositionState(
* strictly positive, otherwise an [IllegalArgumentException] will be thrown.
*/
@UiThread
suspend fun animate(update: CameraUpdate, durationMs: Int = MAX_VALUE) {
public suspend fun animate(update: CameraUpdate, durationMs: Int = MAX_VALUE) {
val myJob = currentCoroutineContext()[Job]
try {
suspendCancellableCoroutine<Unit> { continuation ->
Expand Down Expand Up @@ -276,7 +276,7 @@ class CameraPositionState(
* This method must be called from the map's UI thread.
*/
@UiThread
fun move(update: CameraUpdate) {
public fun move(update: CameraUpdate) {
synchronized(lock) {
val map = map
movementOwner = null
Expand All @@ -289,11 +289,11 @@ class CameraPositionState(
}
}

companion object {
public companion object {
/**
* The default saver implementation for [CameraPositionState]
*/
val Saver = Saver<CameraPositionState, CameraPosition>(
public val Saver: Saver<CameraPositionState, CameraPosition> = Saver(
save = { it.position },
restore = { CameraPositionState(it) }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal class CircleNode(
* @param onClick a lambda invoked when the circle is clicked
*/
@Composable
fun Circle(
public fun Circle(
center: LatLng,
clickable: Boolean = false,
fillColor: Color = Color.Transparent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ import kotlinx.coroutines.awaitCancellation
* @param content the content of the map
*/
@Composable
fun GoogleMap(
public fun GoogleMap(
modifier: Modifier = Modifier,
cameraPositionState: CameraPositionState = rememberCameraPositionState(),
contentDescription: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ internal class GroundOverlayNode(
*
* Use one of the [create] methods to construct an instance of this class.
*/
class GroundOverlayPosition private constructor(
val latLngBounds: LatLngBounds? = null,
val location: LatLng? = null,
val width: Float? = null,
val height: Float? = null,
public class GroundOverlayPosition private constructor(
public val latLngBounds: LatLngBounds? = null,
public val location: LatLng? = null,
public val width: Float? = null,
public val height: Float? = null,
) {
companion object {
fun create(latLngBounds: LatLngBounds) : GroundOverlayPosition {
public companion object {
public fun create(latLngBounds: LatLngBounds) : GroundOverlayPosition {
return GroundOverlayPosition(latLngBounds = latLngBounds)
}

fun create(location: LatLng, width: Float, height: Float? = null) : GroundOverlayPosition {
public fun create(location: LatLng, width: Float, height: Float? = null) : GroundOverlayPosition {
return GroundOverlayPosition(
location = location,
width = width,
Expand All @@ -76,7 +76,7 @@ class GroundOverlayPosition private constructor(
* @param onClick a lambda invoked when the ground overlay is clicked
*/
@Composable
fun GroundOverlay(
public fun GroundOverlay(
position: GroundOverlayPosition,
image: BitmapDescriptor,
anchor: Offset = Offset(0.5f, 0.5f),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ import com.google.android.gms.maps.model.PointOfInterest
* Default implementation of [IndoorStateChangeListener] with no-op
* implementations.
*/
object DefaultIndoorStateChangeListener : IndoorStateChangeListener
public object DefaultIndoorStateChangeListener : IndoorStateChangeListener

/**
* Interface definition for building indoor level state changes.
*/
interface IndoorStateChangeListener {
public interface IndoorStateChangeListener {
/**
* Callback invoked when an indoor building comes to focus.
*/
fun onIndoorBuildingFocused() {}
public fun onIndoorBuildingFocused() {}

/**
* Callback invoked when a level for a building is activated.
* @param building the activated building
*/
fun onIndoorLevelActivated(building: IndoorBuilding) {}
public fun onIndoorLevelActivated(building: IndoorBuilding) {}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ internal val DefaultMapProperties = MapProperties()
* compatibility on future changes.
* See: https://jakewharton.com/public-api-challenges-in-kotlin/
*/
class MapProperties(
val isBuildingEnabled: Boolean = false,
val isIndoorEnabled: Boolean = false,
val isMyLocationEnabled: Boolean = false,
val isTrafficEnabled: Boolean = false,
val latLngBoundsForCameraTarget: LatLngBounds? = null,
val mapStyleOptions: MapStyleOptions? = null,
val mapType: MapType = MapType.NORMAL,
val maxZoomPreference: Float = 21.0f,
val minZoomPreference: Float = 3.0f,
public class MapProperties(
public val isBuildingEnabled: Boolean = false,
public val isIndoorEnabled: Boolean = false,
public val isMyLocationEnabled: Boolean = false,
public val isTrafficEnabled: Boolean = false,
public val latLngBoundsForCameraTarget: LatLngBounds? = null,
public val mapStyleOptions: MapStyleOptions? = null,
public val mapType: MapType = MapType.NORMAL,
public val maxZoomPreference: Float = 21.0f,
public val minZoomPreference: Float = 3.0f,
) {
override fun toString(): String = "MapProperties(" +
"isBuildingEnabled=$isBuildingEnabled, isIndoorEnabled=$isIndoorEnabled, " +
Expand Down Expand Up @@ -68,7 +68,7 @@ class MapProperties(
minZoomPreference
)

fun copy(
public fun copy(
isBuildingEnabled: Boolean = this.isBuildingEnabled,
isIndoorEnabled: Boolean = this.isIndoorEnabled,
isMyLocationEnabled: Boolean = this.isMyLocationEnabled,
Expand All @@ -78,7 +78,7 @@ class MapProperties(
mapType: MapType = this.mapType,
maxZoomPreference: Float = this.maxZoomPreference,
minZoomPreference: Float = this.minZoomPreference,
) = MapProperties(
): MapProperties = MapProperties(
isBuildingEnabled = isBuildingEnabled,
isIndoorEnabled = isIndoorEnabled,
isMyLocationEnabled = isMyLocationEnabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import androidx.compose.runtime.Immutable
* Enumerates the different types of map tiles.
*/
@Immutable
enum class MapType(val value: Int) {
public enum class MapType(public val value: Int) {
NONE(com.google.android.gms.maps.GoogleMap.MAP_TYPE_NONE),
NORMAL(com.google.android.gms.maps.GoogleMap.MAP_TYPE_NORMAL),
SATELLITE(com.google.android.gms.maps.GoogleMap.MAP_TYPE_SATELLITE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ internal val DefaultMapUiSettings = MapUiSettings()
* compatibility on future changes.
* See: https://jakewharton.com/public-api-challenges-in-kotlin/
*/
class MapUiSettings(
val compassEnabled: Boolean = true,
val indoorLevelPickerEnabled: Boolean = true,
val mapToolbarEnabled: Boolean = true,
val myLocationButtonEnabled: Boolean = true,
val rotationGesturesEnabled: Boolean = true,
val scrollGesturesEnabled: Boolean = true,
val scrollGesturesEnabledDuringRotateOrZoom: Boolean = true,
val tiltGesturesEnabled: Boolean = true,
val zoomControlsEnabled: Boolean = true,
val zoomGesturesEnabled: Boolean = true,
public class MapUiSettings(
public val compassEnabled: Boolean = true,
public val indoorLevelPickerEnabled: Boolean = true,
public val mapToolbarEnabled: Boolean = true,
public val myLocationButtonEnabled: Boolean = true,
public val rotationGesturesEnabled: Boolean = true,
public val scrollGesturesEnabled: Boolean = true,
public val scrollGesturesEnabledDuringRotateOrZoom: Boolean = true,
public val tiltGesturesEnabled: Boolean = true,
public val zoomControlsEnabled: Boolean = true,
public val zoomGesturesEnabled: Boolean = true,
) {
override fun toString(): String = "MapUiSettings(" +
"compassEnabled=$compassEnabled, indoorLevelPickerEnabled=$indoorLevelPickerEnabled, " +
Expand Down Expand Up @@ -70,7 +70,7 @@ class MapUiSettings(
zoomGesturesEnabled
)

fun copy(
public fun copy(
compassEnabled: Boolean = this.compassEnabled,
indoorLevelPickerEnabled: Boolean = this.indoorLevelPickerEnabled,
mapToolbarEnabled: Boolean = this.mapToolbarEnabled,
Expand All @@ -81,7 +81,7 @@ class MapUiSettings(
tiltGesturesEnabled: Boolean = this.tiltGesturesEnabled,
zoomControlsEnabled: Boolean = this.zoomControlsEnabled,
zoomGesturesEnabled: Boolean = this.zoomGesturesEnabled
) = MapUiSettings(
): MapUiSettings = MapUiSettings(
compassEnabled = compassEnabled,
indoorLevelPickerEnabled = indoorLevelPickerEnabled,
mapToolbarEnabled = mapToolbarEnabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ internal class MarkerNode(
}

@Immutable
enum class DragState {
public enum class DragState {
START, DRAG, END
}

Expand All @@ -61,18 +61,18 @@ enum class DragState {
*
* @param position the initial marker position
*/
class MarkerState(
public class MarkerState(
position: LatLng = LatLng(0.0, 0.0)
) {
/**
* Current position of the marker.
*/
var position: LatLng by mutableStateOf(position)
public var position: LatLng by mutableStateOf(position)

/**
* Current [DragState] of the marker.
*/
var dragState: DragState by mutableStateOf(DragState.END)
public var dragState: DragState by mutableStateOf(DragState.END)
internal set

// The marker associated with this MarkerState.
Expand All @@ -88,30 +88,30 @@ class MarkerState(
/**
* Shows the info window for the underlying marker
*/
fun showInfoWindow() {
public fun showInfoWindow() {
marker?.showInfoWindow()
}

/**
* Hides the info window for the underlying marker
*/
fun hideInfoWindow() {
public fun hideInfoWindow() {
marker?.hideInfoWindow()
}

companion object {
public companion object {
/**
* The default saver implementation for [MarkerState]
*/
val Saver = Saver<MarkerState, LatLng>(
public val Saver: Saver<MarkerState, LatLng> = Saver(
save = { it.position },
restore = { MarkerState(it) }
)
}
}

@Composable
fun rememberMarkerState(
public fun rememberMarkerState(
key: String? = null,
position: LatLng = LatLng(0.0, 0.0)
): MarkerState = rememberSaveable(key = key, saver = MarkerState.Saver) {
Expand Down Expand Up @@ -141,7 +141,7 @@ fun rememberMarkerState(
* @param onInfoWindowLongClick a lambda invoked when the marker's info window is long clicked
*/
@Composable
fun Marker(
public fun Marker(
state: MarkerState = rememberMarkerState(),
alpha: Float = 1.0f,
anchor: Offset = Offset(0.5f, 1.0f),
Expand Down Expand Up @@ -208,7 +208,7 @@ fun Marker(
* info window's content
*/
@Composable
fun MarkerInfoWindow(
public fun MarkerInfoWindow(
state: MarkerState = rememberMarkerState(),
alpha: Float = 1.0f,
anchor: Offset = Offset(0.5f, 1.0f),
Expand Down Expand Up @@ -277,7 +277,7 @@ fun MarkerInfoWindow(
* info window's content
*/
@Composable
fun MarkerInfoWindowContent(
public fun MarkerInfoWindowContent(
state: MarkerState = rememberMarkerState(),
alpha: Float = 1.0f,
anchor: Offset = Offset(0.5f, 1.0f),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ internal class PolygonNode(
* @param onClick a lambda invoked when the polygon is clicked
*/
@Composable
fun Polygon(
public fun Polygon(
points: List<LatLng>,
clickable: Boolean = false,
fillColor: Color = Color.Black,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ internal class PolylineNode(
* @param onClick a lambda invoked when the polyline is clicked
*/
@Composable
fun Polyline(
public fun Polyline(
points: List<LatLng>,
clickable: Boolean = false,
color: Color = Color.Black,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private class TileOverlayNode(
* @param onClick a lambda invoked when the tile overlay is clicked
*/
@Composable
fun TileOverlay(
public fun TileOverlay(
tileProvider: TileProvider,
fadeIn: Boolean = true,
transparency: Float = 0f,
Expand Down