本文整理汇总了Java中com.codename1.codescan.ScanResult类的典型用法代码示例。如果您正苦于以下问题:Java ScanResult类的具体用法?Java ScanResult怎么用?Java ScanResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScanResult类属于com.codename1.codescan包,在下文中一共展示了ScanResult类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scanQRCode
import com.codename1.codescan.ScanResult; //导入依赖的package包/类
@Override
public void scanQRCode(ScanResult callback) {
if (activity instanceof CodenameOneActivity) {
((CodenameOneActivity) activity).setIntentResultListener(this);
}
this.callback = callback;
IntentIntegrator in = new IntentIntegrator(activity);
if(!in.initiateScan(IntentIntegrator.QR_CODE_TYPES, "QR_CODE_MODE")){
// restore old activity handling
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
if(CodeScannerImpl.this != null && CodeScannerImpl.this.callback != null) {
CodeScannerImpl.this.callback.scanError(-1, "no scan app");
CodeScannerImpl.this.callback = null;
}
}
});
if (activity instanceof CodenameOneActivity) {
((CodenameOneActivity) activity).restoreIntentResultListener();
}
}
}
示例2: scanBarCode
import com.codename1.codescan.ScanResult; //导入依赖的package包/类
@Override
public void scanBarCode(ScanResult callback) {
if (activity instanceof CodenameOneActivity) {
((CodenameOneActivity) activity).setIntentResultListener(this);
}
this.callback = callback;
IntentIntegrator in = new IntentIntegrator(activity);
Collection<String> types = IntentIntegrator.PRODUCT_CODE_TYPES;
if(Display.getInstance().getProperty("scanAllCodeTypes", "false").equals("true")) {
types = IntentIntegrator.ALL_CODE_TYPES;
}
if(!in.initiateScan(types, "ONE_D_MODE")){
// restore old activity handling
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
CodeScannerImpl.this.callback.scanError(-1, "no scan app");
CodeScannerImpl.this.callback = null;
}
});
if (activity instanceof CodenameOneActivity) {
((CodenameOneActivity) activity).restoreIntentResultListener();
}
}
}
示例3: scanQRCode
import com.codename1.codescan.ScanResult; //导入依赖的package包/类
@Override
public void scanQRCode(ScanResult callback) {
if (getActivity() == null) {
return;
}
if (getActivity() instanceof CodenameOneActivity) {
((CodenameOneActivity) getActivity()).setIntentResultListener(this);
}
this.callback = callback;
IntentIntegrator in = new IntentIntegrator(getActivity());
if(!in.initiateScan(IntentIntegrator.QR_CODE_TYPES, "QR_CODE_MODE")){
// restore old activity handling
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
if(CodeScannerImpl.this != null && CodeScannerImpl.this.callback != null) {
CodeScannerImpl.this.callback.scanError(-1, "no scan app");
CodeScannerImpl.this.callback = null;
}
}
});
if (getActivity() instanceof CodenameOneActivity) {
((CodenameOneActivity) getActivity()).restoreIntentResultListener();
}
}
}
示例4: scanBarCode
import com.codename1.codescan.ScanResult; //导入依赖的package包/类
@Override
public void scanBarCode(ScanResult callback) {
if (getActivity() == null) {
return;
}
if (getActivity() instanceof CodenameOneActivity) {
((CodenameOneActivity) getActivity()).setIntentResultListener(this);
}
this.callback = callback;
IntentIntegrator in = new IntentIntegrator(getActivity());
Collection<String> types = IntentIntegrator.PRODUCT_CODE_TYPES;
if(Display.getInstance().getProperty("scanAllCodeTypes", "false").equals("true")) {
types = IntentIntegrator.ALL_CODE_TYPES;
}
if(Display.getInstance().getProperty("android.scanTypes", null) != null) {
String[] arr = Display.getInstance().getProperty("android.scanTypes", null).split(";");
types = Arrays.asList(arr);
}
if(!in.initiateScan(types, "ONE_D_MODE")){
// restore old activity handling
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
CodeScannerImpl.this.callback.scanError(-1, "no scan app");
CodeScannerImpl.this.callback = null;
}
});
if (getActivity() instanceof CodenameOneActivity) {
((CodenameOneActivity) getActivity()).restoreIntentResultListener();
}
}
}
示例5: onActivityResult
import com.codename1.codescan.ScanResult; //导入依赖的package包/类
public void onActivityResult(int requestCode, final int resultCode, Intent data) {
if (requestCode == IntentIntegrator.REQUEST_CODE && callback != null) {
final ScanResult sr = callback;
if (resultCode == Activity.RESULT_OK) {
final String contents = data.getStringExtra("SCAN_RESULT");
final String formatName = data.getStringExtra("SCAN_RESULT_FORMAT");
final byte[] rawBytes = data.getByteArrayExtra("SCAN_RESULT_BYTES");
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
sr.scanCompleted(contents, formatName, rawBytes);
}
});
} else if(resultCode == Activity.RESULT_CANCELED) {
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
sr.scanCanceled();
}
});
} else {
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
sr.scanError(resultCode, null);
}
});
}
callback = null;
}
// restore old activity handling
if (getActivity() instanceof CodenameOneActivity) {
((CodenameOneActivity) getActivity()).restoreIntentResultListener();
}
}
示例6: onActivityResult
import com.codename1.codescan.ScanResult; //导入依赖的package包/类
public void onActivityResult(int requestCode, final int resultCode, Intent data) {
if (requestCode == IntentIntegrator.REQUEST_CODE && callback != null) {
final ScanResult sr = callback;
if (resultCode == Activity.RESULT_OK) {
final String contents = data.getStringExtra("SCAN_RESULT");
final String formatName = data.getStringExtra("SCAN_RESULT_FORMAT");
final byte[] rawBytes = data.getByteArrayExtra("SCAN_RESULT_BYTES");
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
sr.scanCompleted(contents, formatName, rawBytes);
}
});
} else if(resultCode == Activity.RESULT_CANCELED) {
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
sr.scanCanceled();
}
});
} else {
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
sr.scanError(resultCode, null);
}
});
}
callback = null;
}
// restore old activity handling
if (activity instanceof CodenameOneActivity) {
((CodenameOneActivity) activity).restoreIntentResultListener();
}
}
示例7: startScaningQRcode
import com.codename1.codescan.ScanResult; //导入依赖的package包/类
void startScaningQRcode(ScanResult callback) {
type = QRCODE;
startScaning(callback);
}
示例8: startScaningBarCode
import com.codename1.codescan.ScanResult; //导入依赖的package包/类
void startScaningBarCode(ScanResult callback) {
type = BARCODE;
startScaning(callback);
}
示例9: scanQRCode
import com.codename1.codescan.ScanResult; //导入依赖的package包/类
public void scanQRCode(ScanResult callback) {
bs.startScaningQRcode(callback);
}
示例10: scanBarCode
import com.codename1.codescan.ScanResult; //导入依赖的package包/类
public void scanBarCode(ScanResult callback) {
bs.startScaningBarCode(callback);
}
示例11: scanQRCode
import com.codename1.codescan.ScanResult; //导入依赖的package包/类
@Override
public void scanQRCode(ScanResult callback) {
this.callback = callback;
nativeInstance.scanQRCode();
}
示例12: scanBarCode
import com.codename1.codescan.ScanResult; //导入依赖的package包/类
@Override
public void scanBarCode(ScanResult callback) {
this.callback = callback;
nativeInstance.scanBarCode();
}
示例13: scanQRCode
import com.codename1.codescan.ScanResult; //导入依赖的package包/类
public void scanQRCode(ScanResult callback) {
this.callback = callback;
isQRScanning = true;
startScan();
}
示例14: scanBarCode
import com.codename1.codescan.ScanResult; //导入依赖的package包/类
public void scanBarCode(ScanResult callback) {
this.callback = callback;
isQRScanning = false;
startScan();
}