Skip to content

Conversation

@LordRaydenMK
Copy link
Owner

This commit removes the Fragment-based navigation and replaces it with a pure Compose navigation solution using navigation3.

Key changes:

  • Deleted MovieDetailsFragment, MoviesFragment, and their associated XML layouts.
  • Updated MainActivity to use NavDisplay from navigation3 for screen management.
  • Introduced MoviesNavScreen and MovieDetailsNavScreen composables to handle navigation logic and state.
  • Replaced AndroidX Navigation dependencies with navigation3.
  • Removed collectAsStateWithLifecycle in favor of passing state directly to screen composables.

This commit removes the Fragment-based navigation and replaces it with a pure Compose navigation solution using `navigation3`.

Key changes:
*   Deleted `MovieDetailsFragment`, `MoviesFragment`, and their associated XML layouts.
*   Updated `MainActivity` to use `NavDisplay` from `navigation3` for screen management.
*   Introduced `MoviesNavScreen` and `MovieDetailsNavScreen` composables to handle navigation logic and state.
*   Replaced AndroidX Navigation dependencies with `navigation3`.
*   Removed `collectAsStateWithLifecycle` in favor of passing state directly to screen composables.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the application from Fragment-based navigation with AndroidX Navigation to pure Compose navigation using the navigation3 library. The change simplifies the architecture by removing XML layouts and Fragment boilerplate in favor of declarative Compose code.

Key changes:

  • Removed Fragment classes (MoviesFragment, MovieDetailsFragment) and XML layouts
  • Introduced new navigation composables (MoviesNavScreen, MovieDetailsNavScreen) that manage lifecycle and state
  • Updated screen composables to accept state directly instead of collecting from flows

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
PopularMoviesScreenTest.kt Updated test calls to pass state directly instead of flow and initial value
MovieDetailsScreenTest.kt Updated test calls to pass state directly and fixed URL protocol
nav_graph.xml Deleted XML navigation graph
fragment_compose.xml Deleted Fragment layout file
activity_main.xml Deleted Activity layout with FragmentContainerView
MoviesScreen.kt Refactored to accept state parameter instead of collecting from flow
MoviesNavScreen.kt New composable managing navigation, lifecycle, andViewModel integration for movies list
MoviesFragment.kt Deleted Fragment implementation
MovieDetailsScreen.kt Refactored to accept state parameter instead of collecting from flow
MovieDetailsNavScreen.kt New composable managing navigation, lifecycle, and ViewModel integration for movie details
MovieDetailsFragment.kt Deleted Fragment implementation
Screen.kt New sealed class defining navigation destinations
MainActivity.kt Refactored to use Compose setContent with NavDisplay instead of Fragment container
build.gradle Updated dependencies to replace AndroidX Navigation with navigation3 library

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The `ModuleOwner` interface, which was used to decouple fragments from the `Application` class, has been removed. The `App` class now directly exposes the `appModule`. The `appModule()` extension function has been updated to cast the `applicationContext` to `App` instead of `ModuleOwner`.
This commit extracts the main navigation logic from `MainActivity` into a new `MoviesApplication` composable.

Key changes:
-   A new `MoviesApplication.kt` file is created to house the `NavDisplay` and its configuration.
-   `MainActivity` is simplified to just call `MoviesApplication`.
-   The `observeIn` extension function is removed in favor of `flowWithLifecycle`.
-   Modules (`TheMovieDbModule`, `MovieDetailsModule`) now own the `actions` `Channel`, removing redundant `remember` calls in the UI.
-   Dependencies like `AppModule` and `BackStack` are now passed explicitly to screen composables (`MoviesNavScreen`, `MovieDetailsNavScreen`).
-   Introduced a `BackStack` typealias for `SnapshotStateList<Screen>`.
The `Screen` sealed class now implements the `NavKey` interface from the navigation library and is marked as `@Serializable`. This change removes the manual `remember { mutableStateListOf<Screen>(PopularMovies) }` in favor of a new `rememberNavBackStack` composable function, which utilizes `rememberSerializable` with a `NavBackStackSerializer` for better state restoration.
@LordRaydenMK LordRaydenMK enabled auto-merge (squash) December 20, 2025 11:49
@LordRaydenMK LordRaydenMK merged commit 80745ec into main Dec 20, 2025
2 checks passed
@LordRaydenMK LordRaydenMK deleted the Goodbye-Fragments branch December 20, 2025 11:51
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.

2 participants