mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
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:
parent
e3e0a12da8
commit
c0f797cb45
|
@ -69,6 +69,7 @@ public final class CameraManager {
|
||||||
private Rect framingRectInPreview;
|
private Rect framingRectInPreview;
|
||||||
private boolean initialized;
|
private boolean initialized;
|
||||||
private boolean previewing;
|
private boolean previewing;
|
||||||
|
private boolean reverseImage;
|
||||||
private final boolean useOneShotPreviewCallback;
|
private final boolean useOneShotPreviewCallback;
|
||||||
/**
|
/**
|
||||||
* Preview frames are delivered here, which we pass on to the registered handler. Make sure to
|
* 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);
|
configManager.setDesiredCameraParameters(camera);
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
reverseImage = prefs.getBoolean(PreferencesActivity.KEY_REVERSE_IMAGE, false);
|
||||||
if (prefs.getBoolean(PreferencesActivity.KEY_FRONT_LIGHT, false)) {
|
if (prefs.getBoolean(PreferencesActivity.KEY_FRONT_LIGHT, false)) {
|
||||||
FlashlightManager.enableFlashlight();
|
FlashlightManager.enableFlashlight();
|
||||||
}
|
}
|
||||||
|
@ -301,10 +303,6 @@ public final class CameraManager {
|
||||||
int previewFormat = configManager.getPreviewFormat();
|
int previewFormat = configManager.getPreviewFormat();
|
||||||
String previewFormatString = configManager.getPreviewFormatString();
|
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) {
|
switch (previewFormat) {
|
||||||
// This is the standard Android format which all devices are REQUIRED to support.
|
// 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.
|
// In theory, it's the only one we should ever care about.
|
||||||
|
|
Loading…
Reference in a new issue