Prevented checking the reverse image preference on every scan to improve performance.

git-svn-id: https://zxing.googlecode.com/svn/trunk@1777 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
dswitkin@google.com 2011-05-17 19:30:01 +00:00
parent e3e0a12da8
commit c0f797cb45

View file

@ -69,6 +69,7 @@ public final class CameraManager {
private Rect framingRectInPreview;
private boolean initialized;
private boolean previewing;
private boolean reverseImage;
private final boolean useOneShotPreviewCallback;
/**
* Preview frames are delivered here, which we pass on to the registered handler. Make sure to
@ -135,6 +136,7 @@ public final class CameraManager {
configManager.setDesiredCameraParameters(camera);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
reverseImage = prefs.getBoolean(PreferencesActivity.KEY_REVERSE_IMAGE, false);
if (prefs.getBoolean(PreferencesActivity.KEY_FRONT_LIGHT, false)) {
FlashlightManager.enableFlashlight();
}
@ -301,10 +303,6 @@ public final class CameraManager {
int previewFormat = configManager.getPreviewFormat();
String previewFormatString = configManager.getPreviewFormatString();
// FIXME(dswitkin): Don't access the preferences on every scan, this is expensive!
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean reverseImage = sharedPrefs.getBoolean(PreferencesActivity.KEY_REVERSE_IMAGE, false);
switch (previewFormat) {
// This is the standard Android format which all devices are REQUIRED to support.
// In theory, it's the only one we should ever care about.