GithubHelp home page GithubHelp logo

haoyingkai / dimenscodetools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bobxie/dimenscodetools

0.0 1.0 0.0 2.54 MB

A library which be used to product barcode,qrcode and scaning.

Java 100.00%

dimenscodetools's Introduction

DimensCodeTools

一个可以支持生成二维码,条形码和扫描的库 SAMPLE:

调用示例可以直接看app包下的SAMPLE.

图片录制的不是很清楚,将就下看哈.

enter image description here

USAGE:

  • DimensCodeTools 调用扫描的工具

开启扫描界面

DimensCodeTools.startScan(this);
// 开启扫描条形码
// DimensCodeTools.startScanWithFeature(this, ScanParams.BARCODE_FEATURES);
// 开启扫描条形码 指定所有参数
// DimensCodeTools.startScan(this, ScanParams.BARCODE_FEATURES, 500, 250, 500,
// 500);
// 指定条行码扫描大小
// DimensCodeTools.starScanWithBarSize(this, 500, 250);
// 指定二维码扫描大小
// DimensCodeTools.starScanWithQRSize(this, 500, 500);

解析返回

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	super.onActivityResult(requestCode, resultCode, data);
	String res = DimensCodeTools.scanForResult(requestCode, resultCode, data);
	if (res !=null) {
		Pattern p = Pattern.compile("[0-9]*");
		Matcher m = p.matcher(res);
		if (m.matches()) {
			super.startActivity(new Intent(Intent.ACTION_VIEW, Uri
					.parse("http://www.upcdatabase.com/item/" + res))); // 7
		}else{
			Toast.makeText(this, res, Toast.LENGTH_LONG).show();
		}
	}
}
  • BarCodeFactory 产生条形码的工厂

    Bitmap bitmap = BarCodeFactory.createBarCode(this, content, 500, 250, true, format);

  • QRCodeFactory 产生二维码的工厂

    Bitmap bmp = QRCodeFactory.createQRCode("Yo~ 切克闹", 200, 200, true);

  • ScanHelper 扫描(可以直接通过图片返回结果) Fun: Result scanningBarCode(Bitmap bitmap) Fun: Result scanningQRCode(Bitmap bitmap)

  • CaptureActivity 扫描的Activity

More and more 看demo

THANKS:

  • zxing

dimenscodetools's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.