本文整理汇总了Java中android.view.TextureView.SurfaceTextureListener方法的典型用法代码示例。如果您正苦于以下问题:Java TextureView.SurfaceTextureListener方法的具体用法?Java TextureView.SurfaceTextureListener怎么用?Java TextureView.SurfaceTextureListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.TextureView
的用法示例。
在下文中一共展示了TextureView.SurfaceTextureListener方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openCamera
import android.view.TextureView; //导入方法依赖的package包/类
@Override
public void openCamera(String cameraId, final CameraOpenListener<String, TextureView.SurfaceTextureListener> cameraOpenListener) {
this.currentCameraId = cameraId;
this.cameraOpenListener = cameraOpenListener;
backgroundHandler.post(new Runnable() {
@Override
public void run() {
if (context == null || configurationProvider == null) {
if (cameraOpenListener != null) {
uiHandler.post(new Runnable() {
@Override
public void run() {
cameraOpenListener.onCameraOpenError();
}
});
}
return;
}
prepareCameraOutputs();
try {
manager.openCamera(currentCameraId, stateCallback, backgroundHandler);
} catch (Exception e) {
if (cameraOpenListener != null) {
uiHandler.post(new Runnable() {
@Override
public void run() {
cameraOpenListener.onCameraOpenError();
}
});
}
}
}
});
}
示例2: addTextureView
import android.view.TextureView; //导入方法依赖的package包/类
/**
* 添加播放的view
*/
public void addTextureView(Context context, ViewGroup textureViewContainer, int rotate, TextureView.SurfaceTextureListener listener) {
if (textureViewContainer.getChildCount() > 0) {
textureViewContainer.removeAllViews();
}
GSYTextureView gsyTextureView = new GSYTextureView(context);
gsyTextureView.setSurfaceTextureListener(listener);
gsyTextureView.setRotation(rotate);
mShowView = gsyTextureView;
addToParent(textureViewContainer, gsyTextureView);
}
示例3: onCameraOpened
import android.view.TextureView; //导入方法依赖的package包/类
@Override
public void onCameraOpened(String openedCameraId, Size previewSize, TextureView.SurfaceTextureListener surfaceTextureListener) {
cameraView.updateUiForMediaAction(Configuration.MEDIA_ACTION_UNSPECIFIED);
cameraView.updateCameraPreview(previewSize, new AutoFitTextureView(context, surfaceTextureListener));
cameraView.updateCameraSwitcher(camera2Manager.getNumberOfCameras());
}
示例4: AutoFitTextureView
import android.view.TextureView; //导入方法依赖的package包/类
public AutoFitTextureView(Context context, TextureView.SurfaceTextureListener surfaceTextureListener) {
super(context, null);
setSurfaceTextureListener(surfaceTextureListener);
}
示例5: setTextureCallback
import android.view.TextureView; //导入方法依赖的package包/类
public void setTextureCallback(TextureView.SurfaceTextureListener callback) {
if (mEffectView != null)
mEffectView.setSurfaceTextureListener(callback);
}
示例6: onCameraOpened
import android.view.TextureView; //导入方法依赖的package包/类
@Override
public void onCameraOpened(String openedCameraId, Size previewSize, TextureView.SurfaceTextureListener surfaceTextureListener) {
cameraView.updateUiForMediaAction(CameraConfiguration.MEDIA_ACTION_BOTH);
cameraView.updateCameraPreview(previewSize, new AutoFitTextureView(cameraView.getActivity(), surfaceTextureListener));
cameraView.updateCameraSwitcher(camera2Manager.getNumberOfCameras());
}
示例7: onCameraOpened
import android.view.TextureView; //导入方法依赖的package包/类
@Override
public void onCameraOpened(String openedCameraId, Size previewSize, TextureView.SurfaceTextureListener surfaceTextureListener) {
cameraView.updateUiForMediaAction(AnncaConfiguration.MEDIA_ACTION_UNSPECIFIED);
cameraView.updateCameraPreview(previewSize, new AutoFitTextureView(cameraView.getActivity(), surfaceTextureListener));
cameraView.updateCameraSwitcher(camera2Manager.getNumberOfCameras());
}
示例8: initVariables
import android.view.TextureView; //导入方法依赖的package包/类
/**
* Init any Misc variables
*/
private void initVariables(){
okToTake = true;
//Check current API level. Should be only 21+ here
if(!SystemUtilities.userHasMarshmallowOrHigher()){
L.toast(this, "Your phone does not support this feature");
this.finish();
}
//Check camera feature (people have phones without cameras?)
if(!this.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)){
L.toast(this, "Your phone does not support this feature");
this.finish();
}
//Check camera permissions
PermissionUtilities perm = PermissionUtilities.getInstance(this);
if(!perm.startPermissionsRequest(PermissionUtilities.permissionsEnum.CAMERA)){
//No permissions given
L.toast(this, "You must enable camera permissions to use this feature");
this.finish();
}
textureListener = new TextureView.SurfaceTextureListener() {
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
//open your camera here
postAMessage(AlertMessages.INITIAL);
openCamera();
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
// Transform you image captured size according to the surface width and height
}
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
return false;
}
@Override
public void onSurfaceTextureUpdated(SurfaceTexture surface) {
}
};
}
示例9: initVariables
import android.view.TextureView; //导入方法依赖的package包/类
/**
* Init any Misc variables
*/
private void initVariables(){
okToTake = true;
displayOrientation = 0;
//Check current API level. Should be only 20 or lower here
if(SystemUtilities.userHasMarshmallowOrHigher()){
// TODO: 9/20/2016 re-enable this once pre-activity is set
//L.toast(this, "Your phone does not support this feature");
//this.finish();
}
//Check camera feature (people have phones without cameras?)
if(!this.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)){
L.toast(this, "Your phone does not support this feature");
this.finish();
}
//Check camera permissions
PermissionUtilities perm = PermissionUtilities.getInstance(this);
if(!perm.startPermissionsRequest(PermissionUtilities.permissionsEnum.CAMERA)){
//No permissions given
L.toast(this, "You must enable camera permissions to use this feature");
this.finish();
}
textureListener = new TextureView.SurfaceTextureListener() {
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
//open your camera here
//TakePhotoActivity.this.texture = texture;
postAMessage(AlertMessages.INITIAL);
setupCamera();
camera.startPreview();
try {
//mCameraSource.start();
} catch (Exception e){
e.printStackTrace();
}
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
// Transform you image captured size according to the texture width and height
}
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
camera.stopPreview();
camera.release();
return true;
}
@Override
public void onSurfaceTextureUpdated(SurfaceTexture surface) {
}
};
}
示例10: register
import android.view.TextureView; //导入方法依赖的package包/类
public void register(final TextureView.SurfaceTextureListener callback);
示例11: unregister
import android.view.TextureView; //导入方法依赖的package包/类
public void unregister(final TextureView.SurfaceTextureListener callback);