mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 16:26:47 +00:00
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
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user