Don't set zoom without knowing maximum for sure

git-svn-id: https://zxing.googlecode.com/svn/trunk@1247 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2010-03-19 16:17:00 +00:00
parent ae635078cb
commit eb33e2a6bf

View file

@ -441,26 +441,30 @@ final class CameraManager {
} }
} }
String takingPictureZoomString = parameters.get("taking-picture-zoom-max"); String takingPictureZoomMaxString = parameters.get("taking-picture-zoom-max");
if (takingPictureZoomString != null) { if (takingPictureZoomMaxString != null) {
try { try {
int tenMaxZoom = Integer.parseInt(takingPictureZoomString); int tenMaxZoom = Integer.parseInt(takingPictureZoomMaxString);
if (tenDesiredZoom > tenMaxZoom) { if (tenDesiredZoom > tenMaxZoom) {
tenDesiredZoom = tenMaxZoom; tenDesiredZoom = tenMaxZoom;
} }
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
Log.w(TAG, "Bad taking-picture-zoom-max: " + takingPictureZoomString); Log.w(TAG, "Bad taking-picture-zoom-max: " + takingPictureZoomMaxString);
} }
} }
// Set zoom. This helps encourage the user to pull back. // Set zoom. This helps encourage the user to pull back.
// Some devices like the Behold have a zoom parameter // Some devices like the Behold have a zoom parameter
parameters.set("zoom", String.valueOf(tenDesiredZoom / 10.0)); if (maxZoomString != null) {
parameters.set("zoom", String.valueOf(tenDesiredZoom / 10.0));
}
// Most devices, like the Hero, appear to expose this zoom parameter. // Most devices, like the Hero, appear to expose this zoom parameter.
// It takes on values like "27" which appears to mean 2.7x zoom // It takes on values like "27" which appears to mean 2.7x zoom
parameters.set("taking-picture-zoom", tenDesiredZoom); if (takingPictureZoomMaxString != null) {
parameters.set("taking-picture-zoom", tenDesiredZoom);
}
} }
/* /*