-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate "Add Features with Contingent Values" to Compose #283
base: v.next
Are you sure you want to change the base?
Conversation
e5f1361
to
88b1bf9
Compare
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, contingent values, feature table, geodatabase, geoviewcompose, toolkit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coded values, contingent values, feature table, geodatabase, geoviewcompose, toolkit | |
coded values, contingent values, feature table, geodatabase, geoview, mapview, compose, toolkit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
geoviewcompose
and toolkit
are the tags the epic recommends to add. I don't think they need to be changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find geoviewcompose
odd as a tag but maybe there is a good reason for it. \cc @shubham7109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gunt0001 The tag here was meant to match the geoviewcompose Toolkit package name. I see it as little odd too, and I recall tags must use lowercase. Alternatively, a valid option could be to use geoview-compose
to match the Toolkit module name instead. (Quick test looks like the PR checker would be happy.)
\cc @TADraeseke Thoughts?
...c/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/screens/MainScreen.kt
Outdated
Show resolved
Hide resolved
...c/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/screens/MainScreen.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
...c/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/screens/MainScreen.kt
Outdated
Show resolved
Hide resolved
...c/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/screens/MainScreen.kt
Show resolved
Hide resolved
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, contingent values, feature table, geodatabase, geoviewcompose, toolkit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find geoviewcompose
odd as a tag but maybe there is a good reason for it. \cc @shubham7109
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
feature?.geometry = mapPoint | ||
|
||
// create the graphic of the feature | ||
val graphic = feature?.let { createGraphic(it) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the buffer graphic?
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@01smito01 - a few more comments.
Note, after I added a new feature, then rotate the screen, the buffer graphic for the added feature disappears, I only see the black dot. Is this expected?
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
// add the feature to the feature table | ||
viewModelScope.launch { | ||
feature?.let { featureTable!!.addFeature(it) } | ||
feature?.load()?.getOrElse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically there is no need to load the feature explicitly, it will be loaded automatically when rendered in the MapView. Is this more for debugging purposes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The add-then-load logic was copied over from the old version of the sample. Probably was for some debugging purpose - getOrElse
makes a lot less sense to use than onFailure
. Have removed it at any rate.
*/ | ||
fun clearFeature() { | ||
feature = null | ||
_featureEditState.value = FeatureEditState(statusAttributes = featureTable!!.statusFieldCodedValues()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid !!
. Couldldn't you just use default parameters here?
_featureEditState.value = FeatureEditState(statusAttributes = featureTable!!.statusFieldCodedValues()) | |
_featureEditState.value = FeatureEditState() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default parameters include an empty statusAttributes
list, which is populated during init (after the contingentValuesDefinition
is loaded from the feature table). So none of the UI elements would have any options available.
How about featureTable?.let{ ... } ?: return messageDialogVM.showMessage("Feature table not loaded")
?
Could alternatively create a method to reload the statusAttributes
, called in the mapView's onSingleTapConfirmed
.
mapViewModel.clearFeature() | ||
} | ||
) { | ||
val onBottomSheetStateChanged = { state: SheetState -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a need for this local variable? This may actually have to be remembered. Alternatively, pass it inline to BottomSheetContents
:
BottomSheetContents(
...
onBottomSheetStateChange = { state: SheetState ->
if (!state.isVisible) {
showBottomSheet = false
mapViewModel.clearFeature()
}
},
...
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't need to be local rather than inline - I had it that way for clarity. Will change if you think that's better.
No strict need to remember
it, as it's not getting assigned a new value anywhere else. Could remember it for performance, but I don't think it's complex enough to make any appreciable difference.
...c/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/screens/MainScreen.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@01smito01 - looks great, one minor comment 👍
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
Thanks @gunt0001. @shubham7109 can you give this a second review? This is a fairly involved sample. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed the Kotlin code files, didn't get through with the readme changes yet.
Hope @01smito01 you find these comments helpful, feel free to reach out if you would like me to chat about them more in detail. Sample looks and works great, my main goal is to help improve readability and reduce any complexity in the app.
Feel free to use these review notes to help you with this PR: oliver/contingent_values_migration...shubham/contingent-review
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt
Outdated
Show resolved
Hide resolved
...c/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/screens/MainScreen.kt
Outdated
Show resolved
Hide resolved
...c/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/screens/MainScreen.kt
Outdated
Show resolved
Hide resolved
...c/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/screens/MainScreen.kt
Show resolved
Hide resolved
samples/add-features-with-contingent-values/src/main/res/values/strings.xml
Outdated
Show resolved
Hide resolved
samples/add-features-with-contingent-values/src/main/res/values/strings.xml
Outdated
Show resolved
Hide resolved
@01smito01 I also noticed that |
Thanks for the review @shubham7109 - have implemented most of your changes, so let me know what you think. |
Description
Migrates Add Features with Contingent Values sample from XML/views to 💫 Compose 💫
Links and Data
Sample Epic: #4961
What To Review
mutableStateOf
's in the view model)How to Test
Run the sample on the sample viewer.