Merged
Conversation
Refactored the main layout to resolve an issue where extra padding would intermittently appear at the bottom of the screen, particularly on certain OEM Android versions after a configuration change. The root cause was a nested Scaffold and unpredictable automatic window inset handling. The fix includes: - Removing the nested Scaffold structure by eliminating the `MainLayout` composable. - Disabling automatic window inset handling in the primary `Scaffold` in `MainActivity`. - Manually calculating and passing down the required padding to the `AppNavigation` content, ensuring it is aware of the `UnifiedPlayerSheet` and system navigation bar.
…ed Scaffold This commit resolves an issue where extra padding would intermittently appear at the bottom of the screen, particularly on certain OEM Android versions after a configuration change. The root cause was a nested Scaffold within the AppNavigation composable, which caused conflicting and unpredictable window inset calculations. The fix involves: - Removing the MainLayout composable and its nested Scaffold. - Refactoring AppNavigation to accept PaddingValues directly from the parent Scaffold in MainActivity. - Ensuring the PaddingValues are passed down to the screen-level composables that need to pad their content. Additionally, the enableEdgeToEdge() call in MainActivity has been moved before super.onCreate() to align with best practices and ensure consistent edge-to-edge behavior.
This commit resolves a persistent and intermittent issue where extra padding would appear at the bottom of the screen on certain OEM Android versions (e.g., OxygenOS) after a configuration change and resuming the app. The solution includes several layers of fixes: 1. **onResume Workaround:** The primary fix is to re-assert the edge-to-edge window flag when the app resumes. By calling `WindowCompat.setDecorFitsSystemWindows(window, false)` in `MainActivity.onResume()`, we force the OS to correct its state, fixing the bug where the window would fail to draw behind the navigation bar. 2. **Nested Scaffold Removal:** A latent bug was fixed by removing a nested `Scaffold` that existed within `AppNavigation` via `MainLayout`. This simplifies the layout hierarchy and prevents conflicting inset calculations. 3. **Correct Inset Propagation:** The `innerPadding` from the main `Scaffold` is now correctly passed down to the `AppNavigation` composable and its child screens, ensuring content is padded correctly. 4. **Activity Lifecycle Correction:** The `enableEdgeToEdge()` call in `MainActivity` has been moved before `super.onCreate()` to align with best practices.
This commit resolves a persistent and intermittent issue where extra padding would appear at the bottom of the screen on certain OEM Android versions (e.g., OxygenOS) after a configuration change and resuming the app. The solution includes several layers of fixes: 1. **onResume Workaround:** The primary fix is to "jiggle" the window state when the app resumes. By toggling `WindowCompat.setDecorFitsSystemWindows` from true to false in `MainActivity.onResume()`, we force the OS to correct its layout state, fixing the bug where the window would fail to draw behind the navigation bar. 2. **Nested Scaffold Removal:** A latent bug was fixed by removing a nested `Scaffold` that existed within `AppNavigation` via `MainLayout`. This simplifies the layout hierarchy and prevents conflicting inset calculations. 3. **Correct Inset Propagation:** The `innerPadding` from the main `Scaffold` is now correctly passed down to the `AppNavigation` composable and its child screens, ensuring content is padded correctly. 4. **Activity Lifecycle Correction:** The `enableEdgeToEdge()` call in `MainActivity` has been moved before `super.onCreate()` to align with best practices.
This reverts the previous attempts to fix the intermittent padding bug using `onResume` workarounds, as they were found to make the issue worse. This commit leaves the codebase in the most stable and correct state achieved, which includes: - Removal of a nested Scaffold that was a likely source of layout bugs. - Correct propagation of `PaddingValues` from the main `Scaffold` to the navigation content. - Correct placement of the `enableEdgeToEdge()` call in the Activity lifecycle. While this version represents the most correct implementation at the application level, the underlying intermittent padding bug may still occur on certain OEM devices due to a suspected OS-level issue that cannot be reliably fixed from the app's code. This commit cleans up the unsuccessful workarounds.
This commit moves the `BottomNavItem` data class from `presentation.navigation` to `MainActivity.kt`. This change centralizes the definition of this UI-related data structure within the main activity file, which is responsible for the overall application structure and navigation. The import paths for `BottomNavItem` have been updated in: - `PlayerInternalNavigationBar.kt` - `UnifiedPlayerSheet.kt` The `AppNavigation.kt` file no longer requires this import.
This commit updates how URIs are parsed for the "All Files Access" permission request and refactors the screen height calculation.
- The `android.net.Uri.parse("package:$packageName")` has been replaced with `"package:$packageName".toUri()` for requesting all files access permission.
- The screen height calculation now uses `LocalWindowInfo.current.containerSize.height` instead of `LocalConfiguration.current.screenHeightDp.dp.toPx()`.
- The outer `Scaffold` has been commented out, potentially for simplification or as part of a larger UI refactor.
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.
No description provided.