mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-01 02:12:58 +08:00
Return true when handling key events, indicating that no further processing is necessary.
This commit is contained in:
parent
9b52827744
commit
a67dfdb75e
@ -1157,6 +1157,7 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
// If back key is bound, then send event to JavaScript
|
// If back key is bound, then send event to JavaScript
|
||||||
if (this.bound) {
|
if (this.bound) {
|
||||||
this.appView.loadUrl("javascript:PhoneGap.fireEvent('backbutton');");
|
this.appView.loadUrl("javascript:PhoneGap.fireEvent('backbutton');");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If not bound
|
// If not bound
|
||||||
@ -1165,6 +1166,7 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
// Go to previous page in webview if it is possible to go back
|
// Go to previous page in webview if it is possible to go back
|
||||||
if (this.appView.canGoBack()) {
|
if (this.appView.canGoBack()) {
|
||||||
this.appView.goBack();
|
this.appView.goBack();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If not, then invoke behavior of super class
|
// If not, then invoke behavior of super class
|
||||||
@ -1177,11 +1179,13 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
// If menu key
|
// If menu key
|
||||||
else if (keyCode == KeyEvent.KEYCODE_MENU) {
|
else if (keyCode == KeyEvent.KEYCODE_MENU) {
|
||||||
this.appView.loadUrl("javascript:PhoneGap.fireEvent('menubutton');");
|
this.appView.loadUrl("javascript:PhoneGap.fireEvent('menubutton');");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If search key
|
// If search key
|
||||||
else if (keyCode == KeyEvent.KEYCODE_SEARCH) {
|
else if (keyCode == KeyEvent.KEYCODE_SEARCH) {
|
||||||
this.appView.loadUrl("javascript:PhoneGap.fireEvent('searchbutton');");
|
this.appView.loadUrl("javascript:PhoneGap.fireEvent('searchbutton');");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user