Refactor: Apply insets and update app theme#1347
Merged
Merged
Conversation
This commit refactors the application to handle window insets correctly, ensuring that the UI does not overlap with system bars. It also updates the application theme to remove the action bar. - `styles.xml`: Changed the parent theme of `AppTheme` to `Theme.MaterialComponents.DayNight.NoActionBar` to remove the default action bar. - `MainActivity.kt` (library): Added `applyInsets()` to handle system window insets, ensuring content is displayed properly around system bars. Added call to `applyInsets()` in `onCreate` - `TransactionActivity.kt`: Added `applyInsets()` to handle system window insets, ensuring content is displayed properly around system bars. Added call to `applyInsets()` in `onCreate` - `activity_main_sample.xml`: Added `AppBarLayout` and `MaterialToolbar` for a custom toolbar implementation. - `chucker_activity_transaction.xml`: Added id to `appBarLayout` - `MainActivity.kt` (sample): Added `applyInsets()` to handle system window insets, ensuring content is displayed properly around system bars. Added call to `applyInsets()` in `onCreate` - Added toolbar subtitle for sample and library `MainActivity`
This commit refactors the main layout files in both the library and sample modules by: - Removing `app:popupTheme` from `AppBarLayout` in `chucker_activity_main.xml`. - Moving `app:popupTheme` to `Toolbar` inside the sample's `activity_main_sample.xml`. - Adding missing margins to improve the UI layout consistency of `activity_main_sample.xml`. - Reordering views in the `activity_main_sample.xml`. - Adding layout horizontal margins to UI components in the `activity_main_sample.xml` such as: `description`, `interceptor_type_label`, `interceptor_type_group`, `do_http`, `do_graphql`, `launch_chucker_directly`, `export_to_file`, and `export_to_file_har`. - Adding a bottom margin to the `description` view in `activity_main_sample.xml`.
The `app:popupTheme` attribute was removed from the `Toolbar` in `activity_main_sample.xml`. This change aligns the toolbar's popup theme with the application's default theme, removing a redundant setting. Based on research `content_main.xml` is used to display content, and `activity_main.xml` is used for main UI elements such as the `coordinatorLayout`. In this case, `activity_main_sample.xml` contains a `Toolbar`.
This commit applies the `Chucker.BaseTheme` style to the popup theme of the main activity's toolbar. This change ensures a consistent appearance for popups within the Chucker UI.
cortinico
reviewed
Mar 6, 2025
| android:id="@+id/interceptor_type_group" | ||
| android:layout_width="0dp" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginHorizontal="16dp" |
Member
There was a problem hiding this comment.
can we use a resource here rather than hardcoding 16dp?
This commit updates the horizontal margin values in the `activity_main_sample.xml` layout file to use `@dimen/doub_grid_size` instead of hardcoded `16dp`. This change makes the layout more consistent and maintainable. Additionally, it sets the bottom margin for export buttons.
cortinico
approved these changes
Mar 7, 2025
| android:id="@+id/toolbar" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="match_parent" | ||
| android:paddingBottom="4dp" |
Member
There was a problem hiding this comment.
also here please reference one of the resource
…droid 15 This commit addresses an issue where list and scrollable data were obscured by the bottom navigation bar on Android 15. The fix ensures that the content now scrolls to above the bottom navigation bar. The issue was resolved by updating the toolbar padding to use a defined dimension.
cortinico
approved these changes
Mar 9, 2025
|
I also noticed the issue recently. This is really great that it's already fixed. Thanks @iamarjun 🙌 @cortinico do we know when will this fix be available? |
Member
Hopefully in the upcoming weeks |
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.
This commit refactors the application to handle window insets correctly, ensuring that the UI does not overlap with system bars. It also updates the application theme to remove the action bar. Addresses issue
styles.xml: Changed the parent theme ofAppThemetoTheme.MaterialComponents.DayNight.NoActionBarto remove the default action bar.MainActivity.kt(library): AddedapplyInsets()to handle system window insets, ensuring content is displayed properly around system bars. Added call toapplyInsets()inonCreateTransactionActivity.kt: AddedapplyInsets()to handle system window insets, ensuring content is displayed properly around system bars. Added call toapplyInsets()inonCreateactivity_main_sample.xml: AddedAppBarLayoutandMaterialToolbarfor a custom toolbar implementation.chucker_activity_transaction.xml: Added id toappBarLayoutMainActivity.kt(sample): AddedapplyInsets()to handle system window insets, ensuring content is displayed properly around system bars. Added call toapplyInsets()inonCreateMainActivity📷 Screenshots
📄 Context
📝 Changes
📎 Related PR
🚫 Breaking
🛠️ How to test
⏱️ Next steps