Skip to content

Commit

Permalink
Set inset margin for the activity preferences to not overlap when on …
Browse files Browse the repository at this point in the history
…edge to edge mode
  • Loading branch information
mendhak committed Nov 26, 2024
1 parent cd178ac commit 30cc6f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected void onCreate(Bundle savedInstanceState) {
Systems.setLocale(PreferenceHelper.getInstance().getUserSpecifiedLocale(),getBaseContext(),getResources());
setContentView(R.layout.activity_preferences);

ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.toolbar), (v, windowInsets) -> {
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.preference_activity_layout), (v, windowInsets) -> {
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.displayCutout());

// Apply the insets as a margin to the view so it doesn't overlap with status bar
Expand All @@ -67,7 +67,7 @@ protected void onCreate(Bundle savedInstanceState) {

// Return CONSUMED if you don't want want the window insets to keep passing
// down to descendant views.
return WindowInsetsCompat.CONSUMED;
return windowInsets;
});

Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
Expand Down
1 change: 1 addition & 0 deletions gpslogger/src/main/res/layout/activity_preferences.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/preference_activity_layout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
Expand Down

0 comments on commit 30cc6f8

Please sign in to comment.