Skip to content

Commit

Permalink
fix(camera): remove character
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Del Pino <idelpino@teclib.com>
  • Loading branch information
Ivan Del Pino authored and rafaelje committed Sep 24, 2018
1 parent bf2ecbe commit 97ba0f4
Showing 1 changed file with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ public Cameras(Context xCtx) {
CameraCharacteristics chars = getCharacteristics(xCtx, index);
if (chars != null) {
c.put("LENSFACING", new CategoryValue(getFacingState(chars), "LENSFACING", "lensfacing"));
c.put("IMAGEFORMAT", new CategoryValue(getCategoryImageFormat(chars)));
c.put("FLASHUNIT", new CategoryValue(getFlashUnit(chars), "FLASHUNIT", "flashunit"));
c.put("IMAGEFORMAT", new CategoryValue(getCategoryImageFormat(chars)));
}
this.add(c);
}
Expand Down Expand Up @@ -137,17 +137,6 @@ public String getFacingState(CameraCharacteristics characteristics) {
return value;
}

/**
* Version information about the camera device
* @param characteristics
* @return String manufacturers camera
*/
public String getManufacturer(CameraCharacteristics characteristics) {
String value = "N/A";

return value;
}

/**
* Whether this camera device has a flash unit.
* @param characteristics
Expand All @@ -157,7 +146,7 @@ public String getFlashUnit(CameraCharacteristics characteristics) {
String value = "N/A";
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
Boolean bool = characteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABLE);
return bool != null ? bool ? "1" : "0" : "-1";
return bool != null ? bool ? "1" : "0" : "N/A";
}
return value;
}
Expand Down Expand Up @@ -186,7 +175,7 @@ public ArrayList<String> getImageFormat(CameraCharacteristics characteristics) {
for (int value : outputFormats) {
String type = typeFormat(value);
if (type != null) {
types.add(type);
types.add(removeCharacters(type));
}
}
}
Expand All @@ -195,7 +184,11 @@ public ArrayList<String> getImageFormat(CameraCharacteristics characteristics) {
return types;
}

public String typeFormat(int i) {
private String removeCharacters(String type) {
return type.replaceAll("[<>]", "");
}

private String typeFormat(int i) {
switch (i) {
case 4:
return "RGB_565";
Expand Down

0 comments on commit 97ba0f4

Please sign in to comment.