mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-07 23:03:11 +08:00
Reverting the back button change that I made, for some reason certain methods aren't inherited when you extend DroidGap
This commit is contained in:
parent
7b75e2f1b0
commit
1e5457a47d
@ -48,6 +48,7 @@ import android.graphics.Color;
|
|||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@ -1078,15 +1079,23 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see android.app.Activity#onBackPressed()
|
* @see android.app.Activity#onBackPressed()
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed()
|
public void onBackPressed()
|
||||||
{
|
{
|
||||||
// If back key is bound, then send event to JavaScript
|
Log.d("BackPressed", "in onBackPressed");
|
||||||
|
Log.d("BackPressed", "bound = " + this.bound);
|
||||||
|
//Log.d("BackPressed", "backHistory = " + this.backHistory());
|
||||||
|
// If back key is bound, then send event to JavaScript
|
||||||
|
|
||||||
if (!(this.bound || this.backHistory())) {
|
if (!(this.bound || this.backHistory())) {
|
||||||
|
Log.d("BackPressed", "exiting");
|
||||||
this.activityState = ACTIVITY_EXITING;
|
this.activityState = ACTIVITY_EXITING;
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a key is de-pressed. (Key UP)
|
* Called when a key is de-pressed. (Key UP)
|
||||||
@ -1102,13 +1111,25 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
|
|
||||||
// If back key
|
// If back key
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
|
Log.d("BackButton", "I got an up from KEYCODE_BACK");
|
||||||
|
|
||||||
// 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) {
|
||||||
|
Log.d("BackButton", "bound is true firing an event to JS");
|
||||||
this.appView.loadUrl("javascript:cordova.fireDocumentEvent('backbutton');");
|
this.appView.loadUrl("javascript:cordova.fireDocumentEvent('backbutton');");
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
// If not bound
|
||||||
|
// Go to previous page in webview if it is possible to go back
|
||||||
|
if (this.backHistory()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// If not, then invoke behavior of super class
|
||||||
|
else {
|
||||||
|
this.activityState = ACTIVITY_EXITING;
|
||||||
|
return super.onKeyUp(keyCode, event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If menu key
|
// If menu key
|
||||||
@ -1123,6 +1144,7 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.d("BackPressed", "returning false");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user