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


Java CameraConfiguration.FLASH_MODE_OFF属性代码示例

本文整理汇总了Java中com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration.FLASH_MODE_OFF属性的典型用法代码示例。如果您正苦于以下问题:Java CameraConfiguration.FLASH_MODE_OFF属性的具体用法?Java CameraConfiguration.FLASH_MODE_OFF怎么用?Java CameraConfiguration.FLASH_MODE_OFF使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration的用法示例。


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

示例1: setFlashMode

private void setFlashMode(Camera camera, Camera.Parameters parameters, @CameraConfiguration.FlashMode int flashMode) {
    try {
        switch (flashMode) {
            case CameraConfiguration.FLASH_MODE_AUTO:
                parameters.setFlashMode(Camera.Parameters.FLASH_MODE_AUTO);
                break;
            case CameraConfiguration.FLASH_MODE_ON:
                parameters.setFlashMode(Camera.Parameters.FLASH_MODE_ON);
                break;
            case CameraConfiguration.FLASH_MODE_OFF:
                parameters.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
                break;
            default:
                parameters.setFlashMode(Camera.Parameters.FLASH_MODE_AUTO);
                break;
        }
        camera.setParameters(parameters);
    } catch (Exception ignore) {
    }
}
 
开发者ID:MartinRGB,项目名称:android_camera_experiment,代码行数:20,代码来源:Camera1Manager.java

示例2: onFlashModeChanged

@Override
public void onFlashModeChanged(@FlashSwitchView.FlashMode int mode) {
    switch (mode) {
        case FlashSwitchView.FLASH_AUTO:
            flashMode = CameraConfiguration.FLASH_MODE_AUTO;
            getCameraController().setFlashMode(CameraConfiguration.FLASH_MODE_AUTO);
            break;
        case FlashSwitchView.FLASH_ON:
            flashMode = CameraConfiguration.FLASH_MODE_ON;
            getCameraController().setFlashMode(CameraConfiguration.FLASH_MODE_ON);
            break;
        case FlashSwitchView.FLASH_OFF:
            flashMode = CameraConfiguration.FLASH_MODE_OFF;
            getCameraController().setFlashMode(CameraConfiguration.FLASH_MODE_OFF);
            break;
    }
}
 
开发者ID:MartinRGB,项目名称:android_camera_experiment,代码行数:17,代码来源:BaseSandriosActivity.java

示例3: getUserContentView

@Override
View getUserContentView(LayoutInflater layoutInflater, ViewGroup parent) {
    cameraControlPanel = (CameraControlPanel) layoutInflater.inflate(R.layout.user_control_layout, parent, false);

    if (cameraControlPanel != null) {
        cameraControlPanel.setup(getMediaAction());

        switch (flashMode) {
            case CameraConfiguration.FLASH_MODE_AUTO:
                cameraControlPanel.setFlasMode(FlashSwitchView.FLASH_AUTO);
                break;
            case CameraConfiguration.FLASH_MODE_ON:
                cameraControlPanel.setFlasMode(FlashSwitchView.FLASH_ON);
                break;
            case CameraConfiguration.FLASH_MODE_OFF:
                cameraControlPanel.setFlasMode(FlashSwitchView.FLASH_OFF);
                break;
        }

        cameraControlPanel.setRecordButtonListener(this);
        //cameraControlPanel.setFlashModeSwitchListener(this);
        cameraControlPanel.setOnMediaActionStateChangeListener(this);
        cameraControlPanel.setOnCameraTypeChangeListener(this);

        //时间
        cameraControlPanel.setMaxVideoDuration(getVideoDuration());
        //尺寸
        cameraControlPanel.setMaxVideoFileSize(getVideoFileSize());

        //cameraControlPanel.setSettingsClickListener(this);
        //cameraControlPanel.setPickerItemClickListener(this);
        cameraControlPanel.shouldShowCrop(enableImageCrop);
    }
    return cameraControlPanel;
}
 
开发者ID:MartinRGB,项目名称:android_camera_experiment,代码行数:35,代码来源:BaseSandriosActivity.java

示例4: setFlashModeAndBuildPreviewRequest

private void setFlashModeAndBuildPreviewRequest(@CameraConfiguration.FlashMode int flashMode) {
    try {

        switch (flashMode) {
            case CameraConfiguration.FLASH_MODE_AUTO:
                previewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
                previewRequestBuilder.set(CaptureRequest.FLASH_MODE, CameraMetadata.FLASH_MODE_SINGLE);
                break;
            case CameraConfiguration.FLASH_MODE_ON:
                previewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON);
                previewRequestBuilder.set(CaptureRequest.FLASH_MODE, CameraMetadata.FLASH_MODE_SINGLE);
                break;
            case CameraConfiguration.FLASH_MODE_OFF:
                previewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON);
                previewRequestBuilder.set(CaptureRequest.FLASH_MODE, CameraMetadata.FLASH_MODE_OFF);
                break;
            default:
                previewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
                previewRequestBuilder.set(CaptureRequest.FLASH_MODE, CameraMetadata.FLASH_MODE_SINGLE);
                break;
        }

        previewRequest = previewRequestBuilder.build();

        try {
            captureSession.setRepeatingRequest(previewRequest, captureCallback, backgroundHandler);
        } catch (Exception e) {
            Log.e(TAG, "Error updating preview: ", e);
        }
    } catch (Exception ignore) {
        Log.e(TAG, "Error setting flash: ", ignore);
    }
}
 
开发者ID:sandrios,项目名称:sandriosCamera,代码行数:33,代码来源:Camera2Manager.java

示例5: extractConfiguration

private void extractConfiguration(Bundle bundle) {
    if (bundle != null) {
        if (bundle.containsKey(CameraConfiguration.Arguments.REQUEST_CODE))
            requestCode = bundle.getInt(CameraConfiguration.Arguments.REQUEST_CODE);

        if (bundle.containsKey(CameraConfiguration.Arguments.MEDIA_ACTION)) {
            switch (bundle.getInt(CameraConfiguration.Arguments.MEDIA_ACTION)) {
                case CameraConfiguration.MEDIA_ACTION_PHOTO:
                    mediaAction = CameraConfiguration.MEDIA_ACTION_PHOTO;
                    break;
                case CameraConfiguration.MEDIA_ACTION_VIDEO:
                    mediaAction = CameraConfiguration.MEDIA_ACTION_VIDEO;
                    break;
                default:
                    mediaAction = CameraConfiguration.MEDIA_ACTION_BOTH;
                    break;
            }
        }

        if (bundle.containsKey(CameraConfiguration.Arguments.MEDIA_QUALITY)) {
            switch (bundle.getInt(CameraConfiguration.Arguments.MEDIA_QUALITY)) {
                case CameraConfiguration.MEDIA_QUALITY_AUTO:
                    mediaQuality = CameraConfiguration.MEDIA_QUALITY_AUTO;
                    break;
                case CameraConfiguration.MEDIA_QUALITY_HIGHEST:
                    mediaQuality = CameraConfiguration.MEDIA_QUALITY_HIGHEST;
                    break;
                case CameraConfiguration.MEDIA_QUALITY_HIGH:
                    mediaQuality = CameraConfiguration.MEDIA_QUALITY_HIGH;
                    break;
                case CameraConfiguration.MEDIA_QUALITY_MEDIUM:
                    mediaQuality = CameraConfiguration.MEDIA_QUALITY_MEDIUM;
                    break;
                case CameraConfiguration.MEDIA_QUALITY_LOW:
                    mediaQuality = CameraConfiguration.MEDIA_QUALITY_LOW;
                    break;
                case CameraConfiguration.MEDIA_QUALITY_LOWEST:
                    mediaQuality = CameraConfiguration.MEDIA_QUALITY_LOWEST;
                    break;
                default:
                    mediaQuality = CameraConfiguration.MEDIA_QUALITY_MEDIUM;
                    break;
            }
            passedMediaQuality = mediaQuality;
        }

        if (bundle.containsKey(CameraConfiguration.Arguments.VIDEO_DURATION))
            videoDuration = bundle.getInt(CameraConfiguration.Arguments.VIDEO_DURATION);

        if (bundle.containsKey(CameraConfiguration.Arguments.VIDEO_FILE_SIZE))
            videoFileSize = bundle.getLong(CameraConfiguration.Arguments.VIDEO_FILE_SIZE);

        if (bundle.containsKey(CameraConfiguration.Arguments.MINIMUM_VIDEO_DURATION))
            minimumVideoDuration = bundle.getInt(CameraConfiguration.Arguments.MINIMUM_VIDEO_DURATION);

        if (bundle.containsKey(CameraConfiguration.Arguments.SHOW_PICKER))
            showPicker = bundle.getBoolean(CameraConfiguration.Arguments.SHOW_PICKER);

        if (bundle.containsKey(CameraConfiguration.Arguments.ENABLE_CROP))
            enableImageCrop = bundle.getBoolean(CameraConfiguration.Arguments.ENABLE_CROP);

        if (bundle.containsKey(CameraConfiguration.Arguments.FLASH_MODE))
            switch (bundle.getInt(CameraConfiguration.Arguments.FLASH_MODE)) {
                case CameraConfiguration.FLASH_MODE_AUTO:
                    flashMode = CameraConfiguration.FLASH_MODE_AUTO;
                    break;
                case CameraConfiguration.FLASH_MODE_ON:
                    flashMode = CameraConfiguration.FLASH_MODE_ON;
                    break;
                case CameraConfiguration.FLASH_MODE_OFF:
                    flashMode = CameraConfiguration.FLASH_MODE_OFF;
                    break;
                default:
                    flashMode = CameraConfiguration.FLASH_MODE_AUTO;
                    break;
            }
    }
}
 
开发者ID:MartinRGB,项目名称:android_camera_experiment,代码行数:78,代码来源:BaseSandriosActivity.java

示例6: getUserContentView

@Override
View getUserContentView(LayoutInflater layoutInflater, ViewGroup parent) {
    cameraControlPanel = (CameraControlPanel) layoutInflater.inflate(R.layout.user_control_layout, parent, false);
    cameraControlPanel.postInit(type);

    if (cameraControlPanel != null) {
        cameraControlPanel.setup(getMediaAction());

        switch (flashMode) {
            case CameraConfiguration.FLASH_MODE_AUTO:
                cameraControlPanel.setFlasMode(FlashSwitchView.FLASH_AUTO);
                break;
            case CameraConfiguration.FLASH_MODE_ON:
                cameraControlPanel.setFlasMode(FlashSwitchView.FLASH_ON);
                break;
            case CameraConfiguration.FLASH_MODE_OFF:
                cameraControlPanel.setFlasMode(FlashSwitchView.FLASH_OFF);
                break;
        }

        cameraControlPanel.setRecordButtonListener(this);
        cameraControlPanel.setFlashModeSwitchListener(this);
        cameraControlPanel.setOnMediaActionStateChangeListener(this);
        cameraControlPanel.setOnCameraTypeChangeListener(this);
        cameraControlPanel.setMaxVideoDuration(getVideoDuration());
        cameraControlPanel.setMaxVideoFileSize(getVideoFileSize());
        cameraControlPanel.setSettingsClickListener(this);
        cameraControlPanel.setPickerItemClickListener(this);
        cameraControlPanel.shouldShowCrop(enableImageCrop);

        if (autoRecord) {
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    cameraControlPanel.startRecording();
                }
            }, 1500);
        }
    }
    return cameraControlPanel;
}
 
开发者ID:sandrios,项目名称:sandriosCamera,代码行数:41,代码来源:BaseSandriosActivity.java


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