diff --git a/gradle.properties b/gradle.properties index c2cb1930b..cf71b0ca7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -49,7 +49,7 @@ artifactoryPassword="" # when building the toolkit locally, typically from Android Studio. # You will need to specify the build version in local.properties. # Example: -# sdkBuildNumber=4446 +sdkBuildNumber=9999 # When building the toolkit with CI, these versions are obtained from command line provided properties, # see sdkVersionNumber in settings.gradle.kts. -sdkVersionNumber=200.7.0 +sdkVersionNumber=200.8.0 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4b3914ff9..8f48e9734 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -26,7 +26,7 @@ junit = "4.13.2" kotlin = "2.1.0" ksp = "2.1.0-1.0.29" media3Exoplayer = "1.5.0" -minSdk = "26" +minSdk = "28" mlkitBarcodeScanning = "17.3.0" kotlinxCoroutinesTest = "1.8.0" kotlinxSerializationJson = "1.8.0" @@ -36,8 +36,27 @@ truth = "1.4.4" uiautomator = "2.3.0" arcore = "1.47.0" playServicesLocation = "21.3.0" +okhttpBom = "4.12.0" +kotlinVersion="2.1.20" +ktx="1.16.0" +coroutinesAndroid="1.10.1" +coroutines="1.10.1" +jsonSerialization="1.8.0" +lifecycle="2.8.7" +securityCrypto="1.0.0" [libraries] +okhttp = { module = "com.squareup.okhttp3:okhttp" } +okhttp-bom = { group = "com.squareup.okhttp3", name = "okhttp-bom", version.ref = "okhttpBom" } +okhttp-url-connection = { module = "com.squareup.okhttp3:okhttp-urlconnection" } +okhttp-tls = { module = "com.squareup.okhttp3:okhttp-tls" } +kotlin-std-lib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlinVersion" } +ktx-core = { group = "androidx.core", name = "core-ktx", version.ref = "ktx" } +coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutinesAndroid" } +coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" } +serialization = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "jsonSerialization" } +lifecycle-common = { group = "androidx.lifecycle", name = "lifecycle-common", version.ref = "lifecycle" } +security = { group = "androidx.security", name = "security-crypto", version.ref = "securityCrypto" } androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose"} androidx-browser = { group = "androidx.browser", name = "browser", version.ref = "androidXBrowser"} androidx-camera-core = { group = "androidx.camera", name = "camera-core", version.ref = "androidxCamera" } diff --git a/kdoc/build.gradle.kts b/kdoc/build.gradle.kts index 13f34fc19..0d18da168 100644 --- a/kdoc/build.gradle.kts +++ b/kdoc/build.gradle.kts @@ -89,7 +89,7 @@ dependencies { // Puts the version in the KDoc dokkaPlugin(libs.dokka.versioning) // put exposed dependencies in dokka's classpath - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) } diff --git a/mapsSdk/.gitignore b/mapsSdk/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/mapsSdk/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/mapsSdk/build.gradle.kts b/mapsSdk/build.gradle.kts new file mode 100644 index 000000000..1da44629d --- /dev/null +++ b/mapsSdk/build.gradle.kts @@ -0,0 +1,2 @@ +configurations.maybeCreate("default") +artifacts.add("default", file("libs/arcgis-maps-kotlin-200.8.0-9999.aar")) diff --git a/microapps/ArTabletopApp/app/build.gradle.kts b/microapps/ArTabletopApp/app/build.gradle.kts index e53ae78f1..a853f9c14 100644 --- a/microapps/ArTabletopApp/app/build.gradle.kts +++ b/microapps/ArTabletopApp/app/build.gradle.kts @@ -80,7 +80,7 @@ dependencies { implementation(project(":microapps-lib")) implementation(project(":ar")) implementation(libs.arcore) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/ArWorldScaleApp/app/build.gradle.kts b/microapps/ArWorldScaleApp/app/build.gradle.kts index fd4404dce..7505c96e7 100644 --- a/microapps/ArWorldScaleApp/app/build.gradle.kts +++ b/microapps/ArWorldScaleApp/app/build.gradle.kts @@ -82,7 +82,7 @@ dependencies { implementation(project(":microapps-lib")) implementation(project(":ar")) implementation(libs.arcore) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/AuthenticationApp/app/build.gradle.kts b/microapps/AuthenticationApp/app/build.gradle.kts index 6d0ff5362..cb44e8e2f 100644 --- a/microapps/AuthenticationApp/app/build.gradle.kts +++ b/microapps/AuthenticationApp/app/build.gradle.kts @@ -80,7 +80,7 @@ android { dependencies { implementation(project(":authentication")) implementation(project(":microapps-lib")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/BasemapGalleryApp/app/build.gradle.kts b/microapps/BasemapGalleryApp/app/build.gradle.kts index 262f67abb..9d51de219 100644 --- a/microapps/BasemapGalleryApp/app/build.gradle.kts +++ b/microapps/BasemapGalleryApp/app/build.gradle.kts @@ -81,7 +81,7 @@ dependencies { implementation(project(":basemapgallery")) implementation(project(":geoview-compose")) implementation(project(":microapps-lib")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/CompassApp/app/build.gradle.kts b/microapps/CompassApp/app/build.gradle.kts index 7ae1a64bf..b83625cbc 100644 --- a/microapps/CompassApp/app/build.gradle.kts +++ b/microapps/CompassApp/app/build.gradle.kts @@ -79,7 +79,7 @@ dependencies { implementation(project(":compass")) implementation(project(":geoview-compose")) implementation(project(":microapps-lib")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/FeatureFormsApp/app/build.gradle.kts b/microapps/FeatureFormsApp/app/build.gradle.kts index 417dc4a31..f2405da35 100644 --- a/microapps/FeatureFormsApp/app/build.gradle.kts +++ b/microapps/FeatureFormsApp/app/build.gradle.kts @@ -81,7 +81,7 @@ dependencies { implementation(project(":featureforms")) implementation(project(":geoview-compose")) // sdk - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) // hilt implementation(libs.hilt.android.core) implementation(libs.androidx.hilt.navigation.compose) diff --git a/microapps/FloorFilterApp/app/build.gradle.kts b/microapps/FloorFilterApp/app/build.gradle.kts index 0ead7966f..5c1112635 100644 --- a/microapps/FloorFilterApp/app/build.gradle.kts +++ b/microapps/FloorFilterApp/app/build.gradle.kts @@ -62,7 +62,7 @@ dependencies { implementation(project(":indoors")) implementation(project(":geoview-compose")) implementation(project(":microapps-lib")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/LegendApp/app/build.gradle.kts b/microapps/LegendApp/app/build.gradle.kts index ca65ecfcc..0c475aced 100644 --- a/microapps/LegendApp/app/build.gradle.kts +++ b/microapps/LegendApp/app/build.gradle.kts @@ -81,7 +81,7 @@ dependencies { implementation(project(":legend")) implementation(project(":geoview-compose")) implementation(project(":microapps-lib")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/MapViewCalloutApp/app/build.gradle.kts b/microapps/MapViewCalloutApp/app/build.gradle.kts index cee90e237..b963cea9f 100644 --- a/microapps/MapViewCalloutApp/app/build.gradle.kts +++ b/microapps/MapViewCalloutApp/app/build.gradle.kts @@ -79,7 +79,7 @@ android { dependencies { implementation(project(":geoview-compose")) implementation(project(":microapps-lib")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/MapViewGeometryEditorApp/app/build.gradle.kts b/microapps/MapViewGeometryEditorApp/app/build.gradle.kts index 9f77536f2..1383f133d 100644 --- a/microapps/MapViewGeometryEditorApp/app/build.gradle.kts +++ b/microapps/MapViewGeometryEditorApp/app/build.gradle.kts @@ -80,7 +80,7 @@ android { dependencies { implementation(project(":geoview-compose")) implementation(project(":microapps-lib")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/MapViewGeometryEditorApp/app/src/main/java/com/arcgismaps/toolkit/mapviewgeometryeditorapp/MainActivity.kt b/microapps/MapViewGeometryEditorApp/app/src/main/java/com/arcgismaps/toolkit/mapviewgeometryeditorapp/MainActivity.kt index 22e53b4b4..e54c9fe14 100644 --- a/microapps/MapViewGeometryEditorApp/app/src/main/java/com/arcgismaps/toolkit/mapviewgeometryeditorapp/MainActivity.kt +++ b/microapps/MapViewGeometryEditorApp/app/src/main/java/com/arcgismaps/toolkit/mapviewgeometryeditorapp/MainActivity.kt @@ -22,9 +22,12 @@ import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember import androidx.compose.ui.tooling.preview.Preview import com.arcgismaps.ApiKey import com.arcgismaps.ArcGISEnvironment +import com.arcgismaps.mapping.view.geometryeditor.GeometryEditor +import com.arcgismaps.mapping.view.geometryeditor.ProgrammaticReticleTool import com.arcgismaps.toolkit.mapviewgeometryeditorapp.screens.MainScreen import com.esri.microappslib.theme.MicroAppTheme @@ -43,7 +46,9 @@ class MainActivity : ComponentActivity() { @Composable fun MapViewGeometryEditorApp() { - MainScreen() + // the geometry editor used to manage the editing session + val geometryEditor = remember { GeometryEditor() } + MainScreen(geometryEditor) } @Preview(showBackground = true) diff --git a/microapps/MapViewGeometryEditorApp/app/src/main/java/com/arcgismaps/toolkit/mapviewgeometryeditorapp/screens/MainScreen.kt b/microapps/MapViewGeometryEditorApp/app/src/main/java/com/arcgismaps/toolkit/mapviewgeometryeditorapp/screens/MainScreen.kt index 9f9a7b4cc..18b661f13 100644 --- a/microapps/MapViewGeometryEditorApp/app/src/main/java/com/arcgismaps/toolkit/mapviewgeometryeditorapp/screens/MainScreen.kt +++ b/microapps/MapViewGeometryEditorApp/app/src/main/java/com/arcgismaps/toolkit/mapviewgeometryeditorapp/screens/MainScreen.kt @@ -22,6 +22,9 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.MoreVert +import androidx.compose.material3.Button +import androidx.compose.ui.Alignment +import androidx.compose.foundation.layout.offset import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.ExperimentalMaterial3Api @@ -35,8 +38,10 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp import com.arcgismaps.Color import com.arcgismaps.geometry.Geometry import com.arcgismaps.geometry.GeometryType @@ -49,8 +54,12 @@ import com.arcgismaps.mapping.symbology.SimpleLineSymbolStyle import com.arcgismaps.mapping.view.Graphic import com.arcgismaps.mapping.view.GraphicsOverlay import com.arcgismaps.mapping.view.geometryeditor.GeometryEditor +import com.arcgismaps.mapping.view.geometryeditor.ProgrammaticReticleTool import com.arcgismaps.mapping.view.geometryeditor.VertexTool import com.arcgismaps.toolkit.geoviewcompose.MapView +import com.arcgismaps.toolkit.geoviewcompose.MapViewProxy +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.launch // line symbol of the graphic sketched on the map private val lineSymbol: SimpleLineSymbol by lazy { @@ -78,12 +87,13 @@ private val fillSymbol: SimpleFillSymbol by lazy { */ @OptIn(ExperimentalMaterial3Api::class) @Composable -fun MainScreen() { +fun MainScreen(geometryEditor: GeometryEditor) { + val mapViewProxy = remember { MapViewProxy() } + val coroutineScope = rememberCoroutineScope() + val arcGISMap by remember { mutableStateOf(ArcGISMap(BasemapStyle.ArcGISStreets)) } // the list of graphics overlays used by the MapView var graphicsOverlays by remember { mutableStateOf(emptyList()) } - // the geometry editor used to manage the editing session - val geometryEditor = remember { GeometryEditor() } // track the status if geometry editor is started or stopped var isDrawingEnabled by remember { mutableStateOf(false) } @@ -112,11 +122,22 @@ fun MainScreen() { } else { // on checked change, start the geometry editor startGeometryEditor(geometryEditor) + geometryEditor.tool = ProgrammaticReticleTool() // set isDrawingEnabled to true true } }) + Button(enabled = isDrawingEnabled, + onClick = { + if (geometryEditor.hoveredElement.value != null && geometryEditor.pickedUpElement.value == null) { + (geometryEditor.tool as ProgrammaticReticleTool).selectElementAtReticle() + (geometryEditor.tool as ProgrammaticReticleTool).pickUpSelectedElement() + } else if (geometryEditor.hoveredElement.value == null) + (geometryEditor.tool as ProgrammaticReticleTool).placeElementAtReticle() + }) + { Text("Do Action") } + var actionsExpanded by remember { mutableStateOf(false) } IconButton(onClick = { actionsExpanded = !actionsExpanded }) { Icon(Icons.Default.MoreVert, "More") @@ -143,7 +164,21 @@ fun MainScreen() { .padding(innerPadding) .fillMaxSize(), geometryEditor = geometryEditor, - graphicsOverlays = graphicsOverlays + graphicsOverlays = graphicsOverlays, + mapViewProxy = mapViewProxy, + onSingleTapConfirmed = { + (geometryEditor.tool as ProgrammaticReticleTool).placeElementAtReticle() + }, + onLongPress = { + coroutineScope.launch { + val result = mapViewProxy.identifyGeometryEditor(it.screenCoordinate, 15.dp) + result.onSuccess { + result.getOrNull()?.elements?.firstOrNull()?.let { + mapViewProxy.setViewpointGeometry(it.extent as Geometry) + } + } + } + } ) } } @@ -160,7 +195,7 @@ fun GeometryEditorDropDownMenu( onResetAllGraphics: () -> Unit = {} ) { val items = remember { - listOf("Clear sketch", "Undo sketch", "Redo sketch", "Reset all graphics") + listOf("Cancel move", "Clear sketch", "Undo sketch", "Redo sketch", "Reset all graphics") } DropdownMenu( expanded = expanded, @@ -172,6 +207,10 @@ fun GeometryEditorDropDownMenu( text = { Text(text = it) }, onClick = { when { + it.contains("Cancel move") -> { + geometryEditor.cancelCurrentAction() + } + it.contains("Clear sketch") -> { clearGeometryEditor(geometryEditor) } diff --git a/microapps/MapViewIdentifyApp/app/build.gradle.kts b/microapps/MapViewIdentifyApp/app/build.gradle.kts index 04455a955..33593bc46 100644 --- a/microapps/MapViewIdentifyApp/app/build.gradle.kts +++ b/microapps/MapViewIdentifyApp/app/build.gradle.kts @@ -80,7 +80,7 @@ android { dependencies { implementation(project(":geoview-compose")) implementation(project(":microapps-lib")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/MapViewInsetsApp/app/build.gradle.kts b/microapps/MapViewInsetsApp/app/build.gradle.kts index 26e7cad3b..3e5c587dc 100644 --- a/microapps/MapViewInsetsApp/app/build.gradle.kts +++ b/microapps/MapViewInsetsApp/app/build.gradle.kts @@ -80,7 +80,7 @@ android { dependencies { implementation(project(":geoview-compose")) implementation(project(":microapps-lib")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/MapViewLocationDisplayApp/app/build.gradle.kts b/microapps/MapViewLocationDisplayApp/app/build.gradle.kts index 67a864b0c..9ca7b160c 100644 --- a/microapps/MapViewLocationDisplayApp/app/build.gradle.kts +++ b/microapps/MapViewLocationDisplayApp/app/build.gradle.kts @@ -80,7 +80,7 @@ android { dependencies { implementation(project(":geoview-compose")) implementation(project(":microapps-lib")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/MapViewSetViewpointApp/app/build.gradle.kts b/microapps/MapViewSetViewpointApp/app/build.gradle.kts index 7d4066a44..c004f8a6e 100644 --- a/microapps/MapViewSetViewpointApp/app/build.gradle.kts +++ b/microapps/MapViewSetViewpointApp/app/build.gradle.kts @@ -80,7 +80,7 @@ android { dependencies { implementation(project(":geoview-compose")) implementation(project(":microapps-lib")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/PopupApp/app/build.gradle.kts b/microapps/PopupApp/app/build.gradle.kts index bb245e82b..68658010f 100644 --- a/microapps/PopupApp/app/build.gradle.kts +++ b/microapps/PopupApp/app/build.gradle.kts @@ -84,7 +84,7 @@ android { dependencies { implementation(project(":geoview-compose")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(project(":popup")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) diff --git a/microapps/ScalebarApp/app/build.gradle.kts b/microapps/ScalebarApp/app/build.gradle.kts index 3bf17f300..d1e71e8c2 100644 --- a/microapps/ScalebarApp/app/build.gradle.kts +++ b/microapps/ScalebarApp/app/build.gradle.kts @@ -81,7 +81,7 @@ dependencies { implementation(project(":scalebar")) implementation(project(":geoview-compose")) implementation(project(":microapps-lib")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/SceneViewAnalysisOverlayApp/app/build.gradle.kts b/microapps/SceneViewAnalysisOverlayApp/app/build.gradle.kts index 984c0ccf3..775280289 100644 --- a/microapps/SceneViewAnalysisOverlayApp/app/build.gradle.kts +++ b/microapps/SceneViewAnalysisOverlayApp/app/build.gradle.kts @@ -80,7 +80,7 @@ android { dependencies { implementation(project(":geoview-compose")) implementation(project(":microapps-lib")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/SceneViewCalloutApp/app/build.gradle.kts b/microapps/SceneViewCalloutApp/app/build.gradle.kts index 84e707a87..a79de890f 100644 --- a/microapps/SceneViewCalloutApp/app/build.gradle.kts +++ b/microapps/SceneViewCalloutApp/app/build.gradle.kts @@ -79,7 +79,7 @@ android { dependencies { implementation(project(":geoview-compose")) implementation(project(":microapps-lib")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/SceneViewCameraControllerApp/app/build.gradle.kts b/microapps/SceneViewCameraControllerApp/app/build.gradle.kts index 98dc32459..537cb8441 100644 --- a/microapps/SceneViewCameraControllerApp/app/build.gradle.kts +++ b/microapps/SceneViewCameraControllerApp/app/build.gradle.kts @@ -80,7 +80,7 @@ android { dependencies { implementation(project(":geoview-compose")) implementation(project(":microapps-lib")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/SceneViewLightingOptionsApp/app/build.gradle.kts b/microapps/SceneViewLightingOptionsApp/app/build.gradle.kts index c9d81a34e..ae735267d 100644 --- a/microapps/SceneViewLightingOptionsApp/app/build.gradle.kts +++ b/microapps/SceneViewLightingOptionsApp/app/build.gradle.kts @@ -80,7 +80,7 @@ android { dependencies { implementation(project(":geoview-compose")) implementation(project(":microapps-lib")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/SceneViewSetViewpointApp/app/build.gradle.kts b/microapps/SceneViewSetViewpointApp/app/build.gradle.kts index 30404ff52..0e92da83d 100644 --- a/microapps/SceneViewSetViewpointApp/app/build.gradle.kts +++ b/microapps/SceneViewSetViewpointApp/app/build.gradle.kts @@ -80,7 +80,7 @@ android { dependencies { implementation(project(":geoview-compose")) implementation(project(":microapps-lib")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/TemplateApp/app/build.gradle.kts b/microapps/TemplateApp/app/build.gradle.kts index 1e5deb28b..7c06423c4 100644 --- a/microapps/TemplateApp/app/build.gradle.kts +++ b/microapps/TemplateApp/app/build.gradle.kts @@ -80,7 +80,7 @@ android { dependencies { implementation(project(":geoview-compose")) implementation(project(":microapps-lib")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/microapps/UtilityNetworkTraceApp/app/build.gradle.kts b/microapps/UtilityNetworkTraceApp/app/build.gradle.kts index 7b3d6754b..0167bf89f 100644 --- a/microapps/UtilityNetworkTraceApp/app/build.gradle.kts +++ b/microapps/UtilityNetworkTraceApp/app/build.gradle.kts @@ -81,7 +81,7 @@ dependencies { implementation(project(":geoview-compose")) implementation(project(":microapps-lib")) implementation(project(":utilitynetworks")) - implementation(arcgis.mapsSdk) + implementation(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/settings.gradle.kts b/settings.gradle.kts index c65cf4900..4b0a0f7a0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -99,6 +99,7 @@ dependencyResolutionManagement { // fixes https://issuetracker.google.com/issues/315023802 gradle.startParameter.excludedTaskNames.addAll(listOf(":buildSrc:testClasses")) +include(":mapsSdk") include(":bom") project(":bom").projectDir = File(rootDir, "bom") include(":kdoc") diff --git a/toolkit/ar/build.gradle.kts b/toolkit/ar/build.gradle.kts index 252182a98..693ffa241 100644 --- a/toolkit/ar/build.gradle.kts +++ b/toolkit/ar/build.gradle.kts @@ -102,7 +102,7 @@ apiValidation { dependencies { implementation(project(":geoview-compose")) implementation(libs.arcore) - api(arcgis.mapsSdk) + api(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/toolkit/authentication/build.gradle.kts b/toolkit/authentication/build.gradle.kts index 5732d1658..3c7f52569 100644 --- a/toolkit/authentication/build.gradle.kts +++ b/toolkit/authentication/build.gradle.kts @@ -96,7 +96,7 @@ apiValidation { } dependencies { - api(arcgis.mapsSdk) + api(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/toolkit/basemapgallery/build.gradle.kts b/toolkit/basemapgallery/build.gradle.kts index 01db2b5bf..680284b9b 100644 --- a/toolkit/basemapgallery/build.gradle.kts +++ b/toolkit/basemapgallery/build.gradle.kts @@ -69,7 +69,7 @@ android { } dependencies { - api(arcgis.mapsSdk) + api(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/toolkit/composable-map/build.gradle.kts b/toolkit/composable-map/build.gradle.kts index 79f42cc61..7f8259e9f 100644 --- a/toolkit/composable-map/build.gradle.kts +++ b/toolkit/composable-map/build.gradle.kts @@ -74,7 +74,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class).all { } dependencies { - api(arcgis.mapsSdk) + api(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/toolkit/featureforms/build.gradle.kts b/toolkit/featureforms/build.gradle.kts index c0fbdf08d..c970a0056 100644 --- a/toolkit/featureforms/build.gradle.kts +++ b/toolkit/featureforms/build.gradle.kts @@ -113,7 +113,7 @@ apiValidation { dependencies { - api(arcgis.mapsSdk) + api(project(":mapsSdk")) implementation(libs.bundles.commonmark) implementation(platform(libs.coil.bom)) implementation(libs.coil.compose) diff --git a/toolkit/geoview-compose/build.gradle.kts b/toolkit/geoview-compose/build.gradle.kts index 946f5d78b..5119933ba 100644 --- a/toolkit/geoview-compose/build.gradle.kts +++ b/toolkit/geoview-compose/build.gradle.kts @@ -74,7 +74,7 @@ android { } dependencies { - api(arcgis.mapsSdk) + api(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) @@ -84,4 +84,20 @@ dependencies { androidTestImplementation(libs.bundles.composeTest) androidTestImplementation(libs.androidx.uiautomator) debugImplementation(libs.bundles.debug) + + implementation(libs.kotlin.std.lib) + implementation(libs.ktx.core) + implementation(libs.coroutines.android) + implementation(libs.kotlin.reflect) + implementation(libs.security) + implementation(libs.serialization) + + // dependencies that need to be in the aar consumer's classpath. + implementation(libs.lifecycle.common) + implementation(libs.coroutines.core) + + // OkHttp dependencies + implementation(platform(libs.okhttp.bom)) + implementation(libs.okhttp.url.connection) + implementation(libs.okhttp) } diff --git a/toolkit/geoview-compose/src/androidTest/java/com/arcgismaps/toolkit/geoviewcompose/MapViewProxyTests.kt b/toolkit/geoview-compose/src/androidTest/java/com/arcgismaps/toolkit/geoviewcompose/MapViewProxyTests.kt new file mode 100644 index 000000000..5e82009df --- /dev/null +++ b/toolkit/geoview-compose/src/androidTest/java/com/arcgismaps/toolkit/geoviewcompose/MapViewProxyTests.kt @@ -0,0 +1,121 @@ +/* + * + * Copyright 2024 Esri + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.arcgismaps.toolkit.geoviewcompose + +import android.os.Parcel +import androidx.activity.compose.rememberLauncherForActivityResult +import androidx.compose.material3.Card +import androidx.compose.runtime.getValue +import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberUpdatedState +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.semantics.contentDescription +import androidx.compose.ui.semantics.semantics +import androidx.compose.ui.test.ExperimentalTestApi +import androidx.compose.ui.test.assert +import androidx.compose.ui.test.assertIsDisplayed +import androidx.compose.ui.test.hasContentDescription +import androidx.compose.ui.test.hasParent +import androidx.compose.ui.test.junit4.createComposeRule +import androidx.compose.ui.test.onChildAt +import androidx.compose.ui.test.onNodeWithContentDescription +import com.arcgismaps.mapping.ArcGISMap +import com.arcgismaps.mapping.view.MapView +import com.arcgismaps.mapping.view.ScreenCoordinate +import junit.framework.TestCase.assertEquals +import junit.framework.TestCase.assertTrue +import kotlinx.coroutines.test.runTest +import org.junit.Rule +import org.junit.Test +import androidx.compose.ui.unit.dp +import com.arcgismaps.geometry.GeometryType +import com.arcgismaps.mapping.view.geometryeditor.GeometryEditor + +/** + * Tests for the [ViewpointPersistence] class. + * + * @since 200.4.0 + */ +class MapViewProxyTests { + + @get:Rule + val composeTestRule = createComposeRule() + /** + * GIVEN a [ViewpointPersistence] object + * WHEN it is created from a [Parcel] + * THEN the read back object is equal to the original one + * + * @since 200.4.0 + */ + @Test + fun testIdentifyGeometryEditorErrorResult() = runTest { + // Create instances of each class + val mapViewProxy = MapViewProxy() + val result = mapViewProxy.identifyGeometryEditor(ScreenCoordinate(0.0,0.0), 15.dp) + + // Assert that the read back instances are equal to the original ones + assertTrue(result.isFailure) + } + + @Test + fun testIdentifyGeometryEditorEmptyResult() = runTest { + + val mapViewProxy = MapViewProxy() + + + //mapView.geometryEditor = geometryEditor + + composeTestRule.setContent { + val context = LocalContext.current.applicationContext + val mapView = remember { MapView(context) } + val geometryEditor = remember {GeometryEditor()} + mapView.geometryEditor = geometryEditor +// val mapView by rememberUpdatedState() { +// //val mapView = remember { +// //MapView(LocalContext.current.applicationContext) +// context = +// geometryEditor = geometryEditor +// } + + mapViewProxy.setMapView(mapView) + + geometryEditor.start(GeometryType.Point) + +// context.applicationContext.run { +// val result = mapViewProxy.identifyGeometryEditor(ScreenCoordinate(0.0, 0.0), 15.dp) +// assertTrue(result.isSuccess) +// } + } + +// composeTestRule.run { + val result = mapViewProxy.identifyGeometryEditor(ScreenCoordinate(0.0, 0.0), 15.dp) + assertTrue(result.isSuccess) +// } +// runTest { +// val result = mapViewProxy.identifyGeometryEditor(ScreenCoordinate(0.0, 0.0), 15.dp) +// assertTrue(result.isSuccess) +// } + + //composeTestRule.waitUntil {mapViewProxy.identifyGeometryEditor(ScreenCoordinate(0.0,0.0).isSuccess } + + +} + +} diff --git a/toolkit/geoview-compose/src/main/java/com/arcgismaps/toolkit/geoviewcompose/MapViewProxy.kt b/toolkit/geoview-compose/src/main/java/com/arcgismaps/toolkit/geoviewcompose/MapViewProxy.kt index d343ca443..d3614dbb2 100644 --- a/toolkit/geoview-compose/src/main/java/com/arcgismaps/toolkit/geoviewcompose/MapViewProxy.kt +++ b/toolkit/geoview-compose/src/main/java/com/arcgismaps/toolkit/geoviewcompose/MapViewProxy.kt @@ -18,10 +18,12 @@ package com.arcgismaps.toolkit.geoviewcompose import androidx.compose.runtime.Stable +import androidx.compose.ui.unit.Dp import com.arcgismaps.geometry.Geometry import com.arcgismaps.geometry.Point import com.arcgismaps.mapping.Viewpoint import com.arcgismaps.mapping.view.AnimationCurve +import com.arcgismaps.mapping.view.IdentifyGeometryEditorResult import com.arcgismaps.mapping.view.ScreenCoordinate import kotlin.time.Duration import kotlin.time.DurationUnit @@ -103,6 +105,33 @@ public class MapViewProxy : GeoViewProxy("MapView") { } } + /** + * Initiate an Identify operation on the mapView's [geometryEditor], if any, to return GeometryEditor elements. + * + * The [tolerance] parameter determines the extent of the region used during the identify operation. This overload + * will return the visible topmost graphic. A tolerance of 0 tests just the physical pixel at [screenCoordinate]. + * Tolerance values above 0 are in DIPs and specify a circular region centered on [screenCoordinate], with radius equal + * to [tolerance]. The maximum allowed tolerance value is 100 DIPs, resulting in an identify circle of diameter + * 200 DIPs. + * + * GeometryEditorElement results are returned in the same order as on the [geometryEditor] display; that is top-first order, + * for example with GeometryEditorVertex first. + * + * @param screenCoordinate location at which to run identify in screen coordinates + * @param tolerance extent of the region used during the identify operation + * @return A [Result] containing an [IdentifyGeometryEditorResult], or failure if there is no [geometryEditor] + * @since 200.8.0 + */ + public suspend fun identifyGeometryEditor( + screenCoordinate: ScreenCoordinate, + tolerance: Dp + ): Result { + return mapView?.identifyGeometryEditor( + screenCoordinate, + tolerance.value.toDouble(), + ) ?: Result.failure(IllegalStateException(nullGeoViewErrorMessage)) + } + /** * Animates the map view to the new viewpoint, taking the given duration to complete the navigation. * diff --git a/toolkit/indoors/build.gradle.kts b/toolkit/indoors/build.gradle.kts index 94a87e099..0190e42d2 100644 --- a/toolkit/indoors/build.gradle.kts +++ b/toolkit/indoors/build.gradle.kts @@ -69,7 +69,7 @@ apiValidation { dependencies { - api(arcgis.mapsSdk) + api(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/toolkit/legend/build.gradle.kts b/toolkit/legend/build.gradle.kts index 2cf5e20ae..524fe9d46 100644 --- a/toolkit/legend/build.gradle.kts +++ b/toolkit/legend/build.gradle.kts @@ -88,7 +88,7 @@ apiValidation { } dependencies { - api(arcgis.mapsSdk) + api(project(":mapsSdk")) implementation(project(":geoview-compose")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) diff --git a/toolkit/popup/build.gradle.kts b/toolkit/popup/build.gradle.kts index a92a0f35a..80e4aa8eb 100644 --- a/toolkit/popup/build.gradle.kts +++ b/toolkit/popup/build.gradle.kts @@ -84,7 +84,7 @@ apiValidation { } dependencies { - api(arcgis.mapsSdk) + api(project(":mapsSdk")) implementation(platform(libs.coil.bom)) implementation(libs.coil.compose) implementation(platform(libs.androidx.compose.bom)) diff --git a/toolkit/scalebar/build.gradle.kts b/toolkit/scalebar/build.gradle.kts index 622f96b91..13a1bd0ac 100644 --- a/toolkit/scalebar/build.gradle.kts +++ b/toolkit/scalebar/build.gradle.kts @@ -74,7 +74,7 @@ android { } dependencies { - api(arcgis.mapsSdk) + api(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/toolkit/template/build.gradle.kts b/toolkit/template/build.gradle.kts index d6bf1e145..2759d1f9c 100644 --- a/toolkit/template/build.gradle.kts +++ b/toolkit/template/build.gradle.kts @@ -73,7 +73,7 @@ android { } dependencies { - api(arcgis.mapsSdk) + api(project(":mapsSdk")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore) implementation(libs.bundles.core) diff --git a/toolkit/utilitynetworks/build.gradle.kts b/toolkit/utilitynetworks/build.gradle.kts index 99eb33cba..5e5ed1c42 100644 --- a/toolkit/utilitynetworks/build.gradle.kts +++ b/toolkit/utilitynetworks/build.gradle.kts @@ -103,7 +103,7 @@ apiValidation { } dependencies { - api(arcgis.mapsSdk) + api(project(":mapsSdk")) implementation(project(":geoview-compose")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.composeCore)