Disable insets unless android >= 15
This commit is contained in:
parent
4bb7346a3b
commit
bdbf551132
1 changed files with 13 additions and 11 deletions
|
|
@ -67,18 +67,20 @@ public class MainActivity extends BridgeActivity {
|
||||||
});
|
});
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
|
var useInsets = Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE;
|
||||||
|
WindowCompat.setDecorFitsSystemWindows(getWindow(), useInsets);
|
||||||
|
if(useInsets) {
|
||||||
Databridge.addResponder("insets", (responder) -> {
|
Databridge.addResponder("insets", (responder) -> {
|
||||||
var view = getWindow().getDecorView();
|
var view = getWindow().getDecorView();
|
||||||
var insets = view.getRootWindowInsets();
|
var insets = view.getRootWindowInsets();
|
||||||
var topInsetPxSize= insets.getInsetsIgnoringVisibility(WindowInsets.Type.statusBars()).top;
|
var topInsetPxSize = insets.getInsetsIgnoringVisibility(WindowInsets.Type.statusBars()).top;
|
||||||
var bottomInsetPxSize= insets.getInsetsIgnoringVisibility(WindowInsets.Type.navigationBars()).bottom;
|
var bottomInsetPxSize = insets.getInsetsIgnoringVisibility(WindowInsets.Type.navigationBars()).bottom;
|
||||||
|
|
||||||
var json = "{ \"top\": "+topInsetPxSize+", \"bottom\":"+bottomInsetPxSize+"}";
|
var json = "{ \"top\": " + topInsetPxSize + ", \"bottom\":" + bottomInsetPxSize + "}";
|
||||||
Log.i("insets","Inset sizes are:"+topInsetPxSize+" bottom:"+ bottomInsetPxSize);
|
Log.i("insets", "Inset sizes are:" + topInsetPxSize + " bottom:" + bottomInsetPxSize);
|
||||||
Databridge.sendAnswerTo(responder, json);
|
Databridge.sendAnswerTo(responder, json);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
getOnBackInvokedDispatcher().registerOnBackInvokedCallback(OnBackInvokedDispatcher.PRIORITY_OVERLAY,
|
getOnBackInvokedDispatcher().registerOnBackInvokedCallback(OnBackInvokedDispatcher.PRIORITY_OVERLAY,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue