修改eclipse项目为as项目

This commit is contained in:
2020-11-10 01:45:14 +08:00
commit b2c8455a6c
217 changed files with 25818 additions and 0 deletions

View File

@ -0,0 +1,72 @@
package com.cr5w.scan;
import android.app.Instrumentation;
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
public class CR5WScanControl {
private boolean isRun = true;
private boolean isOpen = true;
public boolean getIsOpen() {
return this.isOpen;
}
public void setIsOpen(boolean isOpen) {
this.isOpen = isOpen;
}
public void init(final Context context) {
new Thread() {
public void run() {
try {
while (true) {
if (isRun && 1 == ScanHelper.getScanModel(context)) {
Instrumentation inst = new Instrumentation();
Log.v("cr5w-SetScanHeader", "scan: send key begin");
inst.sendKeyDownUpSync(220);
inst.sendKeyDownUpSync(221);
Log.v("cr5w-SetScanHeader", "scan: send key end");
}
sleep(500);
}
// init(context);
} catch (Exception e) {
e.printStackTrace();
}
}
}.start();
}
public void start(Context context) {
if (!this.isOpen)
return;
Log.v("cr5w-SetScanHeader", "scan: start begin");
ScanHelper.setScanSwitchLeft(context, true);
ScanHelper.setScanSwitchRight(context, true);
Log.v("cr5w-SetScanHeader", "scan: start end");
if (!isRun) {
isRun = true;
}
}
public void stop(Context context) {
Log.v("cr5w-SetScanHeader", "scan: stop begin");
ScanHelper.setScanSwitchLeft(context, false);
ScanHelper.setScanSwitchRight(context, false);
Log.v("cr5w-SetScanHeader", "scan: stop end");
isRun = false;
}
public void restart(Context context) {
stop(context);
start(context);
}
public void clear() {
isRun = false;
}
}