当前位置: 首页>>代码示例>>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;未经允许,请勿转载。