From e4fa5a71694370534a75c124b5272173853b7e99 Mon Sep 17 00:00:00 2001 From: Daniele Date: Tue, 1 Feb 2022 18:57:17 +0100 Subject: [PATCH] Disable leanback mode when moving to other screens --- .../ojo/ui/SurveillanceFragment.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/src/main/java/it/danieleverducci/ojo/ui/SurveillanceFragment.java b/app/src/main/java/it/danieleverducci/ojo/ui/SurveillanceFragment.java index 753ddc2..a928eb5 100644 --- a/app/src/main/java/it/danieleverducci/ojo/ui/SurveillanceFragment.java +++ b/app/src/main/java/it/danieleverducci/ojo/ui/SurveillanceFragment.java @@ -118,6 +118,20 @@ public class SurveillanceFragment extends Fragment { public void 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(); }