-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: implement planet selection screen #298
Conversation
- Implement PlanetRenderer to render planets in the Planet Selection Screen. - Add support for updating planet textures and applying transformation matrices. - Integrate with Camera for view rendering and scaling adjustments.
- Implement PlanetSurfaceView to integrate PlanetRenderer with AndroidView in Jetpack Compose. - Enable seamless rendering of planets in the Planet Selection Screen. - Add functionality to update the displayed planet dynamically.
- Introduce `iconRes` field in the PlanetData class to reference planet icons for the Planet Selection Screen. - Enhance UI by enabling planet-specific button visuals in the horizontal selection row.
- Implement PlanetSelectionRow to display a horizontally scrollable row of planet buttons. - Each button represents a planet and allows users to select a planet. - Enables intuitive planet selection functionality in the PlanetSelectionScreen.
- Implement PlanetButton composable to represent a clickable button for each planet. - Displays the planet's icon and handles user interactions for planet selection. - Enhances usability and visual appeal in the PlanetSelectionRow composable.
…ng planets - Implement PlanetSelectionScreen composable to display a list of planets and render the selected planet. - Integrate a horizontally scrollable PlanetSelectionRow for selecting planets. - Display the selected planet's name and a 3D rendered view using OpenGL. - Improve navigation by adding a back button to return to the menu screen.
- Implement PlanetSelectionViewModel to handle the list of planets and the selected planet state. - Provide functionality to update the selected planet. - Expose planets and selectedPlanet as observable state for use in the PlanetSelectionScreen. - Add a factory method for creating the ViewModel with necessary dependencies.
- Add `updateTexture` method to allow dynamic texture updates for planets. - Modify `draw` method to support custom transformation matrices for flexible rendering. - Improve adaptability of the Planet class for dynamic use cases such as planet selection screens.
|
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.
Great work on this PR! It is a really good addition to the app! I think it provides a perfectly intuitive interface for users to view planets in 3D and brings another interactive element to the application which is really cool. I tested the functionality, and everything works as expected. The horizontal scrolling row of planet buttons is seamless, and the back navigation is really smooth! It would have been ideal to have more tests but I completely understand that it's hard to mock the PlanetsRepository
and to create a usable PlanetSelectionViewModel
. Revisiting this in a future PR if we have time sounds like a good plan. I also wanted to point out how cleanly the new components are implemented, they make the codebase more modular and reusable. Good job:)
This pull request introduces the Planet Selection Screen to the application, providing users with an intuitive interface to browse and select planets for viewing in 3D.
Planet Selection Screen:
New Components:
PlanetButton
: A reusable composable button that displays a planet's icon and handles user interaction.PlanetSelectionRow
: A composable that arranges the planet buttons in a horizontal scrolling row.3D Planet Rendering:
PlanetSurfaceView
to render the selected planet in 3D using OpenGL.Navigation:
Planet Data Enhancements:
PlanetData
model to include an iconRes property for associating drawable resources with each planet.ViewModel:
PlanetSelectionViewModel
to manage the list of planets and track the currently selected planet using StateFlow.Rendering:
PlanetRenderer
to support dynamic updates for rendering planets in the selection screen.Note on Testing PlanetSelectionScreen:
Testing the
PlanetSelectionScreen
composable proved to be particularly challenging due to its dependency on thePlanetSelectionViewModel
, which relies on thePlanetsRepository
. Mocking thePlanetsRepository
to create a mockPlanetSelectionViewModel
for testing the composable's behavior requires has been proven to be really complex (I have spent hours on it in vain).That said, I have written tests for all the new classes introduced in this PR. If I have time before the deadline, I plan to revisit testing the
PlanetSelectionScreen
in a future PR.These missing tests have been implemented in PR #305