Experiment: edge-to-edge

pull/217/head
M66B 11 months ago
parent 06eddf1ffc
commit 18343c1ccf

@ -170,6 +170,9 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
FragmentDialogTheme.setBackground(this, holder, this instanceof ActivityCompose); FragmentDialogTheme.setBackground(this, holder, this instanceof ActivityCompose);
View cf = view.findViewById(R.id.content_frame);
int cfpb = (cf == null ? 0 : cf.getPaddingBottom());
ViewCompat.setOnApplyWindowInsetsListener(holder, (v, windowInsets) -> { ViewCompat.setOnApplyWindowInsetsListener(holder, (v, windowInsets) -> {
try { try {
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()); Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
@ -208,9 +211,19 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
} }
if (edge_to_edge) { if (edge_to_edge) {
b = v.getPaddingBottom(); if (cf != null) {
Insets nav = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars()); Insets nav = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars());
v.setPaddingRelative(0, 0, 0, b + (nav.bottom - nav.top)); int pad = Math.max(0, cfpb + (nav.bottom - nav.top));
if (pad != cf.getPaddingBottom())
cf.setPaddingRelative(
cf.getPaddingStart(), cf.getPaddingTop(),
cf.getPaddingEnd(), cfpb + (nav.bottom - nav.top));
}
//for (View child : Helper.getViewsWithTag(v, "inset")) {
// mlp = (ViewGroup.MarginLayoutParams) child.getLayoutParams();
// mlp.bottomMargin = insets.bottom;
// child.setLayoutParams(mlp);
//}
} }
} catch (Throwable ex) { } catch (Throwable ex) {

@ -647,7 +647,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
} }
}); });
swEdgeToEdge.setVisibility(debug || BuildConfig.DEBUG ? View.VISIBLE : View.GONE); //swEdgeToEdge.setVisibility(debug || BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
swEdgeToEdge.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swEdgeToEdge.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {

Loading…
Cancel
Save