Skip to content

Commit aadd2d7

Browse files
authored
chore: Use explicitApi. (#121)
Change-Id: Ibd3d442cefe59a194bb648143b802262e0ce5649
1 parent 456f72f commit aadd2d7

File tree

14 files changed

+67
-66
lines changed

14 files changed

+67
-66
lines changed

maps-compose/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ android {
2929

3030
kotlinOptions {
3131
jvmTarget = '1.8'
32+
freeCompilerArgs += '-Xexplicit-api=strict'
3233
}
3334
}
3435

maps-compose/src/androidTest/java/com/google/maps/android/compose/ExampleInstrumentedTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import org.junit.Assert.*
2828
* See [testing documentation](http://d.android.com/tools/testing).
2929
*/
3030
@RunWith(AndroidJUnit4::class)
31-
class ExampleInstrumentedTest {
31+
internal class ExampleInstrumentedTest {
3232
@Test
3333
fun useAppContext() {
3434
// Context of the app under test.

maps-compose/src/main/java/com/google/maps/android/compose/CameraPositionState.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import kotlin.coroutines.resumeWithException
4343
* initial state.
4444
*/
4545
@Composable
46-
inline fun rememberCameraPositionState(
46+
public inline fun rememberCameraPositionState(
4747
key: String? = null,
4848
crossinline init: CameraPositionState.() -> Unit = {}
4949
): CameraPositionState = rememberSaveable(key = key, saver = CameraPositionState.Saver) {
@@ -57,21 +57,21 @@ inline fun rememberCameraPositionState(
5757
*
5858
* @param position the initial camera position
5959
*/
60-
class CameraPositionState(
60+
public class CameraPositionState(
6161
position: CameraPosition = CameraPosition(LatLng(0.0, 0.0), 0f, 0f, 0f)
6262
) {
6363
/**
6464
* Whether the camera is currently moving or not. This includes any kind of movement:
6565
* panning, zooming, or rotation.
6666
*/
67-
var isMoving by mutableStateOf(false)
67+
public var isMoving: Boolean by mutableStateOf(false)
6868
internal set
6969

7070
/**
7171
* Returns the current [Projection] to be used for converting between screen
7272
* coordinates and lat/lng.
7373
*/
74-
val projection: Projection?
74+
public val projection: Projection?
7575
get() = map?.projection
7676

7777
/**
@@ -85,7 +85,7 @@ class CameraPositionState(
8585
/**
8686
* Current position of the camera on the map.
8787
*/
88-
var position: CameraPosition
88+
public var position: CameraPosition
8989
get() = rawPosition
9090
set(value) {
9191
synchronized(lock) {
@@ -181,7 +181,7 @@ class CameraPositionState(
181181
* strictly positive, otherwise an [IllegalArgumentException] will be thrown.
182182
*/
183183
@UiThread
184-
suspend fun animate(update: CameraUpdate, durationMs: Int = MAX_VALUE) {
184+
public suspend fun animate(update: CameraUpdate, durationMs: Int = MAX_VALUE) {
185185
val myJob = currentCoroutineContext()[Job]
186186
try {
187187
suspendCancellableCoroutine<Unit> { continuation ->
@@ -276,7 +276,7 @@ class CameraPositionState(
276276
* This method must be called from the map's UI thread.
277277
*/
278278
@UiThread
279-
fun move(update: CameraUpdate) {
279+
public fun move(update: CameraUpdate) {
280280
synchronized(lock) {
281281
val map = map
282282
movementOwner = null
@@ -289,11 +289,11 @@ class CameraPositionState(
289289
}
290290
}
291291

292-
companion object {
292+
public companion object {
293293
/**
294294
* The default saver implementation for [CameraPositionState]
295295
*/
296-
val Saver = Saver<CameraPositionState, CameraPosition>(
296+
public val Saver: Saver<CameraPositionState, CameraPosition> = Saver(
297297
save = { it.position },
298298
restore = { CameraPositionState(it) }
299299
)

maps-compose/src/main/java/com/google/maps/android/compose/Circle.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ internal class CircleNode(
5050
* @param onClick a lambda invoked when the circle is clicked
5151
*/
5252
@Composable
53-
fun Circle(
53+
public fun Circle(
5454
center: LatLng,
5555
clickable: Boolean = false,
5656
fillColor: Color = Color.Transparent,

maps-compose/src/main/java/com/google/maps/android/compose/GoogleMap.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ import kotlinx.coroutines.awaitCancellation
7171
* @param content the content of the map
7272
*/
7373
@Composable
74-
fun GoogleMap(
74+
public fun GoogleMap(
7575
modifier: Modifier = Modifier,
7676
cameraPositionState: CameraPositionState = rememberCameraPositionState(),
7777
contentDescription: String? = null,

maps-compose/src/main/java/com/google/maps/android/compose/GroundOverlay.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@ internal class GroundOverlayNode(
4040
*
4141
* Use one of the [create] methods to construct an instance of this class.
4242
*/
43-
class GroundOverlayPosition private constructor(
44-
val latLngBounds: LatLngBounds? = null,
45-
val location: LatLng? = null,
46-
val width: Float? = null,
47-
val height: Float? = null,
43+
public class GroundOverlayPosition private constructor(
44+
public val latLngBounds: LatLngBounds? = null,
45+
public val location: LatLng? = null,
46+
public val width: Float? = null,
47+
public val height: Float? = null,
4848
) {
49-
companion object {
50-
fun create(latLngBounds: LatLngBounds) : GroundOverlayPosition {
49+
public companion object {
50+
public fun create(latLngBounds: LatLngBounds) : GroundOverlayPosition {
5151
return GroundOverlayPosition(latLngBounds = latLngBounds)
5252
}
5353

54-
fun create(location: LatLng, width: Float, height: Float? = null) : GroundOverlayPosition {
54+
public fun create(location: LatLng, width: Float, height: Float? = null) : GroundOverlayPosition {
5555
return GroundOverlayPosition(
5656
location = location,
5757
width = width,
@@ -76,7 +76,7 @@ class GroundOverlayPosition private constructor(
7676
* @param onClick a lambda invoked when the ground overlay is clicked
7777
*/
7878
@Composable
79-
fun GroundOverlay(
79+
public fun GroundOverlay(
8080
position: GroundOverlayPosition,
8181
image: BitmapDescriptor,
8282
anchor: Offset = Offset(0.5f, 0.5f),

maps-compose/src/main/java/com/google/maps/android/compose/MapClickListeners.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,22 @@ import com.google.android.gms.maps.model.PointOfInterest
2626
* Default implementation of [IndoorStateChangeListener] with no-op
2727
* implementations.
2828
*/
29-
object DefaultIndoorStateChangeListener : IndoorStateChangeListener
29+
public object DefaultIndoorStateChangeListener : IndoorStateChangeListener
3030

3131
/**
3232
* Interface definition for building indoor level state changes.
3333
*/
34-
interface IndoorStateChangeListener {
34+
public interface IndoorStateChangeListener {
3535
/**
3636
* Callback invoked when an indoor building comes to focus.
3737
*/
38-
fun onIndoorBuildingFocused() {}
38+
public fun onIndoorBuildingFocused() {}
3939

4040
/**
4141
* Callback invoked when a level for a building is activated.
4242
* @param building the activated building
4343
*/
44-
fun onIndoorLevelActivated(building: IndoorBuilding) {}
44+
public fun onIndoorLevelActivated(building: IndoorBuilding) {}
4545
}
4646

4747
/**

maps-compose/src/main/java/com/google/maps/android/compose/MapProperties.kt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ internal val DefaultMapProperties = MapProperties()
2727
* compatibility on future changes.
2828
* See: https://jakewharton.com/public-api-challenges-in-kotlin/
2929
*/
30-
class MapProperties(
31-
val isBuildingEnabled: Boolean = false,
32-
val isIndoorEnabled: Boolean = false,
33-
val isMyLocationEnabled: Boolean = false,
34-
val isTrafficEnabled: Boolean = false,
35-
val latLngBoundsForCameraTarget: LatLngBounds? = null,
36-
val mapStyleOptions: MapStyleOptions? = null,
37-
val mapType: MapType = MapType.NORMAL,
38-
val maxZoomPreference: Float = 21.0f,
39-
val minZoomPreference: Float = 3.0f,
30+
public class MapProperties(
31+
public val isBuildingEnabled: Boolean = false,
32+
public val isIndoorEnabled: Boolean = false,
33+
public val isMyLocationEnabled: Boolean = false,
34+
public val isTrafficEnabled: Boolean = false,
35+
public val latLngBoundsForCameraTarget: LatLngBounds? = null,
36+
public val mapStyleOptions: MapStyleOptions? = null,
37+
public val mapType: MapType = MapType.NORMAL,
38+
public val maxZoomPreference: Float = 21.0f,
39+
public val minZoomPreference: Float = 3.0f,
4040
) {
4141
override fun toString(): String = "MapProperties(" +
4242
"isBuildingEnabled=$isBuildingEnabled, isIndoorEnabled=$isIndoorEnabled, " +
@@ -68,7 +68,7 @@ class MapProperties(
6868
minZoomPreference
6969
)
7070

71-
fun copy(
71+
public fun copy(
7272
isBuildingEnabled: Boolean = this.isBuildingEnabled,
7373
isIndoorEnabled: Boolean = this.isIndoorEnabled,
7474
isMyLocationEnabled: Boolean = this.isMyLocationEnabled,
@@ -78,7 +78,7 @@ class MapProperties(
7878
mapType: MapType = this.mapType,
7979
maxZoomPreference: Float = this.maxZoomPreference,
8080
minZoomPreference: Float = this.minZoomPreference,
81-
) = MapProperties(
81+
): MapProperties = MapProperties(
8282
isBuildingEnabled = isBuildingEnabled,
8383
isIndoorEnabled = isIndoorEnabled,
8484
isMyLocationEnabled = isMyLocationEnabled,

maps-compose/src/main/java/com/google/maps/android/compose/MapType.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import androidx.compose.runtime.Immutable
2020
* Enumerates the different types of map tiles.
2121
*/
2222
@Immutable
23-
enum class MapType(val value: Int) {
23+
public enum class MapType(public val value: Int) {
2424
NONE(com.google.android.gms.maps.GoogleMap.MAP_TYPE_NONE),
2525
NORMAL(com.google.android.gms.maps.GoogleMap.MAP_TYPE_NORMAL),
2626
SATELLITE(com.google.android.gms.maps.GoogleMap.MAP_TYPE_SATELLITE),

maps-compose/src/main/java/com/google/maps/android/compose/MapUiSettings.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ internal val DefaultMapUiSettings = MapUiSettings()
2525
* compatibility on future changes.
2626
* See: https://jakewharton.com/public-api-challenges-in-kotlin/
2727
*/
28-
class MapUiSettings(
29-
val compassEnabled: Boolean = true,
30-
val indoorLevelPickerEnabled: Boolean = true,
31-
val mapToolbarEnabled: Boolean = true,
32-
val myLocationButtonEnabled: Boolean = true,
33-
val rotationGesturesEnabled: Boolean = true,
34-
val scrollGesturesEnabled: Boolean = true,
35-
val scrollGesturesEnabledDuringRotateOrZoom: Boolean = true,
36-
val tiltGesturesEnabled: Boolean = true,
37-
val zoomControlsEnabled: Boolean = true,
38-
val zoomGesturesEnabled: Boolean = true,
28+
public class MapUiSettings(
29+
public val compassEnabled: Boolean = true,
30+
public val indoorLevelPickerEnabled: Boolean = true,
31+
public val mapToolbarEnabled: Boolean = true,
32+
public val myLocationButtonEnabled: Boolean = true,
33+
public val rotationGesturesEnabled: Boolean = true,
34+
public val scrollGesturesEnabled: Boolean = true,
35+
public val scrollGesturesEnabledDuringRotateOrZoom: Boolean = true,
36+
public val tiltGesturesEnabled: Boolean = true,
37+
public val zoomControlsEnabled: Boolean = true,
38+
public val zoomGesturesEnabled: Boolean = true,
3939
) {
4040
override fun toString(): String = "MapUiSettings(" +
4141
"compassEnabled=$compassEnabled, indoorLevelPickerEnabled=$indoorLevelPickerEnabled, " +
@@ -70,7 +70,7 @@ class MapUiSettings(
7070
zoomGesturesEnabled
7171
)
7272

73-
fun copy(
73+
public fun copy(
7474
compassEnabled: Boolean = this.compassEnabled,
7575
indoorLevelPickerEnabled: Boolean = this.indoorLevelPickerEnabled,
7676
mapToolbarEnabled: Boolean = this.mapToolbarEnabled,
@@ -81,7 +81,7 @@ class MapUiSettings(
8181
tiltGesturesEnabled: Boolean = this.tiltGesturesEnabled,
8282
zoomControlsEnabled: Boolean = this.zoomControlsEnabled,
8383
zoomGesturesEnabled: Boolean = this.zoomGesturesEnabled
84-
) = MapUiSettings(
84+
): MapUiSettings = MapUiSettings(
8585
compassEnabled = compassEnabled,
8686
indoorLevelPickerEnabled = indoorLevelPickerEnabled,
8787
mapToolbarEnabled = mapToolbarEnabled,

0 commit comments

Comments
 (0)