二维码在哪里 采样二维码在哪里( 三 )

  
super.onCreate(savedInstanceState);  
setContentView(R.layout.activity_main);  
Log.i(TAG, "obColor version = " + VERSION);  
m_versionInt = Build.VERSION.SDK_INT;  
mWm = (WindowManager) getSystemService(WINDOW_SERVICE);  
DisplayMetrics dm = new DisplayMetrics();  
mWm.getDefaultDisplay().getMetrics(dm);  
try {  
m_xc = new AstraContext(this, m_callbacks);  
GlobalDef.USE_UVC = m_xc.IsUVC();  
if (GlobalDef.USE_UVC) {  
Log.i(TAG, "Astra Pro * Detected!");  
} else {  
Log.i(TAG, "Astra * Detected!");  
}  
} catch (Exception e) {  
// TODO Auto-generated catch block  
e.printStackTrace();  
}  
registerHomeListener();  
}  
private void initUVCCamera() {  
// LiveStreamProcessor processor = new LiveStreamProcessor();  
int previewWidth = processor.getSupportPreviewWidth();  
int previewHeight = processor.getSupportPreviewHeight();  
Log.i(TAG, "previewWidth = " + previewWidth);  

二维码在哪里 采样二维码在哪里
  
文章插图  
Log.i(TAG, "previewHeight = " + previewHeight);  
liveCamera = new LiveCamera();  
int rc = liveCamera.init(GlobalDef.RES_UVC_WIDTH,  
GlobalDef.RES_UVC_HEIGHT, 30, processor, processor.getBuffer());  
if (rc < 0) {  
dialog();  
return;  
}  
mSvPreview = new SurfaceView(this);  
mSurfaceHolder = mSvPreview.getHolder();  
mSurfaceHolder.addCallback(this);  
createDisplayView();  
}  
private void createDisplayView() {  
// Log.e(TAG, "createView");  
WindowManager.LayoutParams wmParams = new WindowManager.LayoutParams();  
wmParams.type = WindowManager.LayoutParams.TYPE_PHONE;  
wmParams.format = PixelFormat.RGBA_8888;  
wmParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;  
wmParams.gravity = Gravity.RIGHT | Gravity.TOP;  
wmParams.width = PREVIEW_WIDTH;  
wmParams.height = PREVIEW_HEIGHT;  
Log.d(TAG, "top color width = " + wmParams.width);  
Log.d(TAG, "top color height = " + wmParams.height);  
mWm.addView(mSvPreview, wmParams);  
mSvPreview.measure(View.MeasureSpec.makeMeasureSpec(0,  
View.MeasureSpec.UNSPECIFIED), View.MeasureSpec  
.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));  
}  
@Override  
protected void onPause() {  
Log.w(TAG, "Activity onPause");  
super.onPause();  
}  
@Override  
protected void onResume() {  
super.onResume();  
}  
protected void onDestroy() {  
if (mHomeListener != null) {  
mHomeListener.stopWatch();  
}  
if (m_rgbdata != null) {  
m_rgbdata.Close();  
}  
if (mDepthData != null) {  
mDepthData.Close();  
}  
if (liveCamera != null) {  
Log.d(TAG, "liveCamera.terminate()!!!");  
liveCamera.terminate();  
}  
if (m_xc != null) {  
m_xc.Close();  
}  
unRegisterHomeListener();  
Log.i(TAG, "Activity onDestroy !");  
System.exit(0);  
super.onDestroy();  
}  
@Override  
public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3) {  
// Log.e(TAG, "surfaceChanged");  
}  
@Override  
public void surfaceCreated(SurfaceHolder arg0) {  
Log.e(TAG, "surfaceCreated");  
if (GlobalDef.USE_UVC) {  
liveCamera.setPreviewDisplay(mSurfaceHolder);  
}  
}  
@Override  
public void surfaceDestroyed(SurfaceHolder arg0) {  
// Log.e(TAG, "surfaceDestroyed");  
}  
public class ColorView extends SurfaceView implements Callback, Runnable {  
private SurfaceHolder m_holder;  
private Canvas m_canvas;  
private Paint m_paint;  
Thread m_surfaceThread;  
public ColorView(Context context) {  
super(context);  
m_holder = this.getHolder();  
m_holder.addCallback(this);  
m_paint = new Paint();  
m_paint.setColor(Color.WHITE);  
LinearLayout.LayoutParams layParams = new LinearLayout.LayoutParams(


特别声明:本站内容均来自网友提供或互联网,仅供参考,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。