diff --git a/app/src/main/java/com/example/househomey/scanner/SNImageScanner.java b/app/src/main/java/com/example/househomey/scanner/SNImageScanner.java
index 8e4a8f0..f55ecc3 100644
--- a/app/src/main/java/com/example/househomey/scanner/SNImageScanner.java
+++ b/app/src/main/java/com/example/househomey/scanner/SNImageScanner.java
@@ -57,19 +57,17 @@ public void scanImage(String imageUri) {
* @return the chosen serial number
*/
private static String selectBestLine(Text text) {
- String bestLine = "";
+ String bestElement = "";
for (Text.TextBlock block : text.getTextBlocks()) {
for (Text.Line line : block.getLines()) {
- // Convert each line into a string of numbers
- String lineText = line.getText().replaceAll("[^0-9]", "");
-
- // Serial numbers are usually at the bottom?
- if (lineText.length() >= bestLine.length())
- bestLine = lineText;
+ for (Text.Element element : line.getElements())
+ // Serial numbers are usually at the bottom
+ if (element.getText().length() >= bestElement.length())
+ bestElement = element.getText();
}
}
- return bestLine;
+ return bestElement;
}
}
diff --git a/app/src/main/res/layout/fragment_add_item.xml b/app/src/main/res/layout/fragment_add_item.xml
index 8fe7a71..b48c6ae 100644
--- a/app/src/main/res/layout/fragment_add_item.xml
+++ b/app/src/main/res/layout/fragment_add_item.xml
@@ -216,8 +216,7 @@
+ android:layout_height="wrap_content" />