Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
66d0a1081a | |||
1647895a2a | |||
1ad6500882 | |||
dfb30bef9e | |||
2f9af2e1f1 | |||
333b44cba3 | |||
182a9a9b89 | |||
ff5b6b8101 |
17
.idea/deploymentTargetDropDown.xml
generated
Normal file
17
.idea/deploymentTargetDropDown.xml
generated
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="deploymentTargetDropDown">
|
||||||
|
<runningDeviceTargetSelectedWithDropDown>
|
||||||
|
<Target>
|
||||||
|
<type value="RUNNING_DEVICE_TARGET" />
|
||||||
|
<deviceKey>
|
||||||
|
<Key>
|
||||||
|
<type value="SERIAL_NUMBER" />
|
||||||
|
<value value="192.168.1.45:42069" />
|
||||||
|
</Key>
|
||||||
|
</deviceKey>
|
||||||
|
</Target>
|
||||||
|
</runningDeviceTargetSelectedWithDropDown>
|
||||||
|
<timeTargetWasSelectedWithDropDown value="2023-02-15T07:59:24.141496Z" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -3,15 +3,14 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 33
|
||||||
buildToolsVersion "30.0.2"
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "it.danieleverducci.ojo"
|
applicationId "it.danieleverducci.ojo.googleplay"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 33
|
||||||
versionCode 4
|
versionCode 6
|
||||||
versionName "0.1.0"
|
versionName "0.1.1"
|
||||||
|
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
|
||||||
@ -31,19 +30,19 @@ android {
|
|||||||
buildFeatures {
|
buildFeatures {
|
||||||
viewBinding true
|
viewBinding true
|
||||||
}
|
}
|
||||||
|
namespace 'it.danieleverducci.ojo'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||||
implementation 'com.google.android.material:material:1.4.0'
|
implementation 'com.google.android.material:material:1.8.0'
|
||||||
implementation 'androidx.navigation:navigation-fragment:2.3.5'
|
implementation 'androidx.navigation:navigation-fragment:2.5.3'
|
||||||
implementation 'androidx.navigation:navigation-ui:2.3.5'
|
implementation 'androidx.navigation:navigation-ui:2.5.3'
|
||||||
//implementation 'org.videolan.android:libvlc-all:3.4.1'
|
|
||||||
implementation 'de.mrmaffen:libvlc-android:2.1.12@aar'
|
implementation 'de.mrmaffen:libvlc-android:2.1.12@aar'
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
||||||
testImplementation 'junit:junit:4.+'
|
testImplementation 'junit:junit:4.+'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||||
}
|
}
|
5
app/release/.gitignore
vendored
Normal file
5
app/release/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
*.json
|
||||||
|
*.aab
|
||||||
|
*.apk
|
||||||
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
package="it.danieleverducci.ojo">
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
@ -14,6 +13,7 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".ui.MainActivity"
|
android:name=".ui.MainActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
android:exported="true"
|
||||||
android:theme="@style/Theme.Ojo"
|
android:theme="@style/Theme.Ojo"
|
||||||
android:configChanges="orientation|screenSize">
|
android:configChanges="orientation|screenSize">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
@ -6,9 +6,7 @@ import android.os.Bundle;
|
|||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.navigation.NavController;
|
import androidx.navigation.NavController;
|
||||||
import androidx.navigation.Navigation;
|
import androidx.navigation.Navigation;
|
||||||
|
|
||||||
@ -43,12 +41,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
binding.fab.hide();
|
binding.fab.hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
binding.fab.setOnClickListener(new View.OnClickListener() {
|
binding.fab.setOnClickListener(view -> navigateToFragment(R.id.action_homeToSettings));
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
navigateToFragment(R.id.action_homeToSettings);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnBackButtonPressedListener(OnBackButtonPressedListener onBackButtonPressedListener) {
|
public void setOnBackButtonPressedListener(OnBackButtonPressedListener onBackButtonPressedListener) {
|
||||||
@ -72,10 +65,14 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bundle != null)
|
try {
|
||||||
navController.navigate(actionId, bundle);
|
if (bundle != null)
|
||||||
else
|
navController.navigate(actionId, bundle);
|
||||||
navController.navigate(actionId);
|
else
|
||||||
|
navController.navigate(actionId);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
Log.e(TAG, "Unable to navigate to fragment: " + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getRotationEnabledSetting() {
|
public boolean getRotationEnabledSetting() {
|
||||||
|
@ -76,7 +76,8 @@ public class SurveillanceFragment extends Fragment {
|
|||||||
1.0f
|
1.0f
|
||||||
);
|
);
|
||||||
|
|
||||||
hiddenLayoutParams = new LinearLayout.LayoutParams(0, 0);
|
// 1,1 instead of 0,0 because the latter doesn't work on android 13+
|
||||||
|
hiddenLayoutParams = new LinearLayout.LayoutParams(1, 1);
|
||||||
|
|
||||||
binding = FragmentSurveillanceBinding.inflate(inflater, container, false);
|
binding = FragmentSurveillanceBinding.inflate(inflater, container, false);
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
@ -153,14 +154,14 @@ public class SurveillanceFragment extends Fragment {
|
|||||||
Settings settings = Settings.fromDisk(getContext());
|
Settings settings = Settings.fromDisk(getContext());
|
||||||
List<Camera> cc = settings.getCameras();
|
List<Camera> cc = settings.getCameras();
|
||||||
|
|
||||||
int elemsPerSide = calcGridSideElements(cc.size());
|
int[] gridSize = calcGridDimensionsBasedOnNumberOfElements(cc.size());
|
||||||
int camIdx = 0;
|
int camIdx = 0;
|
||||||
for (int r = 0; r < elemsPerSide; r++) {
|
for (int r = 0; r < gridSize[0]; r++) {
|
||||||
// Create row and add to row container
|
// Create row and add to row container
|
||||||
LinearLayout row = new LinearLayout(getContext());
|
LinearLayout row = new LinearLayout(getContext());
|
||||||
binding.gridRowContainer.addView(row, rowLayoutParams);
|
binding.gridRowContainer.addView(row, rowLayoutParams);
|
||||||
// Add camera viewers to the row
|
// Add camera viewers to the row
|
||||||
for (int c = 0; c < elemsPerSide; c++) {
|
for (int c = 0; c < gridSize[1]; c++) {
|
||||||
if ( camIdx < cc.size() ) {
|
if ( camIdx < cc.size() ) {
|
||||||
Camera cam = cc.get(camIdx);
|
Camera cam = cc.get(camIdx);
|
||||||
CameraView cv = addCameraView(cam, row);
|
CameraView cv = addCameraView(cam, row);
|
||||||
@ -239,13 +240,22 @@ public class SurveillanceFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of elements per side needed to create a grid that can contain the provided elements number.
|
* Returns the dimensions of the grid based on the number of elements.
|
||||||
* Es: to display 3 elements is needed a 4-element grid, with 2 elements per side (a 2x2 grid)
|
* Es: to display 3 elements is needed a 4-element grid, with 2 elements per side (a 2x2 grid)
|
||||||
|
* Es: to display 6 elements is needed a 9-element grid, with 3 elements per side (a 2x3 grid)
|
||||||
* Es: to display 7 elements is needed a 9-element grid, with 3 elements per side (a 3x3 grid)
|
* Es: to display 7 elements is needed a 9-element grid, with 3 elements per side (a 3x3 grid)
|
||||||
* @param elements
|
* @param elements
|
||||||
*/
|
*/
|
||||||
private int calcGridSideElements(int elements) {
|
private int[] calcGridDimensionsBasedOnNumberOfElements(int elements) {
|
||||||
return (int)(Math.ceil(Math.sqrt(elements)));
|
int rows = 1;
|
||||||
|
int cols = 1;
|
||||||
|
while (rows * cols < elements) {
|
||||||
|
cols += 1;
|
||||||
|
if (rows * cols >= elements) break;
|
||||||
|
rows += 1;
|
||||||
|
}
|
||||||
|
int[] dimensions = {rows, cols};
|
||||||
|
return dimensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@ buildscript {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "com.android.tools.build:gradle:4.2.2"
|
classpath 'com.android.tools.build:gradle:7.4.0'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
#Fri Aug 13 07:42:34 CEST 2021
|
#Wed Feb 15 08:51:54 CET 2023
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
Reference in New Issue
Block a user