當前位置: 首頁>>代碼示例>>Java>>正文


Java ScanResult類代碼示例

本文整理匯總了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();
        }
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:25,代碼來源:AndroidImplementation.java

示例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();
        }
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:27,代碼來源:AndroidImplementation.java

示例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();
        }
    }
}
 
開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:28,代碼來源:AndroidImplementation.java

示例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();
        }
    }
}
 
開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:35,代碼來源:AndroidImplementation.java

示例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();
    }
}
 
開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:38,代碼來源:AndroidImplementation.java

示例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();
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:38,代碼來源:AndroidImplementation.java

示例7: startScaningQRcode

import com.codename1.codescan.ScanResult; //導入依賴的package包/類
void startScaningQRcode(ScanResult callback) {
    type = QRCODE;
    startScaning(callback);
}
 
開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:5,代碼來源:BarCodeScanner.java

示例8: startScaningBarCode

import com.codename1.codescan.ScanResult; //導入依賴的package包/類
void startScaningBarCode(ScanResult callback) {
    type = BARCODE;
    startScaning(callback);
}
 
開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:5,代碼來源:BarCodeScanner.java

示例9: scanQRCode

import com.codename1.codescan.ScanResult; //導入依賴的package包/類
public void scanQRCode(ScanResult callback) {
    bs.startScaningQRcode(callback);
}
 
開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:4,代碼來源:CodeScannerImpl.java

示例10: scanBarCode

import com.codename1.codescan.ScanResult; //導入依賴的package包/類
public void scanBarCode(ScanResult callback) {
    bs.startScaningBarCode(callback);
}
 
開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:4,代碼來源:CodeScannerImpl.java

示例11: scanQRCode

import com.codename1.codescan.ScanResult; //導入依賴的package包/類
@Override
public void scanQRCode(ScanResult callback) {
    this.callback = callback;
    nativeInstance.scanQRCode();
}
 
開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:6,代碼來源:IOSImplementation.java

示例12: scanBarCode

import com.codename1.codescan.ScanResult; //導入依賴的package包/類
@Override
public void scanBarCode(ScanResult callback) {
    this.callback = callback;
    nativeInstance.scanBarCode();
}
 
開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:6,代碼來源:IOSImplementation.java

示例13: scanQRCode

import com.codename1.codescan.ScanResult; //導入依賴的package包/類
public void scanQRCode(ScanResult callback) {
    this.callback = callback;
    isQRScanning = true;
    startScan();
}
 
開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:6,代碼來源:CodeScannerImpl.java

示例14: scanBarCode

import com.codename1.codescan.ScanResult; //導入依賴的package包/類
public void scanBarCode(ScanResult callback) {
    this.callback = callback;
    isQRScanning = false;
    startScan();
}
 
開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:6,代碼來源:CodeScannerImpl.java


注:本文中的com.codename1.codescan.ScanResult類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。