Skip to content

Commit

Permalink
Migrate "Add Features with Contingent Values" to Compose (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
01smito01 authored Jan 9, 2025
2 parents 8cbfbd4 + bdc5b55 commit bebedac
Show file tree
Hide file tree
Showing 11 changed files with 783 additions and 681 deletions.
6 changes: 4 additions & 2 deletions samples/add-features-with-contingent-values/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ For example, a field crew working in a sensitive habitat area may be required to

## How to use the sample

Tap on the map to add a feature symbolizing a bird's nest. Then choose values describing the nest's status, protection, and buffer size. Notice how different values are available depending on the values of preceding fields. Once the contingent values are validated, tap "Done" to add the feature to the map.
Tap on the map to add a feature symbolizing a bird's nest. Then choose values describing the nest's status, protection, and buffer size. Notice how different values are available depending on the values of preceding fields. Once the contingent values are validated, tap "Apply" to add the feature to the map.

## How it works

Expand All @@ -29,6 +29,7 @@ Tap on the map to add a feature symbolizing a bird's nest. Then choose values de
ii. Get an array of valid `ContingentValues` from `ContingentValuesResult.contingentValuesByFieldGroup` dictionary with the name of the relevant field group.
iii. Iterate through the array of valid contingent values to create an array of `ContingentCodedValue` names or the minimum and maximum values of a `ContingentRangeValue` depending on the type of `ContingentValue` returned.
10. Validate the feature's contingent values by using `validateContingencyConstraints(feature)` with the current feature. If the resulting array is empty, the selected values are valid.
11. Close the geodatabase once operations are complete to ensure temporary files are cleaned up.

## Relevant API

Expand All @@ -48,8 +49,9 @@ The mobile geodatabase contains birds nests in the Fillmore area, defined with c

## Additional information

This sample uses the `geoview-compose` module of the ArcGIS Maps SDK for Kotlin Toolkit to implement a Composable MapView.
Learn more about contingent values and how to utilize them on the [ArcGIS Pro documentation](https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/contingent-values.htm).

## Tags

coded values, contingent values, feature table, geodatabase
coded values, compose, contingent values, feature table, geodatabase, geoview, mapview, toolkit
84 changes: 44 additions & 40 deletions samples/add-features-with-contingent-values/README.metadata.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,46 @@
{
"category": "Edit and Manage Data",
"description": "Create and add features whose attribute values satisfy a predefined set of contingencies.",
"formal_name": "AddFeaturesWithContingentValues",
"ignore": false,
"images": [
"add-features-with-contingent-values.png"
],
"keywords": [
"coded values",
"contingent values",
"feature table",
"geodatabase",
"ArcGISFeatureTable",
"CodedValue",
"CodedValueDomain",
"ContingencyConstraintViolation",
"ContingentCodedValue",
"ContingentRangeValue",
"ContingentValuesDefinition",
"ContingentValuesResult"
],
"language": "kotlin",
"redirect_from": [
"/android/latest/sample-code/add-features-with-contingent-values.htm"
],
"relevant_apis": [
"ArcGISFeatureTable",
"CodedValue",
"CodedValueDomain",
"ContingencyConstraintViolation",
"ContingentCodedValue",
"ContingentRangeValue",
"ContingentValuesDefinition",
"ContingentValuesResult"
],
"snippets": [
"src/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/MainActivity.kt",
"src/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/DownloadActivity.kt"
],
"title": "Add features with contingent values"
"category": "Edit and Manage Data",
"description": "Create and add features whose attribute values satisfy a predefined set of contingencies.",
"formal_name": "AddFeaturesWithContingentValues",
"ignore": false,
"images": [
"add-features-with-contingent-values.png"
],
"keywords": [
"coded values",
"compose",
"contingent values",
"feature table",
"geodatabase",
"geoview",
"mapview",
"toolkit",
"ArcGISFeatureTable",
"CodedValue",
"CodedValueDomain",
"ContingencyConstraintViolation",
"ContingentCodedValue",
"ContingentRangeValue",
"ContingentValuesDefinition",
"ContingentValuesResult"
],
"language": "kotlin",
"redirect_from": [],
"relevant_apis": [
"ArcGISFeatureTable",
"CodedValue",
"CodedValueDomain",
"ContingencyConstraintViolation",
"ContingentCodedValue",
"ContingentRangeValue",
"ContingentValuesDefinition",
"ContingentValuesResult"
],
"snippets": [
"src/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/AddFeaturesWithContingentValuesViewModel.kt",
"src/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/DownloadActivity.kt",
"src/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/MainActivity.kt",
"src/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/screens/AddFeaturesWithContingentValuesScreen.kt"
],
"title": "Add features with contingent values"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
alias(libs.plugins.arcgismaps.android.library)
alias(libs.plugins.arcgismaps.android.library.compose)
alias(libs.plugins.arcgismaps.kotlin.sample)
alias(libs.plugins.gradle.secrets)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
android:name=".DownloadActivity"
android:exported="true"
android:label="@string/add_features_with_contingent_values_app_name">


<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".MainActivity"
Expand Down
Loading

0 comments on commit bebedac

Please sign in to comment.