Repository navigation
Conversation
…emUiModel and mapper Introduce PlaceItemUiModel and a dedicated mapper (toUiModel) in both Java and Kotlin CurrentPlaceDetailsOnMap tutorials. - Remove the legacy four parallel arrays (likelyPlaceNames, likelyPlaceAddresses, likelyPlaceAttributions, likelyPlaceLatLngs) and their Activity instance fields. - Decouple the Places API data model from the UI layer: the selection dialog and map markers now consume a dumb, display-ready PlaceItemUiModel. - Centralize default value fallbacks, null-coalescing, and string formatting (including third-party attributions) in the mapper. - Add literate programming commentary explaining the architectural decoupling and mapper design. - Wrap UI model and mapper in a new region tag: maps_current_place_ui_model.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactors the
CurrentPlaceDetailsOnMaptutorials (both Java and Kotlin) to decouple the external Places API data model from the UI layer:likelyPlaceNames,likelyPlaceAddresses,likelyPlaceAttributions, andlikelyPlaceLatLngsalong with their mutableActivityinstance fields.PlaceItemUiModel: Simple presentation model holding pre-formatted, display-ready strings and coordinates (title,snippet,position).toUiModel()Mapper: Encapsulates data normalization, fallback defaults (such as fallback titles), and string formatting (including third-party attributions) in a dedicated mapper, preventing business and formatting logic from leaking into UI components.PlaceItemUiModelwithout thread-side concatenation, raw types, or null checks.maps_current_place_ui_modelto allow seamless integration into the developer tutorial documentation.Testing
:tutorials:java:CurrentPlaceDetailsOnMap:assembleDebugpassed:tutorials:kotlin:CurrentPlaceDetailsOnMap:assembleDebugpassedspotlessCheckpassed