当前位置: 首页>>代码示例>>Java>>正文


Java CameraManager类代码示例

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


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

示例1: onCreate

import com.zxing.camera.CameraManager; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
       requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
	setContentView(R.layout.camera);
       getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
               R.layout.titlebar);   
       
	CameraManager.init(this);
	
	viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view);
	txtResult = (TextView) findViewById(R.id.txtResult);
	hasSurface = false;
	inactivityTimer = new InactivityTimer(this);
	
       btn_back=(Button)findViewById(R.id.titlebar_bt_back);
       btn_back.setVisibility(View.VISIBLE);    
       
       btn_back.setOnClickListener(new OnClickListener() {
		public void onClick(View v) {
			Intent intent1=new Intent(CaptureActivity.this,MainActivity.class);
			startActivity(intent1);
			finish();
		}
	});
}
 
开发者ID:letourfrance,项目名称:RadarLibrary,代码行数:27,代码来源:CaptureActivity.java

示例2: quitSynchronously

import com.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.return_scan_result);
  removeMessages(R.id.decode_failed);
}
 
开发者ID:letourfrance,项目名称:RadarLibrary,代码行数:17,代码来源:CaptureActivityHandler.java

示例3: onCreate

import com.zxing.camera.CameraManager; //导入依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_capture);
	CameraManager.init(getApplication());
	viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view);

	hasSurface = false;
	inactivityTimer = new InactivityTimer(this);

	openlights= (TextView) findViewById(R.id.open_lights);
	openlights.setOnClickListener(this);
	findViewById(R.id.btn_back_qrcode).setOnClickListener(this);
	findViewById(R.id.btn_album).setOnClickListener(this);
}
 
开发者ID:cxbiao,项目名称:Android_Study_Demos,代码行数:17,代码来源:CaptureActivity.java

示例4: onCreate

import com.zxing.camera.CameraManager; //导入依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_capture);
	// ViewUtil.addTopView(getApplicationContext(), this, R.string.scan_card);
	CameraManager.init(getApplication());
	viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view);
	Button mButtonBack = (Button) findViewById(R.id.button_back);
	mButtonBack.setOnClickListener(new OnClickListener() {
		@Override
		public void onClick(View v) {
			onBackPressed();
		}
	});
	hasSurface = false;
	inactivityTimer = new InactivityTimer(this);
}
 
开发者ID:hanks-zyh,项目名称:QRcode-scanning,代码行数:19,代码来源:MipcaActivityCapture.java

示例5: init

import com.zxing.camera.CameraManager; //导入依赖的package包/类
/**初始化,必须在setContentView之后
 * @param context
 * @param viewfinderView
 */
protected void init(Activity context, SurfaceView surfaceView, ViewfinderView viewfinderView) {
	this.context = context;
	this.surfaceView = surfaceView;
	this.viewfinderView = viewfinderView;

	CameraManager.init(getApplication());

	hasSurface = false;
	inactivityTimer = new InactivityTimer(this);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:CaptureActivity.java

示例6: switchLight

import com.zxing.camera.CameraManager; //导入依赖的package包/类
/**打开或关闭闪关灯
 * @param open
 */
protected void switchLight(boolean on) {
	if (on == isOn()) {
		return;
	}
	isOn = CameraManager.get().switchLight(on);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:CaptureActivity.java

示例7: onPause

import com.zxing.camera.CameraManager; //导入依赖的package包/类
@Override
protected void onPause() {
	super.onPause();
	if (handler != null) {
		handler.quitSynchronously();
		handler = null;
	}
	isOn = false;
	CameraManager.get().closeDriver();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:CaptureActivity.java

示例8: CaptureActivityHandler

import com.zxing.camera.CameraManager; //导入依赖的package包/类
public CaptureActivityHandler(CaptureActivity activity, Vector<BarcodeFormat> decodeFormats,
		String characterSet, ViewfinderView viewfinderView, DecodeCallback decodeCallback) {
	this.activity = activity;
	this.decodeCallback = decodeCallback;
	
	decodeThread = new DecodeThread(activity, decodeFormats, characterSet,
			new ViewfinderResultPointCallback(viewfinderView));
	decodeThread.start();
	state = State.SUCCESS;
	// Start ourselves capturing previews and decoding.
	CameraManager.get().startPreview();
	restartPreviewAndDecode();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:CaptureActivityHandler.java

示例9: handleMessage

import com.zxing.camera.CameraManager; //导入依赖的package包/类
@Override
public void handleMessage(Message message) {
	if (message.what == 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);
		}
	}else if (message.what == R.id.restart_preview) {
		Log.d(TAG, "Got restart preview message");
		restartPreviewAndDecode();
	}else if (message.what == 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(DecodeThread.BARCODE_BITMAP);//���ñ����߳�

		decodeCallback.handleDecode((Result) message.obj, barcode);//���ؽ��
		/***********************************************************************/
	}else if (message.what == 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);
	}else if (message.what == R.id.return_scan_result) {
		Log.d(TAG, "Got return scan result message");
		activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
		activity.finish();
	}else if (message.what == 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);
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:40,代码来源:CaptureActivityHandler.java

示例10: quitSynchronously

import com.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:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:CaptureActivityHandler.java

示例11: restartPreviewAndDecode

import com.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);
		decodeCallback.drawViewfinder();
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:CaptureActivityHandler.java

示例12: onPause

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

示例13: CaptureActivityHandler

import com.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:letourfrance,项目名称:RadarLibrary,代码行数:13,代码来源:CaptureActivityHandler.java

示例14: restartPreviewAndDecode

import com.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:letourfrance,项目名称:RadarLibrary,代码行数:9,代码来源:CaptureActivityHandler.java


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