mirror of
https://github.com/apache/cordova-android.git
synced 2026-04-23 00:00:09 +08:00
Added button bindings
This commit is contained in:
@@ -32,6 +32,7 @@ import android.content.res.Configuration;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.KeyEvent;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
@@ -237,7 +238,31 @@ public class DroidGap extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||||
|
{
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
|
String testUrl = appView.getUrl();
|
||||||
|
appView.goBack();
|
||||||
|
if(appView.getUrl() == testUrl)
|
||||||
|
{
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_MENU)
|
||||||
|
{
|
||||||
|
appView.loadUrl("javascript:fireMenuEvent()");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_SEARCH)
|
||||||
|
{
|
||||||
|
appView.loadUrl("javascript:fireSearchEvent()");
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// This is required to start the camera activity! It has to come from the previous activity
|
// This is required to start the camera activity! It has to come from the previous activity
|
||||||
public void startCamera(int quality)
|
public void startCamera(int quality)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user