Skip to content

Commit b49a53f

Browse files
update to 3.2.1000
1 parent a80c1ff commit b49a53f

5 files changed

Lines changed: 13 additions & 18 deletions

File tree

Android/DocumentScanner/DocumentScanner/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ android {
2727
}
2828

2929
dependencies {
30-
implementation "com.dynamsoft:capturevisionbundle:3.0.5000"
30+
implementation "com.dynamsoft:capturevisionbundle:3.2.1000"
3131

3232
implementation 'androidx.appcompat:appcompat:1.7.1'
3333
implementation 'com.google.android.material:material:1.11.0'

Android/VINScanner/app/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
/build
1+
/build
2+
/*.py

Android/VINScanner/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def getVersion(String productSimpleName, String defaultValue) {
3939
}
4040

4141
dependencies {
42-
implementation("com.dynamsoft:capturevisionbundle:3.0.5000")
42+
implementation("com.dynamsoft:capturevisionbundle:3.2.1000")
4343

4444
implementation 'androidx.activity:activity:1.10.1'
4545
implementation 'androidx.appcompat:appcompat:1.7.1'
Binary file not shown.

Android/VINScanner/app/src/main/java/com/dynamsoft/dcv/vinscanner/MainActivity.java

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import android.content.Intent;
44
import android.os.Bundle;
5-
import android.util.Log;
65
import android.widget.RadioButton;
76
import android.widget.RadioGroup;
87
import android.widget.TextView;
@@ -32,10 +31,6 @@
3231
import com.dynamsoft.utility.MultiFrameResultCrossFilter;
3332

3433
import java.util.Locale;
35-
import java.util.concurrent.ExecutorService;
36-
import java.util.concurrent.LinkedBlockingQueue;
37-
import java.util.concurrent.ThreadPoolExecutor;
38-
import java.util.concurrent.TimeUnit;
3934

4035
public class MainActivity extends AppCompatActivity {
4136
private static final String TEMPLATE_READ_VIN_BARCODE = "ReadVINBarcode";
@@ -44,8 +39,7 @@ public class MainActivity extends AppCompatActivity {
4439
private CameraEnhancer camera;
4540
private String parsedText;
4641
private String currentTemplate = TEMPLATE_READ_VIN_BARCODE;
47-
private final ExecutorService switchModeThread = new ThreadPoolExecutor(1, 1, 0, TimeUnit.MILLISECONDS,
48-
new LinkedBlockingQueue<>(1), new ThreadPoolExecutor.DiscardOldestPolicy());
42+
4943
@Override
5044
protected void onCreate(Bundle savedInstanceState) {
5145
super.onCreate(savedInstanceState);
@@ -160,10 +154,10 @@ private void initSwitchModeRadioGroup() {
160154
RadioButton btnBarcode = findViewById(R.id.btn_vin_barcode);
161155
RadioButton btnText = findViewById(R.id.btn_vin_text);
162156
((RadioGroup) findViewById(R.id.rg_modes)).setOnCheckedChangeListener((group, checkedId) -> {
163-
if(btnBarcode.isPressed()) {
157+
if (btnBarcode.isPressed()) {
164158
camera.disableEnhancedFeatures(EnumEnhancerFeatures.EF_FRAME_FILTER);
165159
currentTemplate = TEMPLATE_READ_VIN_BARCODE;
166-
} else if(btnText.isPressed()) {
160+
} else if (btnText.isPressed()) {
167161
try {
168162
camera.enableEnhancedFeatures(EnumEnhancerFeatures.EF_FRAME_FILTER);
169163
} catch (Exception e) {
@@ -173,12 +167,12 @@ private void initSwitchModeRadioGroup() {
173167
} else {
174168
return;
175169
}
176-
switchModeThread.submit(() -> {
177-
if (!this.isFinishing()) {
178-
router.stopCapturing();
179-
router.startCapturing(currentTemplate, null);
180-
}
181-
});
170+
try {
171+
router.switchCapturingTemplate(currentTemplate);
172+
} catch (CaptureVisionRouterException e) {
173+
// Throws an exception only when attempting to switch to an invalid template name.
174+
throw new RuntimeException(e);
175+
}
182176
});
183177
}
184178

0 commit comments

Comments
 (0)