Skip to content

Commit

Permalink
Minor fix to deal with weird keyboard focus issues and the back butto…
Browse files Browse the repository at this point in the history
…n. CB-1146
  • Loading branch information
infil00p committed Jul 27, 2012
1 parent 401584d commit 893ecec
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
8 changes: 7 additions & 1 deletion framework/src/org/apache/cordova/CordovaWebView.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public class CordovaWebView extends WebView {

private boolean volumeupBound;

private boolean handleButton = false;

/**
* Constructor.
*
Expand Down Expand Up @@ -749,7 +751,6 @@ else if(keyUpCodes.contains(keyCode))
return super.onKeyUp(keyCode, event);
}


Log.d(TAG, "KeyUp has been triggered on the view");
return false;
}
Expand Down Expand Up @@ -788,6 +789,7 @@ public boolean isBackButtonBound()

public void handlePause(boolean keepRunning)
{
LOG.d(TAG, "Handle the pause");
// Send pause event to JavaScript
this.loadUrl("javascript:try{cordova.fireDocumentEvent('pause');}catch(e){console.log('exception firing pause event from native');};");

Expand Down Expand Up @@ -843,4 +845,8 @@ public void onNewIntent(Intent intent)
this.pluginManager.onNewIntent(intent);
}
}

public boolean hadKeyEvent() {
return handleButton;
}
}
15 changes: 15 additions & 0 deletions framework/src/org/apache/cordova/DroidGap.java
Original file line number Diff line number Diff line change
Expand Up @@ -1032,5 +1032,20 @@ else if ("exit".equals(id)) {
}
return null;
}


/*
* (non-Javadoc)
* @see android.app.Activity#onKeyUp(int, android.view.KeyEvent)
*/

@Override
public boolean onKeyUp(int keyCode, KeyEvent event)
{
if (appView.backHistory() || keyCode != KeyEvent.KEYCODE_BACK)
return appView.onKeyUp(keyCode, event);
else
return super.onKeyUp(keyCode, event);
}

}

0 comments on commit 893ecec

Please sign in to comment.