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 a2c5d0a..2b08d9b 100644
--- a/app/src/main/java/it/danieleverducci/ojo/ui/SurveillanceFragment.java
+++ b/app/src/main/java/it/danieleverducci/ojo/ui/SurveillanceFragment.java
@@ -3,6 +3,7 @@ package it.danieleverducci.ojo.ui;
import android.content.Context;
import android.graphics.Color;
import android.net.Uri;
+import android.os.Build;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
@@ -12,9 +13,15 @@ import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
+import android.view.Window;
+import android.view.WindowInsets;
+import android.view.WindowInsetsController;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
+import androidx.core.view.WindowCompat;
+import androidx.core.view.WindowInsetsCompat;
+import androidx.core.view.WindowInsetsControllerCompat;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
@@ -31,6 +38,7 @@ import it.danieleverducci.ojo.R;
import it.danieleverducci.ojo.Settings;
import it.danieleverducci.ojo.databinding.FragmentSurveillanceBinding;
import it.danieleverducci.ojo.entities.Camera;
+import it.danieleverducci.ojo.utils.DpiUtils;
/**
* Some streams to test:
@@ -98,18 +106,32 @@ public class SurveillanceFragment extends Fragment implements MediaPlayer.EventL
camIdx++;
}
}
-
-
-
-
-
-
}
@Override
public void onStart() {
super.onStart();
+ // 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.hide(WindowInsets.Type.statusBars());
+ } else {
+ window.getDecorView().setSystemUiVisibility(
+ View.SYSTEM_UI_FLAG_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_IMMERSIVE
+ | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
+ }
+ }
+
+ // Start playback for all streams
for (CameraView cv : cameraViews) {
cv.startPlayback();
}
@@ -174,6 +196,8 @@ public class SurveillanceFragment extends Fragment implements MediaPlayer.EventL
LinearLayout.LayoutParams.MATCH_PARENT,
1.0f
);
+ int viewMargin = DpiUtils.DpToPixels(rowContainer.getContext(), 2);
+ params.setMargins(viewMargin,viewMargin,viewMargin,viewMargin);
rowContainer.addView(cv.surfaceView, params);
cameraViews.add(cv);
diff --git a/app/src/main/java/it/danieleverducci/ojo/utils/DpiUtils.java b/app/src/main/java/it/danieleverducci/ojo/utils/DpiUtils.java
new file mode 100644
index 0000000..b2efbdb
--- /dev/null
+++ b/app/src/main/java/it/danieleverducci/ojo/utils/DpiUtils.java
@@ -0,0 +1,16 @@
+package it.danieleverducci.ojo.utils;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.util.TypedValue;
+
+public class DpiUtils {
+ public static int DpToPixels(Context context, int dp) {
+ Resources r = context.getResources();
+ return (int) TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP,
+ dp,
+ r.getDisplayMetrics()
+ );
+ }
+}
diff --git a/app/src/main/res/layout/fragment_add_stream.xml b/app/src/main/res/layout/fragment_add_stream.xml
index 8b2525a..fe9f364 100644
--- a/app/src/main/res/layout/fragment_add_stream.xml
+++ b/app/src/main/res/layout/fragment_add_stream.xml
@@ -1,26 +1,81 @@
-
-
-
+ android:padding="50dp"
+ android:orientation="vertical"
+ android:gravity="center_horizontal">
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values-v27/themes.xml b/app/src/main/res/values-v27/themes.xml
new file mode 100644
index 0000000..fbc2c4e
--- /dev/null
+++ b/app/src/main/res/values-v27/themes.xml
@@ -0,0 +1,19 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a0c5b63..93e3c41 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -8,8 +8,14 @@
Previous
rtsp://username:password@192.168.1.123:554
+ Please insert your camera\'s RTSP stream. Note that the URL differs from camera to camera: you can find the complete URL in your camera\'s settings or user manual.
Save
Invalid RTSP url
Dismiss
An error has occurred while saving configuration
+
+ About Ojo
+ Created by Daniele Verducci.
+ This application is licensed under the GNU GENERAL PUBLIC LICENSE v3+. You can obtain a copy here: https://raw.githubusercontent.com/penguin86/ojo/master/LICENSE
+ The source code can be obtained at the github repository: https://github.com/penguin86/ojo
\ No newline at end of file
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index c412309..267b5dc 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -1,3 +1,4 @@
+