Skip to content
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

Use job color in geometry tasks and refactor feature renderers #1951

Merged
merged 34 commits into from
Oct 4, 2023

Conversation

gino-m
Copy link
Collaborator

@gino-m gino-m commented Oct 2, 2023

…o gino-m/1910/marker-render-refactor

# Conflicts:
#	ground/src/main/java/com/google/android/ground/ui/IconFactory.kt
#	ground/src/main/java/com/google/android/ground/ui/map/gms/FeatureClusterRenderer.kt
#	ground/src/main/java/com/google/android/ground/ui/map/gms/GoogleMapsFragment.kt
#	ground/src/main/res/drawable/cluster_marker.xml
…o gino-m/1907/refactor-feature-renders

# Conflicts:
#	ground/src/main/java/com/google/android/ground/persistence/remote/firebase/schema/LoiCollectionReference.kt
#	ground/src/main/java/com/google/android/ground/ui/datacollection/tasks/location/CaptureLocationTaskViewModel.kt
#	ground/src/main/java/com/google/android/ground/ui/datacollection/tasks/point/DropAPinTaskViewModel.kt
#	ground/src/main/java/com/google/android/ground/ui/map/gms/FeatureClusterRenderer.kt
#	ground/src/main/java/com/google/android/ground/ui/map/gms/GoogleMapsFragment.kt
@gino-m gino-m marked this pull request as ready for review October 2, 2023 17:59
@gino-m gino-m changed the title Refactor feature renderers and related logic Use job color in geometry tasks and refactor feature renderers Oct 2, 2023
@@ -55,6 +65,8 @@ constructor(resources: Resources, private val uuidGenerator: OfflineUuidGenerato
id = uuidGenerator.generateUuid(),
type = FeatureType.USER_POINT.ordinal,
geometry = point,
// TODO: Set correct pin color.
style = Feature.Style(pinColor),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is the only usage, should we consider inlining the code? Then we'd have to set the job to a class var in the super class. Thoughts?

style = Feature.Style(job.getDefaultColor())

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The superclass is scoped more widely that geometry tasks, and each geometry task may require slightly different styling treatments. Also, I'd prefer to avoid too much indirection to keep things locally comprehensible.

Sorry I missed this TODO, removing it.

Comment on lines +180 to +182
loiRepository.getLocationsOfInterest(survey).map {
it.map { loi -> loi.toFeature() }.toPersistentSet()
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can we get rid of the nesting by using flatMap?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flatMap pulls the elements of a list or flow up a level. That would change the output to Flow<Feature>, which is not what we want here; we want a full snapshot of all the displayed features on each emission.

Comment on lines +189 to +190
submissionCount + submissionRepository.getPendingCreateCount(id) -
submissionRepository.getPendingDeleteCount(id) > 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move these to separate lines for better readability?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, coming right up

@gino-m
Copy link
Collaborator Author

gino-m commented Oct 3, 2023

@shobhitagarwal1612 PTAL?

@gino-m gino-m merged commit 0f825c2 into master Oct 4, 2023
4 checks passed
@gino-m gino-m deleted the gino-m/1907/refactor-feature-renderers branch October 4, 2023 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Job color not used by geometry collection tasks Refactor Maps *Manager and *Renderer classes
2 participants