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


Java TextureView.SurfaceTextureListener方法代码示例

本文整理汇总了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();
                        }
                    });
                }
            }
        }
    });
}
 
开发者ID:sandrios,项目名称:sandriosCamera,代码行数:35,代码来源:Camera2Manager.java

示例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);
}
 
开发者ID:CarGuo,项目名称:GSYVideoPlayer,代码行数:17,代码来源:GSYRenderView.java

示例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());
}
 
开发者ID:florent37,项目名称:CameraFragment,代码行数:7,代码来源:Camera2Controller.java

示例4: AutoFitTextureView

import android.view.TextureView; //导入方法依赖的package包/类
public AutoFitTextureView(Context context, TextureView.SurfaceTextureListener surfaceTextureListener) {
    super(context, null);
    setSurfaceTextureListener(surfaceTextureListener);
}
 
开发者ID:florent37,项目名称:CameraFragment,代码行数:5,代码来源:AutoFitTextureView.java

示例5: setTextureCallback

import android.view.TextureView; //导入方法依赖的package包/类
public void setTextureCallback(TextureView.SurfaceTextureListener callback) {
    if (mEffectView != null)
        mEffectView.setSurfaceTextureListener(callback);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:5,代码来源:SurfaceController.java

示例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());
}
 
开发者ID:sandrios,项目名称:sandriosCamera,代码行数:7,代码来源:Camera2Controller.java

示例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());
}
 
开发者ID:memfis19,项目名称:Annca,代码行数:7,代码来源:Camera2Controller.java

示例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) {
        }
    };
}
 
开发者ID:PGMacDesign,项目名称:PGMacTips,代码行数:49,代码来源:TakePhotoActivityAPI21.java

示例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) {
        }
    };
}
 
开发者ID:PGMacDesign,项目名称:PGMacTips,代码行数:60,代码来源:TakePhotoActivity.java

示例10: register

import android.view.TextureView; //导入方法依赖的package包/类
public void register(final TextureView.SurfaceTextureListener callback); 
开发者ID:saki4510t,项目名称:libcommon,代码行数:2,代码来源:ITextureView.java

示例11: unregister

import android.view.TextureView; //导入方法依赖的package包/类
public void unregister(final TextureView.SurfaceTextureListener callback); 
开发者ID:saki4510t,项目名称:libcommon,代码行数:2,代码来源:ITextureView.java


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