@@ -55,6 +55,7 @@ public final class BarcodeCaptureActivity extends Activity
55
55
public static final String FORMATS = "FORMATS" ;
56
56
public static final String MULTIPLE = "MULTIPLE" ;
57
57
public static final String WAIT_TAP = "WAIT_TAP" ;
58
+ public static final String SHOW_TEXT = "SHOW_TEXT" ;
58
59
59
60
public static final String BARCODE_OBJECT = "Barcode" ;
60
61
public static final String ERROR = "Error" ;
@@ -65,8 +66,11 @@ public final class BarcodeCaptureActivity extends Activity
65
66
66
67
private GestureDetector gestureDetector ;
67
68
69
+ private boolean autoFocus ;
70
+ private boolean useFlash ;
68
71
private boolean multiple ;
69
72
private boolean waitTap ;
73
+ private boolean showText ;
70
74
71
75
@ Override
72
76
public void onCreate (Bundle icicle ) {
@@ -82,15 +86,15 @@ public void onCreate(Bundle icicle) {
82
86
mPreview = findViewById (R .id .preview );
83
87
mGraphicOverlay = findViewById (R .id .graphic_overlay );
84
88
85
- boolean autoFocus = getIntent ().getBooleanExtra (AUTO_FOCUS , false );
86
- boolean useFlash = getIntent ().getBooleanExtra (USE_FLASH , false );
87
-
89
+ autoFocus = getIntent ().getBooleanExtra (AUTO_FOCUS , false );
90
+ useFlash = getIntent ().getBooleanExtra (USE_FLASH , false );
88
91
multiple = getIntent ().getBooleanExtra (MULTIPLE , false );
89
92
waitTap = getIntent ().getBooleanExtra (WAIT_TAP , false );
93
+ showText = getIntent ().getBooleanExtra (SHOW_TEXT , false );
90
94
91
95
int rc = ActivityCompat .checkSelfPermission (this , Manifest .permission .CAMERA );
92
96
if (rc == PackageManager .PERMISSION_GRANTED ) {
93
- createCameraSource (autoFocus , useFlash );
97
+ createCameraSource ();
94
98
} else {
95
99
throw new MobileVisionException ("Camera permission is needed." );
96
100
}
@@ -107,21 +111,22 @@ public boolean onSingleTapConfirmed(MotionEvent e) {
107
111
}
108
112
109
113
@ SuppressLint ("InlinedApi" )
110
- private void createCameraSource (boolean autoFocus , boolean useFlash ) throws MobileVisionException {
114
+ private void createCameraSource () throws MobileVisionException {
111
115
Context context = getApplicationContext ();
112
116
113
117
BarcodeDetector barcodeDetector = new BarcodeDetector .Builder (context )
114
118
.setBarcodeFormats (getIntent ().getIntExtra (FORMATS , Barcode .ALL_FORMATS ))
115
119
.build ();
116
120
117
- BarcodeTrackerFactory barcodeFactory = new BarcodeTrackerFactory (mGraphicOverlay , this );
121
+ BarcodeTrackerFactory barcodeFactory = new BarcodeTrackerFactory (mGraphicOverlay ,
122
+ this , showText );
118
123
119
124
barcodeDetector .setProcessor (
120
125
new MultiProcessor .Builder <>(barcodeFactory ).build ());
121
126
122
127
if (!barcodeDetector .isOperational ()) {
123
- IntentFilter lowstorageFilter = new IntentFilter (Intent .ACTION_DEVICE_STORAGE_LOW );
124
- boolean hasLowStorage = registerReceiver (null , lowstorageFilter ) != null ;
128
+ IntentFilter lowStorageFilter = new IntentFilter (Intent .ACTION_DEVICE_STORAGE_LOW );
129
+ boolean hasLowStorage = registerReceiver (null , lowStorageFilter ) != null ;
125
130
126
131
if (hasLowStorage ) {
127
132
throw new MobileVisionException ("Low Storage." );
0 commit comments