IPC 746 implement MainScreen composable and refactor MainAc… #846
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.
I re-implemented the
MainActivity
of the Health SDK using Jetpack Compose. This was part of applying the new concepts and techniques I learned during my Compose course.Instead of relying on XML layouts and ViewBinding, I moved the entire UI into a
MainScreen()
composable. This allowed me to:ConstraintLayout
andViewPager2
with Compose layouts and the new HorizontalPager API.rememberLauncherForActivityResult
to handle camera capture and document import in a declarative way.Flow
state directly in Compose usingcollectAsState
, so the UI automatically updates when the ViewModel state changes.TabLayoutMediator
.Through this exercise, I could demonstrate what I learned in the course: writing modern, declarative UI, managing lifecycle safely with Compose, and reducing boilerplate compared to XML + imperative View setup.
It was also a chance to share with the team how our existing SDK examples can be updated to Compose-first architecture, which makes the codebase cleaner, more maintainable, and aligned with current Android best practices.