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

Added camera switch mode: Front/Back #97

Open
wants to merge 2 commits into
base: 2.x
Choose a base branch
from

Conversation

dimanych
Copy link

No description provided.

@Yazon2006
Copy link

Related issue #91.
@dimanych Thanks a lot!

@miguelbcr
Copy link
Owner

I'll handle it today
Thank you very much!

Copy link
Owner

@miguelbcr miguelbcr left a comment

Choose a reason for hiding this comment

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

@dimanych Thanks for your work!
I appreciate a lot your contribution 👏
Just I left some comments, let me know what do you think



### Camera mode
Switching camera for front or back. By default back set
Copy link
Owner

Choose a reason for hiding this comment

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

I'm not very good with English 😓 , but maybe this sentence is clearer, wdyt?

Switching the front or back camera. By default the back one is set

And what about adding a reminder to put this lines in the manifest?:

<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />

@@ -3,6 +3,8 @@
package="com.miguelbcr.ui.rx_paparazzo2.sample">

<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
Copy link
Owner

Choose a reason for hiding this comment

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

nice :)


BACK

}
Copy link
Owner

Choose a reason for hiding this comment

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

[nit] Maybe without spaces?

public enum CameraMode {
    FRONT,
    BACK
}

if (CameraMode.FRONT.equals(config.getCameraMode())) {
intent.putExtra("android.intent.extras.CAMERA_FACING", android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT);
intent.putExtra("android.intent.extras.LENS_FACING_FRONT", 1);
intent.putExtra("android.intent.extra.USE_FRONT_CAMERA", true);
Copy link
Owner

Choose a reason for hiding this comment

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

It seems that android.hardware.Camera.CameraInfo is deprecated from API 21 (Build.VERSION_CODES.LOLLIPOP) -> https://developer.android.com/reference/android/hardware/Camera.CameraInfo

Instead, suggests to use android.hardware.camera2. -> https://developer.android.com/reference/android/hardware/camera2/package-summary

I can see that LENS_FACING_FRONT was added from API 21:

I wonder if you have tested it in several android versions just to make sure it works, for instance, API 18, 21, 22, 27

I'll try it too...

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