• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CameraManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中zxing.camera.CameraManager的典型用法代码示例。如果您正苦于以下问题:Java CameraManager类的具体用法?Java CameraManager怎么用?Java CameraManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CameraManager类属于zxing.camera包,在下文中一共展示了CameraManager类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: CaptureActivityHandler

import zxing.camera.CameraManager; //导入依赖的package包/类
public CaptureActivityHandler(CaptureActivity activity,
                                 Collection<BarcodeFormat> decodeFormats, String characterSet,
                                 CameraManager cameraManager) {
	this.activity = activity;

	// 启动扫描线程
	decodeThread = new DecodeThread(activity, decodeFormats, characterSet,
			new ViewfinderResultPointCallback(activity.getViewfinderView()));
	decodeThread.start();

	state = State.SUCCESS;

	// Start ourselves capturing previews and decoding.
	this.cameraManager = cameraManager;

	// 开启相机预览界面
	cameraManager.startPreview();

	restartPreviewAndDecode();
}
 
开发者ID:dufangyu1990,项目名称:LeCatApp,代码行数:21,代码来源:CaptureActivityHandler.java


示例2: initView

import zxing.camera.CameraManager; //导入依赖的package包/类
public void initView(){
	CameraManager.init(this);
	viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view);
	hasSurface = false;
	inactivityTimer = new InactivityTimer(this);
	surfaceView = (SurfaceView) findViewById(R.id.preview_view);
	rlScanFailed = (RelativeLayout) findViewById(R.id.rlScanFailed);
	rlScanFailed.setOnClickListener(this);
	rlScanFailed.setVisibility(View.GONE);
	ibClose = (ImageButton) findViewById(R.id.ibClose);
	ibLignt=(ImageButton)findViewById(R.id.ibLignt);
	ibPhoto=(ImageButton)findViewById(R.id.ibPhoto);
	ibClose.setOnClickListener(this);
	ibLignt.setOnClickListener(this);
	ibPhoto.setOnClickListener(this);
	ibClose.setOnClickListener(this);
}
 
开发者ID:bangqu,项目名称:eshow-android,代码行数:18,代码来源:ScanActivity.java


示例3: onCreate

import zxing.camera.CameraManager; //导入依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.zxing_layout);
	
	btnCancel=(Button) findViewById(R.id.btn_cancel);
	ivReturn=(ImageView) findViewById(R.id.iv_return);
	OnClickListener myClick=new OnClickListener() {
		@Override
		public void onClick(View arg0) {
			CaptureActivity.this.finish();
		}
	};
	btnCancel.setOnClickListener(myClick);
	ivReturn.setOnClickListener(myClick);
	
	CameraManager.init(getApplication());
	viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view);
	hasSurface = false;
	inactivityTimer = new InactivityTimer(this);
}
 
开发者ID:gizwits,项目名称:Gizwits-WaterHeater_Android,代码行数:23,代码来源:CaptureActivity.java


示例4: initComponent

import zxing.camera.CameraManager; //导入依赖的package包/类
/**
 * 初始化功能组件
 */
private void initComponent() {
    hasSurface = false;
    inactivityTimer = new InactivityTimer(this);
    beepManager = new BeepManager(this);
    mSharedPreferences = PreferenceManager
            .getDefaultSharedPreferences(this);
    currentState = this.mSharedPreferences.getString("currentState","onecode");
    cameraManager = new CameraManager(getApplication());
}
 
开发者ID:dufangyu1990,项目名称:LeCatApp,代码行数:13,代码来源:CaptureActivity.java


示例5: onResume

import zxing.camera.CameraManager; //导入依赖的package包/类
@Override
public void onResume() {
	super.onResume();

	// CameraManager must be initialized here, not in onCreate(). This is
	// necessary because we don't
	// want to open the camera driver and measure the screen size if we're
	// going to show the help on
	// first launch. That led to bugs where the scanning rectangle was the
	// wrong size and partially
	// off screen.
	cameraManager = new CameraManager(getApplication());

	handler = null;

	if (isHasSurface) {
		// The activity was paused but not stopped, so the surface still
		// exists. Therefore
		// surfaceCreated() won't be called, so init the camera here.
		initCamera(scanPreview.getHolder());
	} else {
		// Install the callback and wait for surfaceCreated() to init the
		// camera.
		scanPreview.getHolder().addCallback(this);
	}

	inactivityTimer.onResume();
}
 
开发者ID:gizwits,项目名称:GOpenSource_AppKit_Android_AS,代码行数:29,代码来源:CaptureActivity.java


示例6: CaptureActivityHandler

import zxing.camera.CameraManager; //导入依赖的package包/类
public CaptureActivityHandler(CaptureActivity activity, CameraManager cameraManager, int decodeMode) {
	this.activity = activity;
	decodeThread = new DecodeThread(activity, decodeMode);
	decodeThread.start();
	state = State.SUCCESS;

	// Start ourselves capturing previews and decoding.
	this.cameraManager = cameraManager;
	cameraManager.startPreview();
	restartPreviewAndDecode();
}
 
开发者ID:gizwits,项目名称:GOpenSource_AppKit_Android_AS,代码行数:12,代码来源:CaptureActivityHandler.java


示例7: CaptureActivityHandler

import zxing.camera.CameraManager; //导入依赖的package包/类
public CaptureActivityHandler(cn.org.eshow.demo.activity.ScanActivity activity, Vector<BarcodeFormat> decodeFormats,String characterSet) {
  this.activity = activity;
  decodeThread = new zxing.decoding.DecodeThread(activity, decodeFormats, characterSet,new ViewfinderResultPointCallback(activity.getViewfinderView()));
  decodeThread.start();
  state = State.SUCCESS;
  // Start ourselves capturing previews and decoding.
  CameraManager.get().startPreview();
  restartPreviewAndDecode();
}
 
开发者ID:bangqu,项目名称:eshow-android,代码行数:10,代码来源:CaptureActivityHandler.java


示例8: quitSynchronously

import zxing.camera.CameraManager; //导入依赖的package包/类
public void quitSynchronously() {
  state = State.DONE;
  CameraManager.get().stopPreview();
  Message quit = Message.obtain(decodeThread.getHandler(), R.id.quit);
  quit.sendToTarget();
  try {
    decodeThread.join();
  } catch (InterruptedException e) {
    // continue
  }

  // Be absolutely sure we don't send any queued up messages
  removeMessages(R.id.decode_succeeded);
  removeMessages(R.id.decode_failed);
}
 
开发者ID:bangqu,项目名称:eshow-android,代码行数:16,代码来源:CaptureActivityHandler.java


示例9: restartPreviewAndDecode

import zxing.camera.CameraManager; //导入依赖的package包/类
private void restartPreviewAndDecode() {
  if (state == State.SUCCESS) {
    state = State.PREVIEW;
    CameraManager.get().requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
    CameraManager.get().requestAutoFocus(this, R.id.auto_focus);
    activity.drawViewfinder();
  }
}
 
开发者ID:bangqu,项目名称:eshow-android,代码行数:9,代码来源:CaptureActivityHandler.java


示例10: onClick

import zxing.camera.CameraManager; //导入依赖的package包/类
@Override
public void onClick(View v) {
	switch (v.getId()){
		case R.id.ibLignt:
			try {
				CameraManager.get().camera.cancelAutoFocus();
				parameters = CameraManager.get().camera.getParameters();
				if(parameters.getFlashMode().equals(Parameters.FLASH_MODE_TORCH)){
					parameters.setFlashMode(Parameters.FLASH_MODE_OFF);
					ibLignt.setBackgroundResource(R.drawable.ic_light_close);

				}else{
					parameters.setFlashMode(Parameters.FLASH_MODE_TORCH);
					ibLignt.setBackgroundResource(R.drawable.ic_light_open);
				}
				CameraManager.get().camera.setParameters(parameters);
				CameraManager.get().camera.autoFocus(CameraManager.get().autoFocusCallback);
			} catch (Exception e) {
				AbToastUtil.showToast(context, "设备故障");
			}
			break;
		case R.id.ibPhoto:
			//打开手机中的相册
			Intent innerIntent = new Intent(Intent.ACTION_GET_CONTENT); //"android.intent.action.GET_CONTENT"
			innerIntent.setType("image/*");
			Intent wrapperIntent = Intent.createChooser(innerIntent, "选择二维码图片");
			this.startActivityForResult(wrapperIntent, REQUEST_CODE);
			break;
		case R.id.ibClose:
			finish();
			break;
		case R.id.rlScanFailed:
			onResume();

			rlScanFailed.setVisibility(View.GONE);
			break;
	}

}
 
开发者ID:bangqu,项目名称:eshow-android,代码行数:40,代码来源:ScanActivity.java


示例11: initCamera

import zxing.camera.CameraManager; //导入依赖的package包/类
/** 以下是扫描 相关代码 */

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);
	}
}
 
开发者ID:bangqu,项目名称:eshow-android,代码行数:15,代码来源:ScanActivity.java


示例12: onPause

import zxing.camera.CameraManager; //导入依赖的package包/类
@Override
protected void onPause() {
	super.onPause();
	if (handler != null) {
		handler.quitSynchronously();
		handler = null;
	}
	CameraManager.get().closeDriver();
}
 
开发者ID:bangqu,项目名称:eshow-android,代码行数:10,代码来源:ScanActivity.java


示例13: onPause

import zxing.camera.CameraManager; //导入依赖的package包/类
@Override
public void onPause() {
	super.onPause();
	if (handler != null) {
		handler.quitSynchronously();
		handler = null;
	}
	CameraManager.get().closeDriver();
}
 
开发者ID:gizwits,项目名称:Gizwits-WaterHeater_Android,代码行数:10,代码来源:CaptureActivity.java


示例14: initCamera

import zxing.camera.CameraManager; //导入依赖的package包/类
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);
	}
}
 
开发者ID:gizwits,项目名称:Gizwits-WaterHeater_Android,代码行数:14,代码来源:CaptureActivity.java


示例15: CaptureActivityHandler

import zxing.camera.CameraManager; //导入依赖的package包/类
public CaptureActivityHandler(CaptureActivity activity, Vector<BarcodeFormat> decodeFormats,
    String characterSet) {
  this.activity = activity;
  decodeThread = new DecodeThread(activity, decodeFormats, characterSet,
      new ViewfinderResultPointCallback(activity.getViewfinderView()));
  decodeThread.start();
  state = State.SUCCESS;

  // Start ourselves capturing previews and decoding.
  CameraManager.get().startPreview();
  restartPreviewAndDecode();
}
 
开发者ID:gizwits,项目名称:Gizwits-WaterHeater_Android,代码行数:13,代码来源:CaptureActivityHandler.java


示例16: setCameraManager

import zxing.camera.CameraManager; //导入依赖的package包/类
public void setCameraManager(CameraManager cameraManager) {
	this.cameraManager = cameraManager;
}
 
开发者ID:dufangyu1990,项目名称:LeCatApp,代码行数:4,代码来源:ViewfinderView.java


示例17: getCameraManager

import zxing.camera.CameraManager; //导入依赖的package包/类
public CameraManager getCameraManager() {
    return cameraManager;
}
 
开发者ID:dufangyu1990,项目名称:LeCatApp,代码行数:4,代码来源:CaptureActivity.java


示例18: getCameraManager

import zxing.camera.CameraManager; //导入依赖的package包/类
public CameraManager getCameraManager() {
	return cameraManager;
}
 
开发者ID:gizwits,项目名称:GOpenSource_AppKit_Android_AS,代码行数:4,代码来源:CaptureActivity.java


示例19: handleMessage

import zxing.camera.CameraManager; //导入依赖的package包/类
@Override
public void handleMessage(Message message) {
  switch (message.what) {
    case R.id.auto_focus:
      //Log.d(TAG, "Got auto-focus message");
      // When one auto focus pass finishes, start another. This is the closest thing to
      // continuous AF. It does seem to hunt a bit, but I'm not sure what else to do.
      if (state == State.PREVIEW) {
        CameraManager.get().requestAutoFocus(this, R.id.auto_focus);
      }
      break;
    case R.id.restart_preview:
      Log.d(TAG, "Got restart preview message");
      restartPreviewAndDecode();
      break;
    case R.id.decode_succeeded:
      Log.d(TAG, "Got decode succeeded message");
      state = State.SUCCESS;
      Bundle bundle = message.getData();

      /***********************************************************************/
      Bitmap barcode = bundle == null ? null :
          (Bitmap) bundle.getParcelable(zxing.decoding.DecodeThread.BARCODE_BITMAP);//
      
      activity.handleDecode((Result) message.obj, barcode);//   /***********************************************************************/
      break;
    case R.id.decode_failed:
      // We're decoding as fast as possible, so when one decode fails, start another.
      state = State.PREVIEW;
      CameraManager.get().requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
      break;
    case R.id.return_scan_result:
      Log.d(TAG, "Got return scan result message");
      activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
      activity.finish();
      break;
    case R.id.launch_product_query:
      Log.d(TAG, "Got product query message");
      String url = (String) message.obj;
      Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
      intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
      activity.startActivity(intent);
      break;
  }
}
 
开发者ID:bangqu,项目名称:eshow-android,代码行数:46,代码来源:CaptureActivityHandler.java



注:本文中的zxing.camera.CameraManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OutputChannels类代码示例发布时间:2022-05-22
下一篇:
Java CommunicationException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap