| @@ -322,6 +322,32 @@ public class AnalyticsCollection extends Activity | |||
| 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; | |||
| } | |||
| //============================================================================== | |||
| private void hideActionBar() | |||
| { | |||
| @@ -777,6 +803,14 @@ public class AnalyticsCollection extends Activity | |||
| } | |||
| } | |||
| public void backButtonPressed() | |||
| { | |||
| if (host == 0) | |||
| return; | |||
| handleBackButton (host); | |||
| } | |||
| @Override | |||
| public boolean onKeyDown (int keyCode, KeyEvent event) | |||
| { | |||
| @@ -790,7 +824,7 @@ public class AnalyticsCollection extends Activity | |||
| return super.onKeyDown (keyCode, event); | |||
| case KeyEvent.KEYCODE_BACK: | |||
| { | |||
| handleBackButton (host); | |||
| ((Activity) getContext()).onBackPressed(); | |||
| return true; | |||
| } | |||
| @@ -322,6 +322,32 @@ public class JuceDemo extends Activity | |||
| 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; | |||
| } | |||
| //============================================================================== | |||
| private void hideActionBar() | |||
| { | |||
| @@ -777,6 +803,14 @@ public class JuceDemo extends Activity | |||
| } | |||
| } | |||
| public void backButtonPressed() | |||
| { | |||
| if (host == 0) | |||
| return; | |||
| handleBackButton (host); | |||
| } | |||
| @Override | |||
| public boolean onKeyDown (int keyCode, KeyEvent event) | |||
| { | |||
| @@ -790,7 +824,7 @@ public class JuceDemo extends Activity | |||
| return super.onKeyDown (keyCode, event); | |||
| case KeyEvent.KEYCODE_BACK: | |||
| { | |||
| handleBackButton (host); | |||
| ((Activity) getContext()).onBackPressed(); | |||
| return true; | |||
| } | |||
| @@ -322,6 +322,32 @@ public class InAppPurchase extends Activity | |||
| 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; | |||
| } | |||
| //============================================================================== | |||
| private void hideActionBar() | |||
| { | |||
| @@ -777,6 +803,14 @@ public class InAppPurchase extends Activity | |||
| } | |||
| } | |||
| public void backButtonPressed() | |||
| { | |||
| if (host == 0) | |||
| return; | |||
| handleBackButton (host); | |||
| } | |||
| @Override | |||
| public boolean onKeyDown (int keyCode, KeyEvent event) | |||
| { | |||
| @@ -790,7 +824,7 @@ public class InAppPurchase extends Activity | |||
| return super.onKeyDown (keyCode, event); | |||
| case KeyEvent.KEYCODE_BACK: | |||
| { | |||
| handleBackButton (host); | |||
| ((Activity) getContext()).onBackPressed(); | |||
| return true; | |||
| } | |||
| @@ -1254,6 +1254,32 @@ public class MidiTest extends Activity | |||
| 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; | |||
| } | |||
| //============================================================================== | |||
| private void hideActionBar() | |||
| { | |||
| @@ -1709,6 +1735,14 @@ public class MidiTest extends Activity | |||
| } | |||
| } | |||
| public void backButtonPressed() | |||
| { | |||
| if (host == 0) | |||
| return; | |||
| handleBackButton (host); | |||
| } | |||
| @Override | |||
| public boolean onKeyDown (int keyCode, KeyEvent event) | |||
| { | |||
| @@ -1722,7 +1756,7 @@ public class MidiTest extends Activity | |||
| return super.onKeyDown (keyCode, event); | |||
| case KeyEvent.KEYCODE_BACK: | |||
| { | |||
| handleBackButton (host); | |||
| ((Activity) getContext()).onBackPressed(); | |||
| return true; | |||
| } | |||
| @@ -322,6 +322,32 @@ public class JUCENetworkGraphicsDemo extends Activity | |||
| 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; | |||
| } | |||
| //============================================================================== | |||
| private void hideActionBar() | |||
| { | |||
| @@ -777,6 +803,14 @@ public class JUCENetworkGraphicsDemo extends Activity | |||
| } | |||
| } | |||
| public void backButtonPressed() | |||
| { | |||
| if (host == 0) | |||
| return; | |||
| handleBackButton (host); | |||
| } | |||
| @Override | |||
| public boolean onKeyDown (int keyCode, KeyEvent event) | |||
| { | |||
| @@ -790,7 +824,7 @@ public class JUCENetworkGraphicsDemo extends Activity | |||
| return super.onKeyDown (keyCode, event); | |||
| case KeyEvent.KEYCODE_BACK: | |||
| { | |||
| handleBackButton (host); | |||
| ((Activity) getContext()).onBackPressed(); | |||
| return true; | |||
| } | |||
| @@ -322,6 +322,32 @@ public class OSCReceiver extends Activity | |||
| 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; | |||
| } | |||
| //============================================================================== | |||
| private void hideActionBar() | |||
| { | |||
| @@ -777,6 +803,14 @@ public class OSCReceiver extends Activity | |||
| } | |||
| } | |||
| public void backButtonPressed() | |||
| { | |||
| if (host == 0) | |||
| return; | |||
| handleBackButton (host); | |||
| } | |||
| @Override | |||
| public boolean onKeyDown (int keyCode, KeyEvent event) | |||
| { | |||
| @@ -790,7 +824,7 @@ public class OSCReceiver extends Activity | |||
| return super.onKeyDown (keyCode, event); | |||
| case KeyEvent.KEYCODE_BACK: | |||
| { | |||
| handleBackButton (host); | |||
| ((Activity) getContext()).onBackPressed(); | |||
| return true; | |||
| } | |||
| @@ -322,6 +322,32 @@ public class OSCSender extends Activity | |||
| 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; | |||
| } | |||
| //============================================================================== | |||
| private void hideActionBar() | |||
| { | |||
| @@ -777,6 +803,14 @@ public class OSCSender extends Activity | |||
| } | |||
| } | |||
| public void backButtonPressed() | |||
| { | |||
| if (host == 0) | |||
| return; | |||
| handleBackButton (host); | |||
| } | |||
| @Override | |||
| public boolean onKeyDown (int keyCode, KeyEvent event) | |||
| { | |||
| @@ -790,7 +824,7 @@ public class OSCSender extends Activity | |||
| return super.onKeyDown (keyCode, event); | |||
| case KeyEvent.KEYCODE_BACK: | |||
| { | |||
| handleBackButton (host); | |||
| ((Activity) getContext()).onBackPressed(); | |||
| return true; | |||
| } | |||
| @@ -1254,6 +1254,32 @@ public class PushNotificationsDemo extends Activity | |||
| 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; | |||
| } | |||
| //============================================================================== | |||
| private void hideActionBar() | |||
| { | |||
| @@ -1709,6 +1735,14 @@ public class PushNotificationsDemo extends Activity | |||
| } | |||
| } | |||
| public void backButtonPressed() | |||
| { | |||
| if (host == 0) | |||
| return; | |||
| handleBackButton (host); | |||
| } | |||
| @Override | |||
| public boolean onKeyDown (int keyCode, KeyEvent event) | |||
| { | |||
| @@ -1722,7 +1756,7 @@ public class PushNotificationsDemo extends Activity | |||
| return super.onKeyDown (keyCode, event); | |||
| case KeyEvent.KEYCODE_BACK: | |||
| { | |||
| handleBackButton (host); | |||
| ((Activity) getContext()).onBackPressed(); | |||
| return true; | |||
| } | |||
| @@ -1254,6 +1254,32 @@ public class JuceDemoPlugin extends Activity | |||
| 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; | |||
| } | |||
| //============================================================================== | |||
| private void hideActionBar() | |||
| { | |||
| @@ -1709,6 +1735,14 @@ public class JuceDemoPlugin extends Activity | |||
| } | |||
| } | |||
| public void backButtonPressed() | |||
| { | |||
| if (host == 0) | |||
| return; | |||
| handleBackButton (host); | |||
| } | |||
| @Override | |||
| public boolean onKeyDown (int keyCode, KeyEvent event) | |||
| { | |||
| @@ -1722,7 +1756,7 @@ public class JuceDemoPlugin extends Activity | |||
| return super.onKeyDown (keyCode, event); | |||
| case KeyEvent.KEYCODE_BACK: | |||
| { | |||
| handleBackButton (host); | |||
| ((Activity) getContext()).onBackPressed(); | |||
| return true; | |||
| } | |||
| @@ -1254,6 +1254,32 @@ public class AudioPerformanceTest extends Activity | |||
| 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; | |||
| } | |||
| //============================================================================== | |||
| private void hideActionBar() | |||
| { | |||
| @@ -1709,6 +1735,14 @@ public class AudioPerformanceTest extends Activity | |||
| } | |||
| } | |||
| public void backButtonPressed() | |||
| { | |||
| if (host == 0) | |||
| return; | |||
| handleBackButton (host); | |||
| } | |||
| @Override | |||
| public boolean onKeyDown (int keyCode, KeyEvent event) | |||
| { | |||
| @@ -1722,7 +1756,7 @@ public class AudioPerformanceTest extends Activity | |||
| return super.onKeyDown (keyCode, event); | |||
| case KeyEvent.KEYCODE_BACK: | |||
| { | |||
| handleBackButton (host); | |||
| ((Activity) getContext()).onBackPressed(); | |||
| return true; | |||
| } | |||