Remove dependency on javafx

This commit is contained in:
Benjamin Renard 2022-05-02 19:23:21 +02:00
parent ff5b6b8101
commit 182a9a9b89
2 changed files with 24 additions and 8 deletions

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="$USER_HOME$/.android/avd/Pixel_5_API_30.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2022-05-02T17:02:45.674283Z" />
</component>
</project>

View File

@ -27,8 +27,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javafx.util.Pair;
import it.danieleverducci.ojo.R;
import it.danieleverducci.ojo.Settings;
import it.danieleverducci.ojo.databinding.FragmentSurveillanceBinding;
@ -155,7 +153,7 @@ public class SurveillanceFragment extends Fragment {
Settings settings = Settings.fromDisk(getContext());
List<Camera> cc = settings.getCameras();
Pair<Integer, Integer> gridSize = calcGridDimensionsBasedOnNumberOfElements(cc.size());
int[] gridSize = calcGridDimensionsBasedOnNumberOfElements(cc.size());
int camIdx = 0;
for (int r = 0; r < gridSize[0]; r++) {
// Create row and add to row container
@ -247,15 +245,16 @@ public class SurveillanceFragment extends Fragment {
* Es: to display 7 elements is needed a 9-element grid, with 3 elements per side (a 3x3 grid)
* @param elements
*/
private Pair<Integer, Integer> calcGridDimensionsBasedOnNumberOfElements(int elements) {
private int[] calcGridDimensionsBasedOnNumberOfElements(int elements) {
int rows = 1;
int cols = 1;
while (rows * cols < elements) {
cols += 1;
if (rows * cols >= elements) break;
rows += 1;
cols += 1;
if (rows * cols >= elements) break;
rows += 1;
}
return new Pair<Integer, Integer>(rows, cols);
int[] dimensions = {rows, cols};
return dimensions;
}
/**