*/
public boolean enablePanoOrientation;
+ /**
+ * Set true if manual exposure compensation should be visible.
+ *
+ * This option is not constrained by hardware limitations.
+ * For example, this is false in HDR+ mode.
+ */
public boolean enableExposureCompensation;
+ /**
+ * Set true if the device and module support exposure compensation.
+ * Used only to show exposure button in disabled (greyed out) state.
+ */
+ public boolean isExposureCompensationSupported;
+
/** Intent UI */
/**
public void onChangeCamera() {
ModuleController moduleController = mController.getCurrentModuleController();
applyModuleSpecs(moduleController.getHardwareSpec(), moduleController.getBottomBarSpec());
+ syncModeOptionIndicators();
+ }
+ /**
+ * Updates the mode option indicators according to the current settings.
+ */
+ public void syncModeOptionIndicators() {
if (mIndicatorIconController != null) {
// Sync the settings state with the indicator state.
mIndicatorIconController.syncIndicators();
mModuleUI = (FrameLayout) mCameraRootView.findViewById(R.id.module_layout);
mTextureView = (TextureView) mCameraRootView.findViewById(R.id.preview_content);
mTextureViewHelper = new TextureViewHelper(mTextureView, mCaptureLayoutHelper,
- mController.getCameraProvider());
+ mController.getCameraProvider(), mController);
mTextureViewHelper.setSurfaceTextureListener(this);
mTextureViewHelper.setOnLayoutChangeListener(mPreviewLayoutChangeListener);
if (mSuppressCaptureIndicator || mFilmstripLayout.getVisibility() == View.VISIBLE) {
return;
}
- mRoundedThumbnailView.setThumbnail(thumbnailBitmap);
- mRoundedThumbnailView.setRotation(rotation);
+ mRoundedThumbnailView.setThumbnail(thumbnailBitmap, rotation);
}
/**
applyModuleSpecs(moduleController.getHardwareSpec(),
moduleController.getBottomBarSpec());
mBottomBar.transitionToCapture();
- showModeOptions();
}
/**
applyModuleSpecs(moduleController.getHardwareSpec(),
moduleController.getBottomBarSpec());
mBottomBar.transitionToCancel();
- hideModeOptions();
}
/**
buttonManager.hideButton(ButtonManager.BUTTON_CAMERA);
}
- if (bottomBarSpec.hideFlash) {
+ if (bottomBarSpec.hideFlash || !hardwareSpec.isFlashSupported()) {
// Hide both flash and torch button in flash disable logic
buttonManager.hideButton(ButtonManager.BUTTON_FLASH);
buttonManager.hideButton(ButtonManager.BUTTON_TORCH);
} else {
- if (hardwareSpec.isFlashSupported()) {
- if (bottomBarSpec.enableFlash) {
- buttonManager.initializeButton(ButtonManager.BUTTON_FLASH,
- bottomBarSpec.flashCallback);
- } else if (bottomBarSpec.enableTorchFlash) {
- buttonManager.initializeButton(ButtonManager.BUTTON_TORCH,
- bottomBarSpec.flashCallback);
- } else if (bottomBarSpec.enableHdrPlusFlash) {
- buttonManager.initializeButton(ButtonManager.BUTTON_HDR_PLUS_FLASH,
- bottomBarSpec.flashCallback);
- } else {
- // Hide both flash and torch button in flash disable logic
- buttonManager.disableButton(ButtonManager.BUTTON_FLASH);
- buttonManager.disableButton(ButtonManager.BUTTON_TORCH);
- }
+ if (bottomBarSpec.enableFlash) {
+ buttonManager.initializeButton(ButtonManager.BUTTON_FLASH,
+ bottomBarSpec.flashCallback);
+ } else if (bottomBarSpec.enableTorchFlash) {
+ buttonManager.initializeButton(ButtonManager.BUTTON_TORCH,
+ bottomBarSpec.flashCallback);
+ } else if (bottomBarSpec.enableHdrPlusFlash) {
+ buttonManager.initializeButton(ButtonManager.BUTTON_HDR_PLUS_FLASH,
+ bottomBarSpec.flashCallback);
} else {
- // Disable both flash and torch icon if not supported
- // by the chosen camera hardware.
+ // Disable both flash and torch button in flash disable logic
buttonManager.disableButton(ButtonManager.BUTTON_FLASH);
buttonManager.disableButton(ButtonManager.BUTTON_TORCH);
}
buttonManager.hideButton(ButtonManager.BUTTON_HDR_PLUS);
} else {
if (hardwareSpec.isHdrPlusSupported()) {
- if (bottomBarSpec.enableHdr && Keys.isCameraBackFacing(settingsManager,
- mController.getModuleScope())) {
+ if (bottomBarSpec.enableHdr) {
buttonManager.initializeButton(ButtonManager.BUTTON_HDR_PLUS,
bottomBarSpec.hdrCallback);
} else {
buttonManager.disableButton(ButtonManager.BUTTON_HDR_PLUS);
}
} else if (hardwareSpec.isHdrSupported()) {
- if (bottomBarSpec.enableHdr && Keys.isCameraBackFacing(settingsManager,
- mController.getModuleScope())) {
+ if (bottomBarSpec.enableHdr) {
buttonManager.initializeButton(ButtonManager.BUTTON_HDR,
bottomBarSpec.hdrCallback);
} else {
buttonManager.initializePanoOrientationButtons(bottomBarSpec.panoOrientationCallback);
}
- boolean enableExposureCompensation = bottomBarSpec.enableExposureCompensation &&
- !(bottomBarSpec.minExposureCompensation == 0 && bottomBarSpec.maxExposureCompensation == 0) &&
- mController.getSettingsManager().getBoolean(SettingsManager.SCOPE_GLOBAL,
- Keys.KEY_EXPOSURE_COMPENSATION_ENABLED);
- if (enableExposureCompensation) {
+
+
+ // If manual exposure is enabled both in SettingsManager and
+ // BottomBarSpec,then show the exposure button.
+ // If manual exposure is disabled in the BottomBarSpec (eg. HDR+
+ // enabled), but the device/module has the feature, then disable the exposure
+ // button.
+ // Otherwise, hide the button.
+ if (bottomBarSpec.enableExposureCompensation
+ && !(bottomBarSpec.minExposureCompensation == 0 && bottomBarSpec.maxExposureCompensation == 0)
+ && mController.getSettingsManager().getBoolean(SettingsManager.SCOPE_GLOBAL,
+ Keys.KEY_EXPOSURE_COMPENSATION_ENABLED)) {
buttonManager.initializePushButton(ButtonManager.BUTTON_EXPOSURE_COMPENSATION,
new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- mModeOptionsOverlay.showExposureOptions();
- }
- });
+ @Override
+ public void onClick(View v) {
+ mModeOptionsOverlay.showExposureOptions();
+ }
+ });
buttonManager.setExposureCompensationParameters(
- bottomBarSpec.minExposureCompensation,
- bottomBarSpec.maxExposureCompensation,
- bottomBarSpec.exposureCompensationStep);
+ bottomBarSpec.minExposureCompensation,
+ bottomBarSpec.maxExposureCompensation,
+ bottomBarSpec.exposureCompensationStep);
buttonManager.setExposureCompensationCallback(
bottomBarSpec.exposureCompensationSetCallback);
buttonManager.updateExposureButtons();
+ } else if (mController.getSettingsManager().getBoolean(SettingsManager.SCOPE_GLOBAL,
+ Keys.KEY_EXPOSURE_COMPENSATION_ENABLED)
+ && bottomBarSpec.isExposureCompensationSupported) {
+ buttonManager.disableButton(ButtonManager.BUTTON_EXPOSURE_COMPENSATION);
} else {
buttonManager.hideButton(ButtonManager.BUTTON_EXPOSURE_COMPENSATION);
buttonManager.setExposureCompensationCallback(null);
public void hideFilmstrip() {
mFilmstripLayout.hideFilmstrip();
}
+
+ public int getFilmstripVisibility() {
+ return mFilmstripLayout.getVisibility();
+ }
}