CameraView icon indicating copy to clipboard operation
CameraView copied to clipboard

Add volume up/down buttons in the Gesture system

Open Rupeshrajsingh opened this issue 7 years ago • 5 comments

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

Rupeshrajsingh avatar Oct 19 '18 08:10 Rupeshrajsingh

Try asking on StackOverflow!

natario1 avatar Oct 19 '18 20:10 natario1

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

JeremeLau avatar Oct 23 '18 07:10 JeremeLau

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

natario1 avatar Dec 16 '18 15:12 natario1

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);;
    }

MoustafaElsaghier avatar Sep 10 '19 15:09 MoustafaElsaghier

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

SweetD3v avatar Jul 06 '23 06:07 SweetD3v