瑞星平板扫描,线程读取一半就返回处理,回滚gradle版本和Java版本

This commit is contained in:
wujie
2023-11-01 13:11:56 +08:00
parent 483cce8fd5
commit 17a0889e08
4 changed files with 25 additions and 12 deletions

View File

@ -3,15 +3,15 @@ plugins {
}
android {
compileSdk 31
buildToolsVersion '33.0.0'
compileSdk 30
buildToolsVersion '30.0.3'
defaultConfig {
applicationId "chaoran.business.pda"
minSdk 28
targetSdk 28
versionCode 1
versionName "1.5"
versionName "1.6"
// 1.0 IDATA广播模式处理
// 1.1 霍尼韦尔的监听修改扫描网站二维码跳出程序监听失效调整、斑马PDA广播模式设置
@ -19,6 +19,7 @@ android {
// 1.3 东集 pda的支持
// 1.4 联新 pda的支持 已经 adapter 关闭的判断
// 1.5 urovo DT50 Lite pda的支持
// 1.6 瑞星平板扫描,线程读取一半就返回处理
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@ -58,8 +59,8 @@ android {
//编译选项
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
/* repositories {
flatDir {

View File

@ -29,6 +29,8 @@ public class RockChipAdapter implements Adapter {
private Context context;
public static final String[] barcode = {""};
@Override
public void start() {
strategy.executeStrategy(resultListener);
@ -76,11 +78,21 @@ public class RockChipAdapter implements Adapter {
@Override
public void executeStrategy(ResultListener resultListener) {
running = true;
new Thread(() -> {
while (running) {
String data = data();
if (!data.equals("")) {
resultListener.result(data);
barcode[0] = barcode[0] + data;
try {
Thread.sleep(20);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if (!"".equals(barcode[0])) {
resultListener.result(barcode[0]);
barcode[0] = "";
}
}
}).start();
@ -88,8 +100,8 @@ public class RockChipAdapter implements Adapter {
@Override
public void exclusiveStrategy() {
running = false;
close();
// running = false;
// close();
}
private String data() {

View File

@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath 'com.android.tools.build:gradle:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@ -1,6 +1,6 @@
#Tue Jun 13 09:53:56 CST 2023
#Mon Feb 01 13:41:10 CST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip