Skip to content

Commit

Permalink
Add an option to suppress the beep sound upon scan #8
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed Feb 3, 2017
1 parent 33a9eae commit 48ec8a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
private Result lastResult;
private boolean hasSurface;
private boolean copyToClipboard;
private boolean beepOnScan;
private IntentSource source;
private String sourceUrl;
private ScanFromWebPageManager scanFromWebPageManager;
Expand Down Expand Up @@ -227,6 +228,8 @@ protected void onResume() {
copyToClipboard = prefs.getBoolean(PreferencesActivity.KEY_COPY_TO_CLIPBOARD, true)
&& (intent == null || intent.getBooleanExtra(Intents.Scan.SAVE_HISTORY, true));

beepOnScan = (intent == null || intent.getBooleanExtra(Intents.Scan.BEEP_ON_SCAN, true));

source = IntentSource.NONE;
sourceUrl = null;
scanFromWebPageManager = null;
Expand Down Expand Up @@ -487,7 +490,9 @@ public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {
if (fromLiveScan) {
historyManager.addHistoryItem(rawResult, resultHandler);
// Then not from history, so beep/vibrate and we have an image to draw on
beepManager.playBeepSoundAndVibrate();
if (beepOnScan) {
beepManager.playBeepSoundAndVibrate();
}
drawResultPoints(barcode, scaleFactor, rawResult);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ public static final class Scan {
*/
public static final String TORCH_ON = "TORCH_ON";

/**
* Set to false if you want to suppress the beep when a code is scanned
*/
public static final String BEEP_ON_SCAN = "BEEP_ON_SCAN";

/**
* Set to true if you want to enable bulk scan mode
*/
Expand Down

0 comments on commit 48ec8a1

Please sign in to comment.