Skip to content

Commit

Permalink
[Catalog] Fix to edge to edge behaviour for catalog
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 637973580
  • Loading branch information
imhappi authored and pekingme committed Jun 5, 2024
1 parent 801ccab commit 4acd570
Showing 1 changed file with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.view.Window;
Expand All @@ -40,23 +39,14 @@ public WindowPreferencesManager(Context context) {
this.context = context;
this.listener =
(v, insets) -> {
if (v.getResources().getConfiguration().orientation
!= Configuration.ORIENTATION_LANDSCAPE) {
return insets;
}
int leftInset = insets.getStableInsetLeft();
int rightInset = insets.getStableInsetRight();
if (VERSION.SDK_INT >= VERSION_CODES.R) {
v.setPadding(
insets.getInsets(WindowInsets.Type.systemBars()).left,
0,
insets.getInsets(WindowInsets.Type.systemBars()).right,
insets.getInsets(WindowInsets.Type.systemBars()).bottom);
} else {
v.setPadding(
insets.getStableInsetLeft(),
0,
insets.getStableInsetRight(),
insets.getStableInsetBottom());
leftInset = insets.getInsets(WindowInsets.Type.systemBars()).left;
rightInset = insets.getInsets(WindowInsets.Type.systemBars()).right;
}

v.setPadding(leftInset, 0, rightInset, 0);
return insets;
};
}
Expand Down

0 comments on commit 4acd570

Please sign in to comment.