完整閱讀軟件客戶端app,本項目裏面還有掃描功能,搜索本地書籍,不過掃碼功能經過c++層實現的。
本項目來自:https://github.com/JayFang1993/ScanBook
CaptureActivity主要是攝像頭相關類,CaptureActivityHandler全部掃描消息都發到這個Handler類中
部分代碼以下:
private void initCamera(SurfaceHolder surfaceHolder) {
try {
CameraManager.get().openDriver(surfaceHolder);
} catch (IOException ioe) {
return;
} catch (RuntimeException e) {
return;
}
if (handler == null) {
handler = new CaptureActivityHandler(this, decodeFormats,characterSet);
}
}html
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {c++
}git
public void surfaceCreated(SurfaceHolder holder) {
if (!hasSurface) {
hasSurface = true;
initCamera(holder);
}github
}app
public void surfaceDestroyed(SurfaceHolder holder) {
hasSurface = false;this
}spa
源碼下載:http://www.itlanbao.com/code/20151103/10000/100609.htmlcode