About XWalkUICLient::shouldOverrideKeyEvent, I didn’t investigate it yet.
Maybe you can help to file a bug at https://crosswalk-project.org/jira about 
this.



From: Daniele Gibertoni [mailto:[email protected]]
Sent: Wednesday, March 18, 2015 5:12 PM
To: Xu, Xing; [email protected]
Subject: Re: [Crosswalk-help] shouldOverrideKeyEvent and Back button on 
embedded webview

Thank You, overriding dispatchKeyEvent works fine!
But, just to clarify, the job of XWalkUICLient::shouldOverrideKeyEvent is not 
filtering KeyEvent? Why it is not working here?

Thank You,
Daniele Gibertoni

Il Martedì 17 Marzo 2015 13:40, "Xu, Xing" 
<[email protected]<mailto:[email protected]>> ha scritto:

How about try to override Activity::dispatchKeyEvent?

From: Crosswalk-help 
[mailto:[email protected]] On Behalf Of 
Daniele Gibertoni
Sent: Tuesday, March 17, 2015 8:16 PM
To: 
[email protected]<mailto:[email protected]>
Subject: [Crosswalk-help] shouldOverrideKeyEvent and Back button on embedded 
webview

Hello.
We have an Android app that use an embedded Crosswalk XWalkView (stable version 
11.40.277.7). We would like to disable the default behavior of hardware back 
button (go back on webview history) in order to have it handled by our 
application.
It seems that is not possible to do: the Crosswalk webview will always handles 
the back button press and changes the page.

Our relevant code in XWalkUIClient:

@Override
    public boolean shouldOverrideKeyEvent(XWalkView view,  
android.view.KeyEvent event){
        int keycode=event.getKeyCode();
        if(keycode==KeyEvent.KEYCODE_BACK){
            return true;
        }
        return false;
    }

Our code in main Activity:

public void onBackPressed() {
}

@Override
      public boolean onKeyDown(int keyCode, KeyEvent event){
          if ((keyCode == KeyEvent.KEYCODE_BACK) ) {
              return true;
          }
          return super.onKeyDown(keyCode,event);
      }

We are missing something?
Thank You!

Daniele Gibertoni



_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help

Reply via email to