Disable leanback mode when moving to other screens

This commit is contained in:
Daniele 2022-02-01 18:57:17 +01:00
parent 19e01068ef
commit e4fa5a7169

View File

@ -118,6 +118,20 @@ public class SurveillanceFragment extends Fragment {
public void onPause() { public void onPause() {
super.onPause(); super.onPause();
// Disable Leanback mode (fullscreen)
Window window = getActivity().getWindow();
if (window != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
final WindowInsetsController controller = window.getInsetsController();
if (controller != null)
controller.show(WindowInsets.Type.statusBars());
} else {
window.getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_VISIBLE);
}
}
disposeAllCameras(); disposeAllCameras();
} }