From 182a9a9b898ad81bcc8892c7754a6adaec69328d Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 2 May 2022 19:23:21 +0200 Subject: [PATCH] Remove dependency on javafx --- .idea/deploymentTargetDropDown.xml | 17 +++++++++++++++++ .../ojo/ui/SurveillanceFragment.java | 15 +++++++-------- 2 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 .idea/deploymentTargetDropDown.xml diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..299b144 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file 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 63dccda..a6141a8 100644 --- a/app/src/main/java/it/danieleverducci/ojo/ui/SurveillanceFragment.java +++ b/app/src/main/java/it/danieleverducci/ojo/ui/SurveillanceFragment.java @@ -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 cc = settings.getCameras(); - Pair 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 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(rows, cols); + int[] dimensions = {rows, cols}; + return dimensions; } /**