Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed49a718 authored by Brian Isganitis's avatar Brian Isganitis
Browse files

Pad bottom of settings list view with bottom system insets

This change allows for a transparent navigation bar in the settings Material next redesign.

Test: Bottom of settings not cut off by bottom navigation bar
Bug: 187732263
Change-Id: I237011003ca0c3760c0fbdbb2865ef90c19d7b81
parent 3ed65ede
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -18,7 +18,8 @@
    android:id="@+id/content_parent"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    android:orientation="vertical"
    android:fitsSystemWindows="true">

    <Toolbar
        android:id="@+id/action_bar"
+11 −0
Original line number Diff line number Diff line
@@ -152,6 +152,17 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat {
                filterPreferences(query, mPreferenceScreen);
            }
        });

        View listView = getListView();
        final int bottomPadding = listView.getPaddingBottom();
        listView.setOnApplyWindowInsetsListener((v, insets) -> {
            v.setPadding(
                    v.getPaddingLeft(),
                    v.getPaddingTop(),
                    v.getPaddingRight(),
                    bottomPadding + insets.getSystemWindowInsetBottom());
            return insets.consumeSystemWindowInsets();
        });
    }

    @Override
+18 −0
Original line number Diff line number Diff line
@@ -24,9 +24,11 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
import androidx.core.view.WindowCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
@@ -82,6 +84,7 @@ public class SettingsActivity extends FragmentActivity
        super.onCreate(savedInstanceState);
        setContentView(R.layout.settings_activity);
        setActionBar(findViewById(R.id.action_bar));
        WindowCompat.setDecorFitsSystemWindows(getWindow(), false);

        if (savedInstanceState == null) {
            Intent intent = getIntent();
@@ -198,6 +201,21 @@ public class SettingsActivity extends FragmentActivity
            }
        }

        @Override
        public void onViewCreated(View view, Bundle savedInstanceState) {
            super.onViewCreated(view, savedInstanceState);
            View listView = getListView();
            final int bottomPadding = listView.getPaddingBottom();
            listView.setOnApplyWindowInsetsListener((v, insets) -> {
                v.setPadding(
                        v.getPaddingLeft(),
                        v.getPaddingTop(),
                        v.getPaddingRight(),
                        bottomPadding + insets.getSystemWindowInsetBottom());
                return insets.consumeSystemWindowInsets();
            });
        }

        @Override
        public void onSaveInstanceState(Bundle outState) {
            super.onSaveInstanceState(outState);