Skip to content

Commit

Permalink
Release v200.4.0 (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham7109 authored Apr 11, 2024
1 parent 4e30a73 commit 6008ed1
Show file tree
Hide file tree
Showing 333 changed files with 3,637 additions and 4,459 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview

ArcGIS Maps SDK for Kotlin v200.3.0 samples. The `main` branch of this repository contains sample app modules for the latest available version of the [ArcGIS Maps SDK Android Kotlin](https://developers.arcgis.com/kotlin/). Samples released under older versions can be found through the [git tags](https://github.com/Esri/arcgis-maps-sdk-kotlin-samples/tags). Please read our [wiki](https://github.com/Esri/arcgis-maps-sdk-kotlin-samples/wiki) for help with working with this repository.
ArcGIS Maps SDK for Kotlin v200.4.0 samples. The `main` branch of this repository contains sample app modules for the latest available version of the [ArcGIS Maps SDK Android Kotlin](https://developers.arcgis.com/kotlin/). Samples released under older versions can be found through the [git tags](https://github.com/Esri/arcgis-maps-sdk-kotlin-samples/tags). Please read our [wiki](https://github.com/Esri/arcgis-maps-sdk-kotlin-samples/wiki) for help with working with this repository.

## Prerequisites

Expand Down
3 changes: 2 additions & 1 deletion add-dynamic-entity-layer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ This sample uses a [stream service](https://realtimegis2016.esri.com:6443/arcgis

## Additional information

This sample uses the GeoViewCompose Toolkit module to be able to implement a Composable MapView.
More information about dynamic entities can be found in the [guide documentation](https://developers.arcgis.com/kotlin/real-time/work-with-dynamic-entities/).

## Tags

data, dynamic, entity, live, purge, real-time, service, stream, track
data, dynamic, entity, geoviewcompose, live, purge, real-time, service, stream, toolkit, track
3 changes: 2 additions & 1 deletion add-dynamic-entity-layer/README.metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
"data",
"dynamic",
"entity",
"geoviewcompose",
"live",
"purge",
"real-time",
"service",
"stream",
"toolkit",
"track",
"ArcGISStreamService",
"DynamicEntity",
Expand All @@ -36,7 +38,6 @@
"snippets": [
"src/main/java/com/esri/arcgismaps/sample/adddynamicentitylayer/MainActivity.kt",
"src/main/java/com/esri/arcgismaps/sample/adddynamicentitylayer/components/BottomSheetContent.kt",
"src/main/java/com/esri/arcgismaps/sample/adddynamicentitylayer/components/ComposeMapView.kt",
"src/main/java/com/esri/arcgismaps/sample/adddynamicentitylayer/components/MapViewModel.kt",
"src/main/java/com/esri/arcgismaps/sample/adddynamicentitylayer/screens/MainScreen.kt"
],
Expand Down
48 changes: 0 additions & 48 deletions add-dynamic-entity-layer/build.gradle

This file was deleted.

54 changes: 54 additions & 0 deletions add-dynamic-entity-layer/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
}

android {
compileSdk = libs.versions.compileSdk.get().toInt()

defaultConfig {
applicationId = "com.esri.arcgismaps.sample.adddynamicentitylayer"
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()
versionCode = libs.versions.versionCode.get().toInt()
versionName = libs.versions.versionName.get()
buildConfigField("String", "API_KEY", project.properties["API_KEY"].toString())
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
}
}

buildFeatures {
compose = true
buildConfig = true
}

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.kotlinCompilerExt.get()
}

namespace = "com.esri.arcgismaps.sample.adddynamicentitylayer"
}

dependencies {
// lib dependencies from rootProject build.gradle.kts
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.activity.compose)
// Jetpack Compose Bill of Materials
implementation(platform(libs.androidx.compose.bom))
// Jetpack Compose dependencies
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.ui.tooling)
implementation(libs.androidx.compose.ui.tooling.preview)
implementation(project(":samples-lib"))
// Toolkit dependencies
implementation(platform(libs.arcgis.maps.kotlin.toolkit.bom))
implementation(libs.arcgis.maps.kotlin.toolkit.geoview.compose)
}
2 changes: 1 addition & 1 deletion add-dynamic-entity-layer/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ class MainActivity : ComponentActivity() {
color = MaterialTheme.colorScheme.background
) {
MainScreen(
sampleName = getString(R.string.app_name),
application = application
sampleName = getString(R.string.app_name)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ fun DynamicEntityLayerProperties(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween
) {

Text(
text = "Previous Observations",
style = SampleTypography.bodyLarge
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.esri.arcgismaps.sample.adddynamicentitylayer.components

import android.app.Application
import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.lifecycle.AndroidViewModel
import com.arcgismaps.mapping.ArcGISMap
Expand All @@ -27,7 +28,6 @@ import com.arcgismaps.realtime.ArcGISStreamService
import com.arcgismaps.realtime.ArcGISStreamServiceFilter
import com.esri.arcgismaps.sample.adddynamicentitylayer.R
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch

class MapViewModel(
Expand All @@ -38,14 +38,11 @@ class MapViewModel(
// set the state of the switches and slider
val trackLineCheckedState = mutableStateOf(false)
val prevObservationCheckedState = mutableStateOf(false)
val trackSliderValue = mutableStateOf(5f)
val trackSliderValue = mutableFloatStateOf(5f)

// flag to show or dismiss the bottom sheet
val isBottomSheetVisible = mutableStateOf(false)

// set the MapView mutable stateflow
val mapViewState = MutableStateFlow(MapViewState())

// create ArcGIS Stream Service
private val streamService =
ArcGISStreamService(application.getString(R.string.stream_service_url))
Expand All @@ -56,6 +53,11 @@ class MapViewModel(
// layer displaying the dynamic entities on the map
private val dynamicEntityLayer: DynamicEntityLayer

// define ArcGIS map using Streets basemap
val map = ArcGISMap(BasemapStyle.ArcGISStreets).apply {
initialViewpoint = Viewpoint(40.559691, -111.869001, 150000.0)
}

/**
* set the data source for the dynamic entity layer.
*/
Expand All @@ -70,7 +72,7 @@ class MapViewModel(
dynamicEntityLayer = DynamicEntityLayer(streamService)

// add the dynamic entity layer to the map's operational layers
mapViewState.value.arcGISMap.operationalLayers.add(dynamicEntityLayer)
map.operationalLayers.add(dynamicEntityLayer)
}

// disconnects the stream service
Expand Down Expand Up @@ -112,9 +114,9 @@ class MapViewModel(

// to set the maximum number of observations displayed per track
fun setObservations(sliderValue: Float) {
trackSliderValue.value = sliderValue
trackSliderValue.floatValue = sliderValue
dynamicEntityLayer.trackDisplayProperties.maximumObservations =
trackSliderValue.value.toInt()
trackSliderValue.floatValue.toInt()
}

// remove all dynamic entity observations from the in-memory data cache as well as from the map
Expand All @@ -125,10 +127,3 @@ class MapViewModel(
}
}

/**
* Data class that represents the MapView state
*/
data class MapViewState(
var arcGISMap: ArcGISMap = ArcGISMap(BasemapStyle.ArcGISStreets),
var viewpoint: Viewpoint = Viewpoint(40.559691, -111.869001, 150000.0)
)
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import com.esri.arcgismaps.sample.adddynamicentitylayer.components.ComposeMapView
import com.arcgismaps.toolkit.geoviewcompose.MapView
import com.esri.arcgismaps.sample.adddynamicentitylayer.components.DynamicEntityLayerProperties
import com.esri.arcgismaps.sample.adddynamicentitylayer.components.MapViewModel
import com.esri.arcgismaps.sample.sampleslib.components.BottomSheet
Expand All @@ -45,9 +46,11 @@ import com.esri.arcgismaps.sample.sampleslib.components.SampleTopAppBar
* Main screen layout for the sample app
*/
@Composable
fun MainScreen(sampleName: String, application: Application) {
fun MainScreen(sampleName: String) {
/// coroutineScope that will be cancelled when this call leaves the composition
val sampleCoroutineScope = rememberCoroutineScope()
// get the application context
val application = LocalContext.current.applicationContext as Application

// create a ViewModel to handle MapView interactions
val mapViewModel = remember { MapViewModel(application, sampleCoroutineScope) }
Expand All @@ -64,11 +67,13 @@ fun MainScreen(sampleName: String, application: Application) {
.padding(it)
) {
// composable function that wraps the MapView
ComposeMapView(
MapView(
modifier = Modifier
.fillMaxSize()
.weight(1f),
mapViewModel = mapViewModel
arcGISMap = mapViewModel.map,
onSingleTapConfirmed = { mapViewModel.dismissBottomSheet() },
onPan = { mapViewModel.dismissBottomSheet() }
)
Row(
modifier = Modifier
Expand Down Expand Up @@ -103,7 +108,7 @@ fun MainScreen(sampleName: String, application: Application) {
onPurgeAllObservations = mapViewModel::purgeAllObservations,
isTrackLineVisible = mapViewModel.trackLineCheckedState.value,
isPrevObservationsVisible = mapViewModel.prevObservationCheckedState.value,
observationsPerTrack = mapViewModel.trackSliderValue.value,
observationsPerTrack = mapViewModel.trackSliderValue.floatValue,
onDismiss = { mapViewModel.dismissBottomSheet() }
)
}
Expand Down
Loading

0 comments on commit 6008ed1

Please sign in to comment.