简体   繁体   English

阻止硬件相机的快门/拍摄按钮EK-GC200上的Samsung Galaxy Camera

[英]Block hardware camera shutter / capture button Samsung Galaxy Camera on EK-GC200

I want to use my own camera modul at the Samsung Galaxy Camera EK-GC200. 我想在Samsung Galaxy Camera EK-GC200上使用我自己的相机模块。 I can get a keycode for both buttons, but capture button always opens his own camera intent which then of course collapes with my own camera modul. 我可以同时获得两个按钮的键码,但是“捕获”按钮总是会打开他自己的摄像头意图,这当然会与我自己的摄像头模块发生冲突。 Also zoom buttons always show some slide-popup when used. 此外,缩放按钮在使用时始终会显示一些幻灯片弹出窗口。

Meanwhile I found some topics that some people were able to block the HOME button on their devices. 同时,我发现了一些人可以阻止其设备上的HOME按钮的主题。 But seems this is not usable for the camera buttons. 但这似乎不适用于相机按钮。

So is there any way to block the hardware buttons so at least the camera capture button doesn't open its own camera intent anymore ? 那么,有什么方法可以阻止硬件按钮,以便至少相机捕获按钮不再打开自己的相机意图?

In your MainActivity.java (or some other activity), paste the following: 在您的MainActivity.java (或其他活动)中,粘贴以下内容:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {

    Log.e(TAG, "keyCode: " + keyCode); // If you want to see the keycodes

    // If User hits the (physical) shutter button of the EK-GC200 camera
    if (KeyEvent.KEYCODE_FOCUS == keyCode || KeyEvent.KEYCODE_CAMERA == keyCode) {
        // Do nothing or start your own camera App
        return true;
    }

    return super.onKeyDown(keyCode, event);
}

If you also want to intercept the return button, do: 如果您还想拦截返回按钮,请执行以下操作:

if ((keyCode == KeyEvent.KEYCODE_BACK )) {
    // Upon return / back key:
    // Do NOT go to super.onKeyDown(keyCode, event);
    return true;
}

The HOME button can not be intercepted in this manner. 不能以这种方式拦截HOME按钮。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM