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

Factor out job cards into Composables for new data entry points #2892

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

sufyanAbbasi
Copy link
Contributor

@sufyanAbbasi sufyanAbbasi commented Dec 2, 2024

Fixes #2446

Reimplements the entire add LOI/selection UX to match the new designs (see above issue).

  • Removes the old RecycleView and Cards UI and rebuilds them using Composables instead.
  • Handles multiple ad-hoc jobs by showing each job in a modal and does not show the modal if there is only one ad-hoc job.
  • Also does not show the "+" button or the "add data" button when the user is viewer only.
  • TODO: Get translations for add_data and add_site.
Screenshot 2024-12-19 at 1 24 37 AM Screenshot 2024-12-19 at 1 24 52 AM Screenshot 2024-12-19 at 1 25 11 AM Screenshot 2024-12-19 at 1 33 33 AM

@gino-m PTAL?

@sufyanAbbasi sufyanAbbasi requested a review from gino-m December 2, 2024 20:51
@gino-m gino-m changed the title [Draft - Needs Styling] Implements new, simplified LOI flow [Draft - Needs Styling] Introduce new data collection entry points Dec 4, 2024
Copy link
Collaborator

@gino-m gino-m left a comment

Choose a reason for hiding this comment

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

Hey @sufyanAbbasi so cool to see this is working! A few suggestions/tweaks. Once we do those, I think we can submit as is without too much UI churn for now. @rawbzz Is still finalizing the latest designs, but what you have here takes us much closer.

# Conflicts:
#	ground/src/main/java/com/google/android/ground/ui/home/mapcontainer/HomeScreenMapContainerFragment.kt
@sufyanAbbasi sufyanAbbasi changed the title [Draft - Needs Styling] Introduce new data collection entry points Factor our job cards into Composables for new data entry points Dec 19, 2024
@sufyanAbbasi sufyanAbbasi marked this pull request as ready for review December 19, 2024 09:47
@auto-assign auto-assign bot requested a review from gino-m December 19, 2024 09:47
@sufyanAbbasi sufyanAbbasi changed the title Factor our job cards into Composables for new data entry points Factor out job cards into Composables for new data entry points Dec 19, 2024
Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 23.07692% with 210 lines in your changes missing coverage. Please review.

Project coverage is 62.41%. Comparing base (a0975c3) to head (c4be97e).

Files with missing lines Patch % Lines
.../ground/ui/home/mapcontainer/jobs/JobMapAdapter.kt 20.67% 175 Missing and 13 partials ⚠️
...ome/mapcontainer/HomeScreenMapContainerFragment.kt 21.05% 10 Missing and 5 partials ⚠️
...me/mapcontainer/HomeScreenMapContainerViewModel.kt 50.00% 3 Missing and 4 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2892      +/-   ##
============================================
- Coverage     63.55%   62.41%   -1.14%     
- Complexity     1267     1283      +16     
============================================
  Files           270      271       +1     
  Lines          6560     6769     +209     
  Branches        927      950      +23     
============================================
+ Hits           4169     4225      +56     
- Misses         1786     1921     +135     
- Partials        605      623      +18     
Files with missing lines Coverage Δ
.../mapcontainer/jobs/DataCollectionEntryPointData.kt 100.00% <100.00%> (ø)
...n/java/com/google/android/ground/ui/theme/Color.kt 100.00% <100.00%> (ø)
...me/mapcontainer/HomeScreenMapContainerViewModel.kt 51.94% <50.00%> (+6.11%) ⬆️
...ome/mapcontainer/HomeScreenMapContainerFragment.kt 15.60% <21.05%> (-1.07%) ⬇️
.../ground/ui/home/mapcontainer/jobs/JobMapAdapter.kt 20.67% <20.67%> (ø)

... and 2 files with indirect coverage changes

Copy link
Collaborator

@gino-m gino-m left a comment

Choose a reason for hiding this comment

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

Great work, @sufyanAbbasi 🥳 A few nits, otherwise LGTM!

sufyanAbbasi and others added 11 commits December 19, 2024 12:03
Added "add_site" and two more strings (untranslated)
Added "add_site" and two more strings (untranslated)
Remaining translations added ("unnamed_job" and "job_site_icon").
Remaining translations added ("unnamed_job" and "job_site_icon").
Remaining translations added ("unnamed_job" and "job_site_icon").
@gino-m
Copy link
Collaborator

gino-m commented Dec 20, 2024

Codecov Report

Attention: Patch coverage is 20.43796% with 218 lines in your changes missing coverage. Please review.

Project coverage is 61.23%. Comparing base (543795e) to head (55393d8).

Files with missing lines Patch % Lines
.../ground/ui/home/mapcontainer/jobs/JobMapAdapter.kt 20.58% 176 Missing and 13 partials ⚠️
...ome/mapcontainer/HomeScreenMapContainerFragment.kt 26.31% 9 Missing and 5 partials ⚠️
...me/mapcontainer/HomeScreenMapContainerViewModel.kt 7.14% 13 Missing ⚠️
...roid/ground/ui/home/mapcontainer/jobs/MapUiData.kt 0.00% 2 Missing ⚠️
Additional details and impacted files

Would you be able to add tests for modified lines? We can focus on the ones reported here by codecov if it helps.

@gino-m
Copy link
Collaborator

gino-m commented Jan 26, 2025

@sufyanAbbasi RFAL?

@sufyanAbbasi
Copy link
Contributor Author

Sorry I had to take a little time to merge in the ground --> app file change and added a test file to cover the core view model logic. I think we're good to go!

@gino-m
Copy link
Collaborator

gino-m commented Jan 27, 2025

Hi @shobhitagarwal1612! PTAL?

@@ -13,15 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.ground.ui.home.mapcontainer.cards

package com.google.android.ground.ui.home.mapcontainer.jobs

import com.google.android.ground.model.job.Job
import com.google.android.ground.model.locationofinterest.LocationOfInterest

/** Data classes used to populate the Map cards (either an Loi card, or a Suggest Loi card). */
Copy link
Member

Choose a reason for hiding this comment

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

Please update the ktdoc

Comment on lines +197 to +199
if (loiCard == null && feature != null) {
// The feature is not in view anymore.
featureClicked.value = null
Copy link
Member

Choose a reason for hiding this comment

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

It feels like the resetting logic should live somewhere else. This method should only return the data and shouldn't do anything other than that.

Comment on lines +205 to +207
basemapLayoutBinding.mapTypeBtn.show()
basemapLayoutBinding.locationLockBtn.show()
menuBinding.hamburgerBtn.show()
Copy link
Member

Choose a reason for hiding this comment

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

In order to make these class pure composable objects and remove coupling from existing layout elements, can we instead expose states which can then be handled in the caller class (HomescreenMapContainerFragment)?

Something like onDismissed or anything else

app/src/main/res/drawable/ic_ring_marker.xml Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Data collection] Simplify data collection entry point
4 participants