mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Merge pull request #296 from MicheleMas/master
Added the ability to disable history saving
This commit is contained in:
commit
500fe2f68f
|
@ -119,6 +119,8 @@
|
||||||
<string name="preferences_play_beep_title">Suona</string>
|
<string name="preferences_play_beep_title">Suona</string>
|
||||||
<string name="preferences_remember_duplicates_summary">Mantieni scansioni multiple del codice a barre nella stessa Cronologia</string>
|
<string name="preferences_remember_duplicates_summary">Mantieni scansioni multiple del codice a barre nella stessa Cronologia</string>
|
||||||
<string name="preferences_remember_duplicates_title">Ricorda duplicati</string>
|
<string name="preferences_remember_duplicates_title">Ricorda duplicati</string>
|
||||||
|
<string name="preferences_history_summary">Mantieni le tue scansioni nella Cronologia</string>
|
||||||
|
<string name="preferences_history_title">Aggiungi alla Cronologia</string>
|
||||||
<string name="preferences_result_title">Impostazioni risultato</string>
|
<string name="preferences_result_title">Impostazioni risultato</string>
|
||||||
<string name="preferences_scanning_title">Durante la scansione di codici a barre, decodifica\u2026</string>
|
<string name="preferences_scanning_title">Durante la scansione di codici a barre, decodifica\u2026</string>
|
||||||
<string name="preferences_search_country">Cerca paese</string>
|
<string name="preferences_search_country">Cerca paese</string>
|
||||||
|
|
|
@ -119,6 +119,8 @@
|
||||||
<string name="preferences_play_beep_title">Beep</string>
|
<string name="preferences_play_beep_title">Beep</string>
|
||||||
<string name="preferences_remember_duplicates_summary">Store multiple scans of the same barcode in History</string>
|
<string name="preferences_remember_duplicates_summary">Store multiple scans of the same barcode in History</string>
|
||||||
<string name="preferences_remember_duplicates_title">Remember duplicates</string>
|
<string name="preferences_remember_duplicates_title">Remember duplicates</string>
|
||||||
|
<string name="preferences_history_summary">Store your scans in History</string>
|
||||||
|
<string name="preferences_history_title">Add to History</string>
|
||||||
<string name="preferences_result_title">Result settings</string>
|
<string name="preferences_result_title">Result settings</string>
|
||||||
<string name="preferences_scanning_title">When scanning for barcodes, decode\u2026</string>
|
<string name="preferences_scanning_title">When scanning for barcodes, decode\u2026</string>
|
||||||
<string name="preferences_search_country">Search country</string>
|
<string name="preferences_search_country">Search country</string>
|
||||||
|
|
|
@ -63,6 +63,11 @@
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:title="@string/preferences_remember_duplicates_title"
|
android:title="@string/preferences_remember_duplicates_title"
|
||||||
android:summary="@string/preferences_remember_duplicates_summary"/>
|
android:summary="@string/preferences_remember_duplicates_summary"/>
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="preferences_history"
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:title="@string/preferences_history_title"
|
||||||
|
android:summary="@string/preferences_history_summary"/>
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="preferences_supplemental"
|
android:key="preferences_supplemental"
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
|
|
|
@ -136,8 +136,6 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
setContentView(R.layout.capture);
|
setContentView(R.layout.capture);
|
||||||
|
|
||||||
hasSurface = false;
|
hasSurface = false;
|
||||||
historyManager = new HistoryManager(this);
|
|
||||||
historyManager.trimHistory();
|
|
||||||
inactivityTimer = new InactivityTimer(this);
|
inactivityTimer = new InactivityTimer(this);
|
||||||
beepManager = new BeepManager(this);
|
beepManager = new BeepManager(this);
|
||||||
ambientLightManager = new AmbientLightManager(this);
|
ambientLightManager = new AmbientLightManager(this);
|
||||||
|
@ -149,6 +147,10 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
|
// historyManager must be initialized here to update the history preference
|
||||||
|
historyManager = new HistoryManager(this);
|
||||||
|
historyManager.trimHistory();
|
||||||
|
|
||||||
// CameraManager must be initialized here, not in onCreate(). This is necessary because we don't
|
// CameraManager must be initialized here, not in onCreate(). This is necessary because we don't
|
||||||
// want to open the camera driver and measure the screen size if we're going to show the help on
|
// want to open the camera driver and measure the screen size if we're going to show the help on
|
||||||
// first launch. That led to bugs where the scanning rectangle was the wrong size and partially
|
// first launch. That led to bugs where the scanning rectangle was the wrong size and partially
|
||||||
|
@ -292,6 +294,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
ambientLightManager.stop();
|
ambientLightManager.stop();
|
||||||
beepManager.close();
|
beepManager.close();
|
||||||
cameraManager.closeDriver();
|
cameraManager.closeDriver();
|
||||||
|
historyManager = null;
|
||||||
if (!hasSurface) {
|
if (!hasSurface) {
|
||||||
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
|
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
|
||||||
SurfaceHolder surfaceHolder = surfaceView.getHolder();
|
SurfaceHolder surfaceHolder = surfaceView.getHolder();
|
||||||
|
|
|
@ -42,6 +42,7 @@ public final class PreferencesActivity extends Activity {
|
||||||
public static final String KEY_FRONT_LIGHT_MODE = "preferences_front_light_mode";
|
public static final String KEY_FRONT_LIGHT_MODE = "preferences_front_light_mode";
|
||||||
public static final String KEY_BULK_MODE = "preferences_bulk_mode";
|
public static final String KEY_BULK_MODE = "preferences_bulk_mode";
|
||||||
public static final String KEY_REMEMBER_DUPLICATES = "preferences_remember_duplicates";
|
public static final String KEY_REMEMBER_DUPLICATES = "preferences_remember_duplicates";
|
||||||
|
public static final String KEY_ENABLE_HISTORY = "preferences_history";
|
||||||
public static final String KEY_SUPPLEMENTAL = "preferences_supplemental";
|
public static final String KEY_SUPPLEMENTAL = "preferences_supplemental";
|
||||||
public static final String KEY_AUTO_FOCUS = "preferences_auto_focus";
|
public static final String KEY_AUTO_FOCUS = "preferences_auto_focus";
|
||||||
public static final String KEY_INVERT_SCAN = "preferences_invert_scan";
|
public static final String KEY_INVERT_SCAN = "preferences_invert_scan";
|
||||||
|
|
|
@ -69,9 +69,12 @@ public final class HistoryManager {
|
||||||
private static final String[] ID_DETAIL_COL_PROJECTION = { DBHelper.ID_COL, DBHelper.DETAILS_COL };
|
private static final String[] ID_DETAIL_COL_PROJECTION = { DBHelper.ID_COL, DBHelper.DETAILS_COL };
|
||||||
|
|
||||||
private final Activity activity;
|
private final Activity activity;
|
||||||
|
private final boolean enableHistory;
|
||||||
|
|
||||||
public HistoryManager(Activity activity) {
|
public HistoryManager(Activity activity) {
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||||
|
enableHistory = prefs.getBoolean(PreferencesActivity.KEY_ENABLE_HISTORY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasHistoryItems() {
|
public boolean hasHistoryItems() {
|
||||||
|
@ -152,7 +155,7 @@ public final class HistoryManager {
|
||||||
// Do not save this item to the history if the preference is turned off, or the contents are
|
// Do not save this item to the history if the preference is turned off, or the contents are
|
||||||
// considered secure.
|
// considered secure.
|
||||||
if (!activity.getIntent().getBooleanExtra(Intents.Scan.SAVE_HISTORY, true) ||
|
if (!activity.getIntent().getBooleanExtra(Intents.Scan.SAVE_HISTORY, true) ||
|
||||||
handler.areContentsSecure()) {
|
handler.areContentsSecure() || !enableHistory) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue