You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Joe Bowser (Updated) (JIRA)" <ji...@apache.org> on 2012/04/03 01:35:23 UTC

[jira] [Updated] (CB-417) D-pad events not firing in Google TV

     [ https://issues.apache.org/jira/browse/CB-417?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joe Bowser updated CB-417:
--------------------------

    Priority: Minor  (was: Major)

I tested it on this and, and I saw that all the Google TV apps that use Cordova do the same thing you're doing more or less.  Unfortunately, your solution is the only one that I've seen that works so far.  I'm thinking that this should be made into plugin code at some point, but due to the lack of Google TV devices out there, I'm going to have to put this at low priority, since there is a work-around.
                
> D-pad events not firing in Google TV
> ------------------------------------
>
>                 Key: CB-417
>                 URL: https://issues.apache.org/jira/browse/CB-417
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 1.4.0, 1.5.0
>         Environment: Eclipse on Linux with Google TV add-on, Phonegap 1.5 & 1.4 (only tested these versions)
>            Reporter: Hugo De Zela
>            Assignee: Joe Bowser
>            Priority: Minor
>              Labels: google, tv
>
> Any Javascript calls to D-pad events or special button events (Play, FFW, etc...) don't fire in Phonegap.
> Have tried: keypress, keydown, keyup.
> However, if I register an override in the main js file like this:
> [code]
> @Override
>     public boolean onKeyDown(int keyCode, KeyEvent event) {
>         WebView myWebView = (WebView) findViewById(R.id.webview);
>         if (keyCode == KeyEvent.KEYCODE_DPAD_UP) { myWebView.loadUrl("javascript:daleTecla('UP');"); return true; }
>         if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) { myWebView.loadUrl("javascript:daleTecla('DOWN');"); return true; }
>         if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) { myWebView.loadUrl("javascript:daleTecla('LEFT');"); return true; }
>         if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) { myWebView.loadUrl("javascript:daleTecla('RIGHT');"); return true; }
>         if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_DPAD_CENTER) { myWebView.loadUrl("javascript:daleTecla('ENTER');"); return true; }
>         if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) { myWebView.loadUrl("javascript:daleTecla('PLAYPAUSE');"); return true; }
>         if (keyCode == KeyEvent.KEYCODE_MEDIA_NEXT) { myWebView.loadUrl("javascript:daleTecla('NEXT');"); return true; }
>         if (keyCode == KeyEvent.KEYCODE_MEDIA_PREVIOUS) { myWebView.loadUrl("javascript:daleTecla('PREV');"); return true; }
>         if (keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD) { myWebView.loadUrl("javascript:daleTecla('FFW');"); return true; }
>         if (keyCode == KeyEvent.KEYCODE_MEDIA_REWIND) { myWebView.loadUrl("javascript:daleTecla('REW');"); return true; }
>         if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP) { myWebView.loadUrl("javascript:daleTecla('STOP');"); return true; }
>         if (keyCode == KeyEvent.KEYCODE_MENU) { myWebView.loadUrl("javascript:daleTecla('MENU');"); return true; }
>         return super.onKeyDown(keyCode, event);
>     }
> [/code]
> The javascript "daleTecla" (my keypress handler), receives all except KEYCODE_DPAD_LEFT. Sometimes, but only AFTER DPAD_RIGHT is called, DPAD_LEFT fires, this is not consistent behavior though.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira