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

View File

@ -29,6 +29,8 @@ public class RockChipAdapter implements Adapter {
private Context context; private Context context;
public static final String[] barcode = {""};
@Override @Override
public void start() { public void start() {
strategy.executeStrategy(resultListener); strategy.executeStrategy(resultListener);
@ -76,11 +78,21 @@ public class RockChipAdapter implements Adapter {
@Override @Override
public void executeStrategy(ResultListener resultListener) { public void executeStrategy(ResultListener resultListener) {
running = true;
new Thread(() -> { new Thread(() -> {
while (running) { while (running) {
String data = data(); String data = data();
if (!data.equals("")) { 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(); }).start();
@ -88,8 +100,8 @@ public class RockChipAdapter implements Adapter {
@Override @Override
public void exclusiveStrategy() { public void exclusiveStrategy() {
running = false; // running = false;
close(); // close();
} }
private String data() { private String data() {

View File

@ -5,7 +5,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { 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 // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // 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 distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip