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

Gravity #5

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

alexshikov
Copy link

@alexshikov alexshikov commented Jun 28, 2018

  • updated toolset (gradle version and SDK)
  • returned default Android constructors
  • introduced gravity attribute for CameraView
  • returned attributes loading from the xml

Details

My main goal to have an ability to center preview with fill or fit options.
gravity option doesn't depend on adjustViewBounds and seems they kind of used for different results. Ensure to set match_parent for CameraView for both width and height.

Centration code copied and adjusted from the RNCameraView.java so this might be a good reason to refactor RNCameraView and just use centerFit or centerFill option from the base class.

I had to revert attributes loading from the xml, that have been deleted and hardcoded mAdjustViewBounds = true. This might break the react-native component. If that's the case, we probably should just set default style to true rather then hardcode it in the code.

Further plans

I have more plans to improve the library, so it's just a first step to start a discussion on what I should be aware of to not break react-native component.

One of the next steps is to introduce an attribute to choose camera preview size for an available area using some strategy (ratio priority, size priority, etc.)

Another one is to support detectors (Barcode, Face, etc.).

Note: I'm going to use that library in Xamarin project, so I'll create bindings for the library and publish it to NuGet.

@alexshikov
Copy link
Author

I'm also thinking... because this is a fork, there is no way to create issues. And as the original repo is not supported, does it make sense to make a repo clone? Should we contact original repo owner if he doesn't mind?

@jgfidelis
Copy link
Collaborator

Hello @alexshikov , thanks, this looks nice!

If you are using react-native-camera, we've been using an internal CameraView: https://github.com/react-native-community/react-native-camera/tree/master/android/src/main/java/com/google/android/cameraview

Work on the cameraview of the RNCamera would be REALLY useful and help tons of people.

Send PR there if you want to impact more people!

Thanks!

@alexshikov
Copy link
Author

alexshikov commented Jun 29, 2018

@jgfidelis I'm not using react-native-camera and so far don't plans for. My goal is to create wrapper for this library for Xamarin.

Though, some features I need are actually implemented in RNCamera and it would make more sense to transfer them from the RNCamera to the CameraView.

I think having CameraView library independent from RNCamera is good idea.
I also think that CameraView should be a subtree rather than part of the react-native-camera repo react-native-camera/react-native-camera#1639

Copy link
Collaborator

@sibelius sibelius left a comment

Choose a reason for hiding this comment

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

this help some issues on layout and preview size

@alexshikov
Copy link
Author

@sibelius @jgfidelis what's the procedure of PR merge in?

I've another improvement coming https://github.com/alexshikov/cameraview/tree/choose_preview_size

The new changes find the best ratio to match available space (if gravity set to fit or fill)

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