refactor: set controller pattern to navigation#460
Open
tvillega wants to merge 17 commits intoeddyizm:developmentfrom
Open
refactor: set controller pattern to navigation#460tvillega wants to merge 17 commits intoeddyizm:developmentfrom
tvillega wants to merge 17 commits intoeddyizm:developmentfrom
Conversation
In order to add a toolbar with a back button in settings I needed to extend from a fragment so I converted SettingsFragment into a fragment and created SettingsContainerFragment, the latter is injected as a child of SettingsFragment inside a FrameLayout. Since SettingsContainerFragment extends from PreferenceFragmentCompat, this allows to swap it for other and, in the bigger picture, allow an arbitrary organization.
This reverts commit eeb1255.
This reverts commit 34d354d.
This reverts commit 52cfd36.
Hide bottom navigation bar on portrait and unlock drawer on portrait
…attern-to-navigation
This was referenced Feb 25, 2026
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.
MainActivity is heavily populated by two kind of methods: navigation and player sheet. When other fragments try to modify something in them (like settings hiding navigation and the player) they need to instantiate the entire activity.
The app is one activity with a swappable fragment, that means that MainActivity needs to be instantiated everywhere to modify the navigation. Kotlin discourages this practice and, despite Java not complaining, it is starting to bring problems on the navigation (see #450 (comment)) that can only be fixed with unmaintainable patches.
This PR uses the Controller Pattern to extract the navigation logic into its own class. This way MainActivity setups the navigation and the fragment can extract the controller and only the controller instead of bringing the entire activity. The navigation stays in sync throughout the app and we don't mess with the life cycle of the UI.
This PR depends on #450, making it more maintainable.