| @@ -238,32 +238,32 @@ public class JuceAppActivity extends $$JuceAppActivityBaseClass$$ | |||
| { | |||
| launchApp (getApplicationInfo().publicSourceDir, | |||
| getApplicationInfo().dataDir); | |||
| } | |||
| // Need to override this as the default implementation always finishes the activity. | |||
| @Override | |||
| public void onBackPressed() | |||
| { | |||
| ComponentPeerView focusedView = getViewWithFocusOrDefaultView(); | |||
| if (focusedView == null) | |||
| return; | |||
| focusedView.backButtonPressed(); | |||
| } | |||
| private ComponentPeerView getViewWithFocusOrDefaultView() | |||
| { | |||
| for (int i = 0; i < viewHolder.getChildCount(); ++i) | |||
| { | |||
| if (viewHolder.getChildAt (i).hasFocus()) | |||
| return (ComponentPeerView) viewHolder.getChildAt (i); | |||
| } | |||
| if (viewHolder.getChildCount() > 0) | |||
| return (ComponentPeerView) viewHolder.getChildAt (0); | |||
| return null; | |||
| } | |||
| // Need to override this as the default implementation always finishes the activity. | |||
| @Override | |||
| public void onBackPressed() | |||
| { | |||
| ComponentPeerView focusedView = getViewWithFocusOrDefaultView(); | |||
| if (focusedView == null) | |||
| return; | |||
| focusedView.backButtonPressed(); | |||
| } | |||
| private ComponentPeerView getViewWithFocusOrDefaultView() | |||
| { | |||
| for (int i = 0; i < viewHolder.getChildCount(); ++i) | |||
| { | |||
| if (viewHolder.getChildAt (i).hasFocus()) | |||
| return (ComponentPeerView) viewHolder.getChildAt (i); | |||
| } | |||
| if (viewHolder.getChildCount() > 0) | |||
| return (ComponentPeerView) viewHolder.getChildAt (0); | |||
| return null; | |||
| } | |||
| //============================================================================== | |||
| @@ -701,7 +701,7 @@ public class JuceAppActivity extends $$JuceAppActivityBaseClass$$ | |||
| //============================================================================== | |||
| private native void handleKeyDown (long host, int keycode, int textchar); | |||
| private native void handleKeyUp (long host, int keycode, int textchar); | |||
| private native void handleBackButton (long host); | |||
| private native void handleBackButton (long host); | |||
| public void showKeyboard (String type) | |||
| { | |||
| @@ -719,14 +719,14 @@ public class JuceAppActivity extends $$JuceAppActivityBaseClass$$ | |||
| imm.hideSoftInputFromWindow (getWindowToken(), 0); | |||
| } | |||
| } | |||
| } | |||
| public void backButtonPressed() | |||
| { | |||
| if (host == 0) | |||
| return; | |||
| handleBackButton (host); | |||
| } | |||
| public void backButtonPressed() | |||
| { | |||
| if (host == 0) | |||
| return; | |||
| handleBackButton (host); | |||
| } | |||
| @Override | |||
| @@ -739,11 +739,11 @@ public class JuceAppActivity extends $$JuceAppActivityBaseClass$$ | |||
| { | |||
| case KeyEvent.KEYCODE_VOLUME_UP: | |||
| case KeyEvent.KEYCODE_VOLUME_DOWN: | |||
| return super.onKeyDown (keyCode, event); | |||
| case KeyEvent.KEYCODE_BACK: | |||
| { | |||
| ((Activity) getContext()).onBackPressed(); | |||
| return true; | |||
| return super.onKeyDown (keyCode, event); | |||
| case KeyEvent.KEYCODE_BACK: | |||
| { | |||
| ((Activity) getContext()).onBackPressed(); | |||
| return true; | |||
| } | |||
| default: | |||