Skip to content

Commit 4acd570

Browse files
imhappipekingme
authored andcommitted
[Catalog] Fix to edge to edge behaviour for catalog
PiperOrigin-RevId: 637973580
1 parent 801ccab commit 4acd570

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

catalog/java/io/material/catalog/windowpreferences/WindowPreferencesManager.java

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import android.content.Context;
2020
import android.content.SharedPreferences;
21-
import android.content.res.Configuration;
2221
import android.os.Build.VERSION;
2322
import android.os.Build.VERSION_CODES;
2423
import android.view.Window;
@@ -40,23 +39,14 @@ public WindowPreferencesManager(Context context) {
4039
this.context = context;
4140
this.listener =
4241
(v, insets) -> {
43-
if (v.getResources().getConfiguration().orientation
44-
!= Configuration.ORIENTATION_LANDSCAPE) {
45-
return insets;
46-
}
42+
int leftInset = insets.getStableInsetLeft();
43+
int rightInset = insets.getStableInsetRight();
4744
if (VERSION.SDK_INT >= VERSION_CODES.R) {
48-
v.setPadding(
49-
insets.getInsets(WindowInsets.Type.systemBars()).left,
50-
0,
51-
insets.getInsets(WindowInsets.Type.systemBars()).right,
52-
insets.getInsets(WindowInsets.Type.systemBars()).bottom);
53-
} else {
54-
v.setPadding(
55-
insets.getStableInsetLeft(),
56-
0,
57-
insets.getStableInsetRight(),
58-
insets.getStableInsetBottom());
45+
leftInset = insets.getInsets(WindowInsets.Type.systemBars()).left;
46+
rightInset = insets.getInsets(WindowInsets.Type.systemBars()).right;
5947
}
48+
49+
v.setPadding(leftInset, 0, rightInset, 0);
6050
return insets;
6151
};
6252
}

0 commit comments

Comments
 (0)