|
|
@ -1,5 +1,12 @@ |
|
|
package cn.bnyer.scancode; |
|
|
package cn.bnyer.scancode; |
|
|
|
|
|
|
|
|
|
|
|
import android.content.Intent; |
|
|
|
|
|
|
|
|
|
|
|
import com.google.mlkit.vision.barcode.BarcodeScannerOptions; |
|
|
|
|
|
import com.google.mlkit.vision.barcode.common.Barcode; |
|
|
|
|
|
import com.xiaoguang.widget.mlkitscanner.ScanManager; |
|
|
|
|
|
import com.xiaoguang.widget.mlkitscanner.callback.act.ScanCallback; |
|
|
|
|
|
|
|
|
import org.json.JSONException; |
|
|
import org.json.JSONException; |
|
|
import org.json.JSONObject; |
|
|
import org.json.JSONObject; |
|
|
|
|
|
|
|
|
@ -9,7 +16,7 @@ import io.dcloud.feature.uniapp.common.UniModule; |
|
|
|
|
|
|
|
|
public class scanCode extends UniModule { |
|
|
public class scanCode extends UniModule { |
|
|
|
|
|
|
|
|
@UniJSMethod |
|
|
@UniJSMethod(uiThread = false) |
|
|
public void add(JSONObject json, UniJSCallback callback) throws JSONException { |
|
|
public void add(JSONObject json, UniJSCallback callback) throws JSONException { |
|
|
final int a = json.getInt("a"); |
|
|
final int a = json.getInt("a"); |
|
|
final int b = json.getInt("b"); |
|
|
final int b = json.getInt("b"); |
|
|
@ -20,4 +27,22 @@ public class scanCode extends UniModule { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@UniJSMethod(uiThread = false) |
|
|
|
|
|
public void scanCode(){ |
|
|
|
|
|
BarcodeScannerOptions options = new BarcodeScannerOptions.Builder() |
|
|
|
|
|
.setBarcodeFormats( |
|
|
|
|
|
Barcode.FORMAT_QR_CODE, |
|
|
|
|
|
Barcode.FORMAT_AZTEC) |
|
|
|
|
|
.build(); |
|
|
|
|
|
// ScanManager manager = new ScanManager();
|
|
|
|
|
|
// manager.startScan(this, new ScanCallback() {
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onActivityResult(int i, Intent intent) {
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|