natario1 / CameraView

📸 A well documented, high-level Android interface that makes capturing pictures and videos easy, addressing all of the common issues and needs. Real-time filters, gestures, watermarks, frame processing, RAW, output of any size.
https://natario1.github.io/CameraView
Other
4.96k stars 938 forks source link

Add volume up/down buttons in the Gesture system #293

Open Rupeshrajsingh opened 6 years ago

Rupeshrajsingh commented 6 years ago

if i want to take picture by volume UP or volume Down button, so what i do..?

natario1 commented 6 years ago

Try asking on StackOverflow!

JeremeLau commented 6 years ago

Just set a onKeyDown listener and listen 2 KeyEvent.KEYCODE_VOLUME_DOWN or KeyEvent.KEYCODE_VOLUME_UP, then do the TAKEPICTURE action

natario1 commented 5 years ago

I think it would be cool if the library listened to these two and treated them as a Gesture so you can assign GestureActions.

MoustafaElsaghier commented 5 years ago

you can override method onKeyDown() in your activity and use it like that

@Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if(keyCode ==  KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP){
            // capture image code here (        mCameraView.takePictureSnapshot();)
        }
        return super.onKeyDown(keyCode, event);;
    }
SweetD3v commented 1 year ago

Working on that. Will create a pull request when done.