OpenNoteScanner
OpenNoteScanner copied to clipboard
crash when writing camera settings
your project is specifically setting the camera to FOCUS_MODE_CONTINUOUS_PICTURE, without a check to see if the camera allows it. We are using Galaxy tab Es and they don't support that. This causes an exception when trying to set camera settings. I suggest this code change:
PackageManager pm = getPackageManager();
if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_AUTOFOCUS)) {
//following code prevents crash on newer tablets -jdl
List<String> focusModes = param.getSupportedFocusModes();
if (focusModes.contains("auto"))
param.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
else if (focusModes.contains("continuous-picture"))
param.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
Log.d(TAG, "enabling autofocus");
} else {
mFocused = true;
Log.d(TAG, "autofocus not available");
}
Hi @JLOrwell , thank you for your interest on Open Note Scanner.
Can you do a pull request with this change over the current head code? I will accept it right after the CI test.
Best regards, Claudemir