Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kim/stabilization UI logic #94

Merged
merged 23 commits into from
Jan 31, 2024

Conversation

Kimblebee
Copy link
Collaborator

@Kimblebee Kimblebee commented Jan 12, 2024

changes for stabilization setting PR , i thought that it may be better to just put it into a separate PR for visibility of the changes.

here are the big changes to come of it:

  • CameraXCameraUseCase sets preview/video stabilization support information to datastore
  • cameraAppSettings condenses datastore stabilization support info to an enum to make it easier to use around the app
  • disables stabilization setting if unsupported by device
  • disables On option if preview stabilization is unavailable
  • disables High Qualityoption if video stabilization is unavailable
  • disables entire setting if neither preview nor video stabilization is supported
  • display an icon to preview screen when stabilization is active
image image

* split preview and video support into separate booleans
* cameraAppSettings represents stabilization support as FULL, VIDEO_ONLY, and UNSUPPORTED
* updated color of disabled UI
* small preview refactor to better organize components

* convert preview overlay layer to a relative/grid layout style
)
)
if (previewUiState.currentCameraSettings.supportedStabilizationMode !=
SupportedStabilizationMode.UNSUPPORTED &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be the case that if the current stabilization mode is UNSUPPORTED then the stabilization mode can't be set to ON? If so, then we can get rid of the check for UNSUPPORTED, we should just go with whatever the stabilization mode is set to.

Spacer(modifier = Modifier.height(10.dp))

// on selector
SingleChoiceSelector(
text = stringResource(id = R.string.stabilization_selector_on),
secondaryText = stringResource(id = R.string.stabilization_selector_on_info),
enabled = supportedStabilizationMode == SupportedStabilizationMode.FULL,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to do something similar for the "high quality selector" below?

Copy link
Collaborator Author

@Kimblebee Kimblebee Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary for the UI's current implementation. if the device can't support video stabilization at all, then the popup won't be able to open in the first place. the whole button itself would be greyed out and unclickable.
image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't video stabilization and preview stabilization mutually exclusive?

If preview stabilization is supported, but video stabilization isn't, then you should be able to choose between ON and OFF.

Alternatively if preview stabilization isn't supported but video stabilization is, you should be able to select between HIGH_QUALITY and OFF.

Copy link
Collaborator Author

@Kimblebee Kimblebee Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats true, I assumed if the output feed couldn't be stabilized, the user may not want to bother with stabilization settings. I think to avoid confusion with ON meaning: "preview and video" OR "preview only if video isn't supported", I could add an extra option/enum PREVIEW_ONLY. It can be a hidden option only displayed when the device doesn't support video.

The setting would only be completely disabled if neither preview nor video were supported.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could add an extra option/enum PREVIEW_ONLY. It can be a hidden option only displayed when the device doesn't support video.

I think there's still some confusion here about preview stabilization. Preview stabilization means that Preview AND Video will be stabilized (it's WYSIWYG, hence why we call it "ON"). You don't need to enable video stabilization to stabilize the video, the preview stabilization will be sufficient to stabilize both. When you enable both preview and video stabilization at the same time, the preview stabilization takes precedence and stabilizes both, and the video stabilization setting on the VideoCapture use case will be ignored, hence why its ok to set it to UNSPECIFIED. There shouldn't be a PREVIEW_ONLY setting since preview stabilization will always apply a (lower quality) stabilization to the video.

The setting would only be completely disabled if neither preview nor video were supported.

That is the correct behavior. It means it's not possible to stabilize Preview AND Video with preview stabilization. It's also not possible to get high quality video stabilization with just video stabilization.

* preview-only setting option/enum
* stabilization icon descriptions based on current stabilization setting
* adjust setting selections for preview/video stabilization depending on mode
* Fix issue where UiAutomator cannot find components

* spotless
@Kimblebee Kimblebee merged commit a3d3d66 into kim/stabilization_setting Jan 31, 2024
4 checks passed
@Kimblebee Kimblebee deleted the kim/stabilization_ui_logic branch January 31, 2024 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants