Fix extra padding

This commit is contained in:
NekoInverter 2020-11-22 15:05:35 +08:00
parent cb079df540
commit 351feb4fa9
No known key found for this signature in database
GPG Key ID: 280D6CCCF95715F9
1 changed files with 2 additions and 2 deletions

View File

@ -108,10 +108,10 @@ public class BaseActivity extends AppCompatActivity {
protected void setupWindowInsets(View rootView, View secondView) {
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
ViewCompat.setOnApplyWindowInsetsListener(rootView, (v, insets) -> {
if (secondView != null && insets.getTappableElementInsets().bottom != insets.getSystemWindowInsetBottom()) {
if (secondView != null) {
secondView.setPadding(0, 0, 0, insets.getSystemWindowInsetBottom());
}
rootView.setPadding(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getTappableElementInsets().bottom);
rootView.setPadding(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), secondView == null ? insets.getSystemWindowInsetBottom() : 0);
return insets;
});
}