Android: suppress deprecation warning for safe area APIs before Android R
We already handle both cases of pre and post Android R APIs, so we can safely suppress the code using older API after extracting it to its own method. Change-Id: I3f5d6dab480c5fb32d35f615db719a4a0eb3f45d Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
This commit is contained in:
parent
622133ace2
commit
2ce9140c6c
@ -83,6 +83,19 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
|
|||||||
int types = WindowInsets.Type.displayCutout() | WindowInsets.Type.systemBars();
|
int types = WindowInsets.Type.displayCutout() | WindowInsets.Type.systemBars();
|
||||||
safeInsets = insets.getInsets(types);
|
safeInsets = insets.getInsets(types);
|
||||||
} else {
|
} else {
|
||||||
|
safeInsets = getSafeInsetsPreAndroidR(view, insets);
|
||||||
|
}
|
||||||
|
QtNative.runAction(() -> safeAreaMarginsChanged(safeInsets, getId()));
|
||||||
|
return insets;
|
||||||
|
});
|
||||||
|
|
||||||
|
QtNative.runAction(() -> requestApplyInsets());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
Insets getSafeInsetsPreAndroidR(View view, WindowInsets insets)
|
||||||
|
{
|
||||||
int left = 0;
|
int left = 0;
|
||||||
int top = 0;
|
int top = 0;
|
||||||
int right = 0;
|
int right = 0;
|
||||||
@ -106,16 +119,7 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
|
|||||||
bottom = Math.max(bottom, cutout.getSafeInsetBottom());
|
bottom = Math.max(bottom, cutout.getSafeInsetBottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
safeInsets = Insets.of(left, top, right, bottom);
|
return Insets.of(left, top, right, bottom);
|
||||||
}
|
|
||||||
|
|
||||||
QtNative.runAction(() -> safeAreaMarginsChanged(safeInsets, getId()));
|
|
||||||
|
|
||||||
return insets;
|
|
||||||
});
|
|
||||||
|
|
||||||
QtNative.runAction(() -> requestApplyInsets());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedFromNativeCode
|
@UsedFromNativeCode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user