本文整理了Java中com.zx.zxutils.views.CameraView.ZXCameraView
类的一些代码示例,展示了ZXCameraView
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZXCameraView
类的具体详情如下:
包路径:com.zx.zxutils.views.CameraView.ZXCameraView
类名称:ZXCameraView
暂无
代码示例来源:origin: StannyBing/ZXUtils
private void updateVideoViewSize(float videoWidth, float videoHeight) {
if (videoWidth > videoHeight) {
LayoutParams videoViewParam;
int height = (int) ((videoHeight / videoWidth) * getWidth());
videoViewParam = new LayoutParams(LayoutParams.MATCH_PARENT, height);
videoViewParam.gravity = Gravity.CENTER;
mVideoView.setLayoutParams(videoViewParam);
}
}
代码示例来源:origin: StannyBing/ZXUtils
public ZXCameraView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mContext = context;
//get AttributeSet
iconSize = ZXSystemUtil.dp2px(30);
iconMargin = ZXSystemUtil.dp2px(20);
iconSrc = R.drawable.ic_camera;
duration = 10 * 1000; //没设置默认为10s
initData();
initView();
}
代码示例来源:origin: StannyBing/ZXUtils
@Override
protected void onPause() {
super.onPause();
zxCameraView.onPause();
}
}
代码示例来源:origin: StannyBing/ZXUtils
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_camera);
zxCameraView = findViewById(R.id.jcamprieraview);
ZXStatusBarCompat.translucent(this);
//设置视频保存路径
zxCameraView.setSaveVideoPath(Environment.getExternalStorageDirectory().getPath() + File.separator + "JCamera")
.setCameraMode(ZXCameraView.BUTTON_STATE_ONLY_CAPTURE)
.setMediaQuality(ZXCameraView.MEDIA_QUALITY_MIDDLE)
.setMaxVedioDuration(30)
.showAlbumView(true)
.setCameraLisenter(new CameraListener() {
@Override
public void onCaptureCommit(Bitmap bitmap) {
int height = bitmap.getHeight();
ZXLogUtil.loge(height + "");
}
@Override
public void onRecordCommit(String url, Bitmap firstFrame) {
}
@Override
public void onActionSuccess(CameraType type) {
}
@Override
public void onError(ErrorType errorType) {
//打开Camera失败回调
}
});
}
代码示例来源:origin: StannyBing/ZXUtils
public void onPause() {
ZXLogUtil.logi("JCameraView onPause");
stopVideo();
resetState(TYPE_PICTURE);
CameraInterface.getInstance().isPreview(false);
CameraInterface.getInstance().unregisterSensorManager(mContext);
}
代码示例来源:origin: StannyBing/ZXUtils
@Override
public void recordShort(final long time) {
mCaptureLayout.setTextWithAnimation("录制时间过短");
mSwitchCamera.setVisibility(VISIBLE);
mFlashLamp.setVisibility(VISIBLE);
postDelayed(new Runnable() {
@Override
public void run() {
machine.stopRecord(true, time);
}
}, 1500 - time);
}
代码示例来源:origin: StannyBing/ZXUtils
@Override
protected void onResume() {
super.onResume();
zxCameraView.onResume();
}
代码示例来源:origin: StannyBing/ZXUtils
private void initData() {
layout_width = ZXScreenUtil.getScreenWidth();
//缩放梯度
zoomGradient = (int) (layout_width / 16f);
ZXLogUtil.logi("zoom = " + zoomGradient);
machine = new CameraMachine(getContext(), this, this);
}
代码示例来源:origin: StannyBing/ZXUtils
@Override
public void startPreviewCallback() {
ZXLogUtil.logi("startPreviewCallback");
handlerFoucs(mFoucsView.getWidth() / 2, mFoucsView.getHeight() / 2);
}
代码示例来源:origin: StannyBing/ZXUtils
public void onResume() {
ZXLogUtil.logi("JCameraView onResume");
resetState(TYPE_DEFAULT); //重置状态
CameraInterface.getInstance().registerSensorManager(mContext);
CameraInterface.getInstance().setSwitchView(mSwitchCamera, mFlashLamp);
machine.start(mVideoView.getHolder(), screenProp);
}
内容来源于网络,如有侵权,请联系作者删除!