incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ajit Aranha (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-1146) Application exits if back button is pressed after a soft keyboard hide.
Date Fri, 27 Jul 2012 17:41:33 GMT

    [ https://issues.apache.org/jira/browse/CB-1146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13423999#comment-13423999
] 

Ajit Aranha commented on CB-1146:
---------------------------------

Sharing my workaround, in case it's of any help

This goes in the activity extends DroidGap class, and should probably have the backHistory()
call integrated to be a more generic fix.


    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event)
    {
    	LOG.d(TAG, "KeyDown has been triggered on the view"+keyCode);
    		//If volumedown key
            if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
                    // only override default behaviour is event bound
                    LOG.d(TAG, "Down Key Hit");
                    this.loadUrl("javascript:cordova.fireDocumentEvent('volumedownbutton');");
                    return true;
            }
            // If volumeup key
            else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
                    LOG.d(TAG, "Up Key Hit");
                    this.loadUrl("javascript:cordova.fireDocumentEvent('volumeupbutton');");
                    return true;
            }
            else
            {
                //return super.onKeyDown(keyCode, event);
            }
        //return super.onKeyDown(keyCode, event);
        return true;
    }
    

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

        LOG.d(TAG, "KeyUp has been triggered on the view"+keyCode);

        // If back key
        if (keyCode == KeyEvent.KEYCODE_BACK) {
                this.loadUrl("javascript:cordova.fireDocumentEvent('backbutton');");
                return true;
        }
        // Legacy
        else if (keyCode == KeyEvent.KEYCODE_MENU) {
            this.loadUrl("javascript:cordova.fireDocumentEvent('menubutton');");
            return true;
        }
        // If search key
        else if (keyCode == KeyEvent.KEYCODE_SEARCH) {
            this.loadUrl("javascript:cordova.fireDocumentEvent('searchbutton');");
            return true;
        }
        return false;
    }

                
> Application exits if back button is pressed after a soft keyboard hide.
> -----------------------------------------------------------------------
>
>                 Key: CB-1146
>                 URL: https://issues.apache.org/jira/browse/CB-1146
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 2.0.0
>         Environment: phonegap 2.0.0 on android 2.2 on an olive pad VT-100
>            Reporter: Ajit Aranha
>            Assignee: Joe Bowser
>
> The back button normally cause CordovaWebView.onKeyUp to be called which typically either
dispatches the event to javascript or calls backHistory().
> However if the softkeyboard is displayed and then hidden, and the android back  button
is then pressed onKeyUp is never called, and the application exits instead.
>  (In this case i click on a html text input and either click on the page or press android
back button to hide the keyboard.Then i press the android back button to go to the previous
page.)
> -----------EDIT FOR CLARITY------------------
> Just to state the obvious , the current page when i am doing the above is not the first
page in history.
> If i don't show/hide the softkeyboard, the back button works perfectly and it goes back
in history.
> -----------EDIT FOR CLARITY------------------
> The log is as follows:
> 07-27 10:16:51.627: V/SoftKeyboardDetect(11190): We are in our onMeasure method
> 07-27 10:16:51.627: V/SoftKeyboardDetect(11190): Old Height = 455
> 07-27 10:16:51.627: V/SoftKeyboardDetect(11190): Height = 173
> 07-27 10:16:51.627: V/SoftKeyboardDetect(11190): Old Width = 800
> 07-27 10:16:51.627: V/SoftKeyboardDetect(11190): Width = 800
> ---keyboard shown event----
> 07-27 10:16:52.207: V/SoftKeyboardDetect(11190): We are in our onMeasure method
> 07-27 10:16:52.207: V/SoftKeyboardDetect(11190): Old Height = 173
> 07-27 10:16:52.207: V/SoftKeyboardDetect(11190): Height = 173
> 07-27 10:16:52.207: V/SoftKeyboardDetect(11190): Old Width = 800
> 07-27 10:16:52.207: V/SoftKeyboardDetect(11190): Width = 800
> 07-27 10:16:52.207: D/SoftKeyboardDetect(11190): Ignore this event
> 07-27 10:16:53.357: V/SoftKeyboardDetect(11190): We are in our onMeasure method
> 07-27 10:16:53.357: V/SoftKeyboardDetect(11190): Old Height = 173
> 07-27 10:16:53.357: V/SoftKeyboardDetect(11190): Height = 173
> 07-27 10:16:53.357: V/SoftKeyboardDetect(11190): Old Width = 800
> 07-27 10:16:53.357: V/SoftKeyboardDetect(11190): Width = 800
> 07-27 10:16:53.357: D/SoftKeyboardDetect(11190): Ignore this event
> 07-27 10:16:53.517: V/SoftKeyboardDetect(11190): We are in our onMeasure method
> 07-27 10:16:53.527: V/SoftKeyboardDetect(11190): Old Height = 173
> 07-27 10:16:53.527: V/SoftKeyboardDetect(11190): Height = 455
> 07-27 10:16:53.527: V/SoftKeyboardDetect(11190): Old Width = 800
> 07-27 10:16:53.527: V/SoftKeyboardDetect(11190): Width = 800
> --keyboard hide event---
> 07-27 10:16:54.297: V/SoftKeyboardDetect(11190): We are in our onMeasure method
> 07-27 10:16:54.297: V/SoftKeyboardDetect(11190): Old Height = 455
> 07-27 10:16:54.297: V/SoftKeyboardDetect(11190): Height = 455
> 07-27 10:16:54.297: V/SoftKeyboardDetect(11190): Old Width = 800
> 07-27 10:16:54.297: V/SoftKeyboardDetect(11190): Width = 800
> 07-27 10:16:54.297: D/SoftKeyboardDetect(11190): Ignore this event
> 07-27 10:16:55.357: W/KeyCharacterMap(11190): Can't open keycharmap file
> 07-27 10:16:55.357: W/KeyCharacterMap(11190): Error loading keycharmap file '/system/usr/keychars/PANJIT_Touchscreen.kcm.bin'.
hw.keyboards.65537.devname='PANJIT Touchscreen'
> 07-27 10:16:55.357: W/KeyCharacterMap(11190): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
> 07-27 10:16:55.487: D/CordovaWebView(11190): >>> loadUrlNow()
> 07-27 10:16:55.547: V/SoftKeyboardDetect(11190): We are in our onMeasure method
> 07-27 10:16:55.547: V/SoftKeyboardDetect(11190): Old Height = 455
> 07-27 10:16:55.547: V/SoftKeyboardDetect(11190): Height = 455
> 07-27 10:16:55.547: V/SoftKeyboardDetect(11190): Old Width = 800
> 07-27 10:16:55.547: V/SoftKeyboardDetect(11190): Width = 800
> 07-27 10:16:55.547: D/SoftKeyboardDetect(11190): Ignore this event
> 07-27 10:16:55.787: W/IInputConnectionWrapper(11190): showStatusIcon on inactive InputConnection
> ----android back button pressed application exits-----
> 07-27 10:16:56.157: D/DroidGap(11190): onDestroy()
> 07-27 10:16:56.157: D/CordovaWebView(11190): >>> loadUrlNow()
> 07-27 10:16:56.157: D/CordovaWebView(11190): >>> loadUrlNow()
> 07-27 10:16:56.197: D/DroidGap(11190): onMessage(onPageStarted,about:blank)
> 07-27 10:16:56.287: D/Cordova(11190): onPageFinished(about:blank)
> 07-27 10:16:56.287: D/DroidGap(11190): onMessage(onPageFinished,about:blank)
> 07-27 10:16:56.287: D/DroidGap(11190): onMessage(exit,null)

--
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

        

Mime
View raw message