本文整理匯總了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();
}