This commit is contained in:
Daniele
2021-10-13 19:29:04 +02:00
commit 3e77f69743
62 changed files with 1440 additions and 0 deletions

1
app/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

46
app/build.gradle Normal file
View File

@@ -0,0 +1,46 @@
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "it.danieleverducci.ojo"
minSdkVersion 17
targetSdkVersion 30
versionCode 1
versionName "0.0.1"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.navigation:navigation-fragment:2.3.5'
implementation 'androidx.navigation:navigation-ui:2.3.5'
implementation 'org.videolan.android:libvlc-all:3.4.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

21
app/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,26 @@
package it.danieleverducci.ojo;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("it.danieleverducci.ojo", appContext.getPackageName());
}
}

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="it.danieleverducci.ojo">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Ojo">
<activity
android:name=".ui.MainActivity"
android:label="@string/app_name"
android:theme="@style/Theme.Ojo"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,75 @@
package it.danieleverducci.ojo;
import android.content.Context;
import android.util.Log;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import it.danieleverducci.ojo.entities.Camera;
/**
* Manages the settings persistence
*/
public class Settings implements Serializable {
private static final String FILENAME = "settings.bin";
private static final String TAG = "Settings";
private volatile String settingsFilePath;
private List<Camera> cameras = new ArrayList<>();
public static Settings fromDisk(Context context) {
String filePath = context.getFilesDir() + File.separator + FILENAME;
Settings s = new Settings();
try {
FileInputStream fin = new FileInputStream(filePath);
ObjectInputStream ois = new ObjectInputStream(fin);
s = (Settings) ois.readObject();
} catch (FileNotFoundException e) {
Log.d(TAG, "No saved settings found, will create a new one");
} catch (IOException e) {
Log.e(TAG, "Unable to load settings from disk: " + e.toString());
} catch (ClassNotFoundException e) {
Log.e(TAG, e.toString());
}
s.settingsFilePath = filePath;
return s;
}
public List<Camera> getCameras() {
return cameras;
}
public void setCameras(List<Camera> cameras) {
this.cameras = cameras;
}
public void addCamera(Camera camera) {
this.cameras.add(camera);
}
public boolean save() {
try {
FileOutputStream fout = new FileOutputStream(settingsFilePath);
ObjectOutputStream oos = new ObjectOutputStream(fout);
oos.writeObject(this);
fout.close();
oos.close();
return true;
} catch (FileNotFoundException e) {
Log.e(TAG, "Unable to create file " + settingsFilePath + ": " + e.toString());
} catch (IOException e) {
Log.e(TAG, "Unable to save settings: " + e.toString());
}
return false;
}
}

View File

@@ -0,0 +1,21 @@
package it.danieleverducci.ojo.entities;
import java.io.Serializable;
public class Camera implements Serializable {
private String name;
private String rtspUrl;
public Camera(String name, String rtspUrl) {
this.name = name;
this.rtspUrl = rtspUrl;
}
public String getName() {
return name;
}
public String getRtspUrl() {
return rtspUrl;
}
}

View File

@@ -0,0 +1,71 @@
package it.danieleverducci.ojo.ui;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
import com.google.android.material.snackbar.Snackbar;
import it.danieleverducci.ojo.R;
import it.danieleverducci.ojo.Settings;
import it.danieleverducci.ojo.databinding.FragmentAddStreamBinding;
import it.danieleverducci.ojo.entities.Camera;
public class AddStreamFragment extends Fragment {
private FragmentAddStreamBinding binding;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
binding = FragmentAddStreamBinding.inflate(inflater, container, false);
return binding.getRoot();
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
binding.save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Check the field is filled
String url = binding.streamUrl.getText().toString();
if (!(url.startsWith("rtsp://") || url.startsWith("http://"))) {
Snackbar.make(view, R.string.add_stream_invalid_url, Snackbar.LENGTH_LONG)
.setAction(R.string.add_stream_invalid_url_dismiss, null).show();
return;
}
// Load existing settings (if any)
Settings settings = Settings.fromDisk(getContext());
// Add stream to list
settings.addCamera(new Camera("", url));
// Save
if (!settings.save()) {
Snackbar.make(view, R.string.add_stream_error_saving, Snackbar.LENGTH_LONG).show();
return;
}
// Back to first fragment
NavHostFragment.findNavController(AddStreamFragment.this)
.navigate(R.id.action_SecondFragment_to_FirstFragment);
}
});
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}

View File

@@ -0,0 +1,49 @@
package it.danieleverducci.ojo.ui;
import android.os.Bundle;
import com.google.android.material.snackbar.Snackbar;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;
import it.danieleverducci.ojo.R;
import it.danieleverducci.ojo.databinding.ActivityMainBinding;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends AppCompatActivity {
private ActivityMainBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
// Show FAB only on first fragment
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main);
navController.addOnDestinationChangedListener((controller, destination, arguments) -> {
if (destination.getId() == R.id.FirstFragment)
binding.fab.show();
else
binding.fab.hide();
});
binding.fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
navController.navigate(R.id.action_FirstFragment_to_SecondFragment);
}
});
}
}

View File

@@ -0,0 +1,278 @@
package it.danieleverducci.ojo.ui;
import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.SurfaceHolder;
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.fragment.app.Fragment;
import org.videolan.libvlc.interfaces.IVLCVout;
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.Media;
import org.videolan.libvlc.MediaPlayer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
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:
* rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov
* rtsp://demo:demo@ipvmdemo.dyndns.org:5541/onvif-media/media.amp?profile=profile_1_h264&sessiontimeout=60&streamtype=unicast
*/
public class SurveillanceFragment extends Fragment {
final static private String TAG = "SurveillanceFragment";
final static private String[] VLC_OPTIONS = new String[]{
"--aout=opensles",
//"--audio-time-stretch", // time stretching
//"-vvv", // verbosity
"--avcodec-codec=h264",
//"--file-logging",
//"--logfile=vlc-log.txt"
};
private FragmentSurveillanceBinding binding;
private List<CameraView> cameraViews = new ArrayList<>();
int viewMargin;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
viewMargin = DpiUtils.DpToPixels(container.getContext(), 2);
binding = FragmentSurveillanceBinding.inflate(inflater, container, false);
return binding.getRoot();
}
@Override
public void onResume() {
super.onResume();
// 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);
}
}
addAllCameras();
// Start playback for all streams
for (CameraView cv : cameraViews) {
cv.startPlayback();
}
}
@Override
public void onPause() {
super.onPause();
disposeAllCameras();
}
private void addAllCameras() {
Settings settings = Settings.fromDisk(getContext());
List<Camera> cc = settings.getCameras();
int elemsPerSide = calcGridSideElements(cc.size());
int camIdx = 0;
for (int r = 0; r < elemsPerSide; r++) {
// Create row and add to row container
LinearLayout row = new LinearLayout(getContext());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
0,
1.0f
);
binding.gridRowContainer.addView(row, params);
// Add camera viewers to the row
for (int c = 0; c < elemsPerSide; c++) {
if ( camIdx < cc.size() ) {
Camera cam = cc.get(camIdx);
CameraView cv = addCameraView(cam, row);
cv.startPlayback();
} else {
// Cameras are less than the maximum number of cells in grid: fill remaining cells with empty views
View ev = new View(getContext());
ev.setBackgroundColor(getResources().getColor(R.color.purple_700));
LinearLayout.LayoutParams evParams = new LinearLayout.LayoutParams(
0,
LinearLayout.LayoutParams.MATCH_PARENT,
1.0f
);
evParams.setMargins(viewMargin,viewMargin,viewMargin,viewMargin);
row.addView(ev, evParams);
}
camIdx++;
}
}
}
private void disposeAllCameras() {
// Destroy players, libs etc
for (CameraView cv : cameraViews) {
cv.destroy();
}
cameraViews.clear();
// Remove views
binding.gridRowContainer.removeAllViews();
}
protected void hideAllCameraViewsButNot(View cameraView) {
for (int i = 0; i < binding.gridRowContainer.getChildCount(); i++) {
LinearLayout row = (LinearLayout) binding.gridRowContainer.getChildAt(i);
for (int j = 0; j < row.getChildCount(); j++) {
View cam = row.getChildAt(j);
if (cameraView.getId() == cam.getId())
cam.setVisibility(View.VISIBLE);
else
cam.setVisibility(View.GONE);
}
}
}
protected void showAllCameras() {
for (int i = 0; i < binding.gridRowContainer.getChildCount(); i++) {
LinearLayout row = (LinearLayout) binding.gridRowContainer.getChildAt(i);
for (int j = 0; j < row.getChildCount(); j++) {
View cam = row.getChildAt(j);
cam.setVisibility(View.VISIBLE);
}
}
}
private CameraView addCameraView(Camera camera, LinearLayout rowContainer) {
CameraView cv = new CameraView(
getContext(),
camera
);
// Add to layout
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
0,
LinearLayout.LayoutParams.MATCH_PARENT,
1.0f
);
params.setMargins(viewMargin,viewMargin,viewMargin,viewMargin);
rowContainer.addView(cv.surfaceView, params);
cameraViews.add(cv);
return cv;
}
/**
* Returns the number of elements per side needed to create a grid that can contain the provided elements number.
* Es: to display 3 elements is needed a 4-element grid, with 2 elements per side (a 2x2 grid)
* Es: to display 7 elements is needed a 9-element grid, with 3 elements per side (a 3x3 grid)
* @param elements
*/
private int calcGridSideElements(int elements) {
return (int)(Math.ceil(Math.sqrt(elements)));
}
/**
* Contains all entities (views and java entities) related to a camera stream viewer
*/
private class CameraView {
protected SurfaceView surfaceView;
protected MediaPlayer mediaPlayer;
protected IVLCVout ivlcVout;
protected Camera camera;
protected LibVLC libvlc;
public CameraView(Context context, Camera camera) {
this.camera = camera;
this.libvlc = new LibVLC(context, new ArrayList<>(Arrays.asList(VLC_OPTIONS)));
surfaceView = new SurfaceView(context);
surfaceView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SurveillanceFragment.this.hideAllCameraViewsButNot(v);
}
});
SurfaceHolder holder = surfaceView.getHolder();
holder.setKeepScreenOn(true);
// Create media player
mediaPlayer = new MediaPlayer(libvlc);
// Set up video output
ivlcVout = mediaPlayer.getVLCVout();
ivlcVout.setVideoView(surfaceView);
ivlcVout.attachViews();
// Load media and start playing
Media m = new Media(libvlc, Uri.parse(camera.getRtspUrl()));
mediaPlayer.setMedia(m);
// Register for view resize events
final ViewTreeObserver observer= surfaceView.getViewTreeObserver();
observer.addOnGlobalLayoutListener(() -> {
// Set rendering size
ivlcVout.setWindowSize(surfaceView.getWidth(), surfaceView.getHeight());
});
}
/**
* Starts the playback.
*/
public void startPlayback() {
mediaPlayer.play();
}
/**
* Destroys the object and frees the memory
*/
public void destroy() {
if (libvlc == null) {
Log.e(TAG, this.toString() + " already destroyed");
return;
}
mediaPlayer.stop();
final IVLCVout vout = mediaPlayer.getVLCVout();
vout.detachViews();
libvlc.release();
libvlc = null;
mediaPlayer.release();
mediaPlayer = null;
}
}
}

View File

@@ -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()
);
}
}

View File

@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M3,4V1h2v3h3v2H5v3H3V6H0V4H3zM6,10V7h3V4h7l1.83,2H21c1.1,0 2,0.9 2,2v12c0,1.1 -0.9,2 -2,2H5c-1.1,0 -2,-0.9 -2,-2V10H6zM13,19c2.76,0 5,-2.24 5,-5s-2.24,-5 -5,-5s-5,2.24 -5,5S10.24,19 13,19zM9.8,14c0,1.77 1.43,3.2 3.2,3.2s3.2,-1.43 3.2,-3.2s-1.43,-3.2 -3.2,-3.2S9.8,12.23 9.8,14z"/>
</vector>

View File

@@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#FFFFFF">
<group android:scaleX="2.61"
android:scaleY="2.61"
android:translateX="22.68"
android:translateY="22.68">
<path
android:fillColor="@android:color/white"
android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/>
</group>
</vector>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.MainActivity">
<include layout="@layout/content_main" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@drawable/ic_add_camera"
app:tint="@color/purple_500"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<fragment
android:id="@+id/nav_host_fragment_content_main"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="0dp"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/nav_graph" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.SurveillanceFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="50dp"
android:orientation="vertical"
android:gravity="center_horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="50dp"
android:src="@mipmap/ic_launcher_round"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/add_stream"/>
<EditText
android:id="@+id/stream_url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:hint="@string/add_stream_placeholder_url"
android:lines="1"
android:maxLines="1"
android:inputType="textUri"/>
<Button
android:id="@+id/save"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="@string/add_stream_save"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="50dp"
android:background="@color/purple_200"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@color/purple_500"
android:text="@string/app_info_title"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/app_info_creator_desc"
android:autoLink="web"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/app_info_license_desc"
android:autoLink="web"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/app_info_repo_desc"
android:autoLink="web"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/app_info_lib_desc"
android:autoLink="web"/>
</LinearLayout>
</ScrollView>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/grid_row_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".ui.AddStreamFragment"
android:background="@color/purple_500">
</LinearLayout>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nav_graph"
app:startDestination="@id/FirstFragment">
<fragment
android:id="@+id/FirstFragment"
android:name="it.danieleverducci.ojo.ui.SurveillanceFragment"
android:label="@string/first_fragment_label"
tools:layout="@layout/fragment_surveillance">
<action
android:id="@+id/action_FirstFragment_to_SecondFragment"
app:destination="@id/SecondFragment" />
</fragment>
<fragment
android:id="@+id/SecondFragment"
android:name="it.danieleverducci.ojo.ui.AddStreamFragment"
android:label="@string/second_fragment_label"
tools:layout="@layout/fragment_add_stream">
<action
android:id="@+id/action_SecondFragment_to_FirstFragment"
app:destination="@id/FirstFragment" />
</fragment>
</navigation>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- The english locale is defined in the default strings file -->
</resources>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Ojo</string>
<!-- Strings used for fragments for navigation -->
<string name="first_fragment_label">First Fragment</string>
<string name="second_fragment_label">Second Fragment</string>
<string name="add_stream_placeholder_url">rtsp://username:password@192.168.1.123:554</string>
<string name="add_stream">Inserisci l\'url dello stream RTSP della tua IP Camera. Nota che questo differisce tra un modello e l\'altro. Consulta il pannello di configurazione o il manuale della tua IP Camera.</string>
<string name="add_stream_save">Salva</string>
<string name="add_stream_invalid_url">L\'URL RTSP non è valido</string>
<string name="add_stream_invalid_url_dismiss">Chiudi</string>
<string name="add_stream_error_saving">Si è verificato un errore durante il salvataggio della configurazione.</string>
<string name="app_info_title">Informazioni su Ojo</string>
<string name="app_info_creator_desc">Creato da Daniele Verducci.</string>
<string name="app_info_license_desc">Questa app è rilasciata sotto licenza GNU GENERAL PUBLIC LICENSE v3+. Puoi ottenerne una copia qui: https://raw.githubusercontent.com/penguin86/ojo/master/LICENSE</string>
<string name="app_info_repo_desc">Puoi trovare il codice sorgente al repository: https://github.com/penguin86/ojo</string>
<string name="app_info_lib_desc">Questa app è resa possibile dal magnifico lavoro dei team vlc and vlc-android! Per saperne di più o ottenere il codice sorgente: https://code.videolan.org/videolan/vlc-android</string>
</resources>

View File

@@ -0,0 +1,15 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Ojo" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/purple_200</item>
<item name="colorSecondaryVariant">@color/purple_200</item>
<item name="colorOnSecondary">@color/black</item>
</style>
</resources>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="Theme.Ojo" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/purple_200</item>
<item name="colorSecondaryVariant">@color/purple_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>

View File

@@ -0,0 +1,3 @@
<resources>
<dimen name="fab_margin">16dp</dimen>
</resources>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#6200EE</color>
</resources>

View File

@@ -0,0 +1,19 @@
<resources>
<string name="app_name">Ojo</string>
<!-- Strings used for fragments for navigation -->
<string name="first_fragment_label">First Fragment</string>
<string name="second_fragment_label">Second Fragment</string>
<string name="add_stream_placeholder_url">rtsp://username:password@192.168.1.123:554</string>
<string name="add_stream">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.</string>
<string name="add_stream_save">Save</string>
<string name="add_stream_invalid_url">Invalid RTSP url</string>
<string name="add_stream_invalid_url_dismiss">Dismiss</string>
<string name="add_stream_error_saving">An error has occurred while saving configuration</string>
<string name="app_info_title">About Ojo</string>
<string name="app_info_creator_desc">Created by Daniele Verducci.</string>
<string name="app_info_license_desc">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</string>
<string name="app_info_repo_desc">The source code can be obtained at the github repository: https://github.com/penguin86/ojo</string>
<string name="app_info_lib_desc">This app is made possible by the gourgeous vlc and vlc-android teams effort! You can know more or obtain the source code at https://code.videolan.org/videolan/vlc-android</string>
</resources>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Ojo" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/purple_500</item>
<item name="colorSecondaryVariant">@color/purple_700</item>
<item name="colorOnSecondary">@color/white</item>
</style>
</resources>

View File

@@ -0,0 +1,17 @@
package it.danieleverducci.ojo;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}