From 9e4baf538b3a433e0b7f2f2c03635061a1dca980 Mon Sep 17 00:00:00 2001 From: jules Date: Sun, 24 Feb 2013 16:12:36 +0000 Subject: [PATCH] Android: fix for pausing openGL apps. Rebuild of project files. --- .../VisualStudio2005/The Introjucer.vcproj | 4 +- .../VisualStudio2008/The Introjucer.vcproj | 4 +- .../VisualStudio2010/The Introjucer.vcxproj | 4 +- .../Builds/Android/src/com/juce/JuceDemo.java | 51 +++++++++++++++++++ .../Builds/VisualStudio2005/Juce Demo.vcproj | 4 +- .../Builds/VisualStudio2008/Juce Demo.vcproj | 4 +- .../Builds/VisualStudio2010/Juce Demo.vcxproj | 4 +- .../VisualStudio2005/JuceDemoPlugin.vcproj | 4 +- .../VisualStudio2008/JuceDemoPlugin.vcproj | 4 +- .../VisualStudio2005/Plugin Host.vcproj | 4 +- .../VisualStudio2008/Plugin Host.vcproj | 4 +- .../VisualStudio2008/BinaryBuilder.vcproj | 4 +- .../Builds/VisualStudio2005/HelloWorld.vcproj | 4 +- .../Builds/VisualStudio2008/HelloWorld.vcproj | 4 +- .../Builds/VisualStudio2008/juce.vcproj | 4 +- .../Builds/VisualStudio2010/juce.vcxproj | 4 +- .../Builds/VisualStudio2008/Jucer.vcproj | 4 +- .../Builds/VisualStudio2010/Jucer.vcxproj | 4 +- .../native/java/JuceAppActivity.java | 51 +++++++++++++++++++ 19 files changed, 136 insertions(+), 34 deletions(-) diff --git a/extras/Introjucer/Builds/VisualStudio2005/The Introjucer.vcproj b/extras/Introjucer/Builds/VisualStudio2005/The Introjucer.vcproj index fb794d3dda..eb12d37202 100644 --- a/extras/Introjucer/Builds/VisualStudio2005/The Introjucer.vcproj +++ b/extras/Introjucer/Builds/VisualStudio2005/The Introjucer.vcproj @@ -12,7 +12,7 @@ <_ProjectFileVersion>10.0.30319.1 .\Debug\ - .\Debug\ + $(OutDir)\ Introjucer true .\Release\ - .\Release\ + $(OutDir)\ Introjucer true diff --git a/extras/JuceDemo/Builds/Android/src/com/juce/JuceDemo.java b/extras/JuceDemo/Builds/Android/src/com/juce/JuceDemo.java index 7ece8fd3be..800970a89e 100644 --- a/extras/JuceDemo/Builds/Android/src/com/juce/JuceDemo.java +++ b/extras/JuceDemo/Builds/Android/src/com/juce/JuceDemo.java @@ -81,6 +81,9 @@ public final class JuceDemo extends Activity @Override protected final void onPause() { + if (viewHolder != null) + viewHolder.onPause(); + suspendApp(); super.onPause(); } @@ -89,6 +92,10 @@ public final class JuceDemo extends Activity protected final void onResume() { super.onResume(); + + if (viewHolder != null) + viewHolder.onResume(); + resumeApp(); } @@ -167,6 +174,28 @@ public final class JuceDemo extends Activity } } + public final void onPause() + { + for (int i = getChildCount(); --i >= 0;) + { + View v = getChildAt (i); + + if (v instanceof ComponentPeerView) + ((ComponentPeerView) v).onPause(); + } + } + + public final void onResume() + { + for (int i = getChildCount(); --i >= 0;) + { + View v = getChildAt (i); + + if (v instanceof ComponentPeerView) + ((ComponentPeerView) v).onResume(); + } + } + private boolean isFirstResize = true; } @@ -437,6 +466,28 @@ public final class JuceDemo extends Activity return true; //xxx needs to check overlapping views } + public final void onPause() + { + for (int i = getChildCount(); --i >= 0;) + { + View v = getChildAt (i); + + if (v instanceof OpenGLView) + ((OpenGLView) v).onPause(); + } + } + + public final void onResume() + { + for (int i = getChildCount(); --i >= 0;) + { + View v = getChildAt (i); + + if (v instanceof OpenGLView) + ((OpenGLView) v).onResume(); + } + } + public OpenGLView createGLView() { OpenGLView glView = new OpenGLView (getContext()); diff --git a/extras/JuceDemo/Builds/VisualStudio2005/Juce Demo.vcproj b/extras/JuceDemo/Builds/VisualStudio2005/Juce Demo.vcproj index e2afcfc09f..a46c4374ca 100644 --- a/extras/JuceDemo/Builds/VisualStudio2005/Juce Demo.vcproj +++ b/extras/JuceDemo/Builds/VisualStudio2005/Juce Demo.vcproj @@ -12,7 +12,7 @@ <_ProjectFileVersion>10.0.30319.1 .\Debug\ - .\Debug\ + $(OutDir)\ JuceDemo true .\Release\ - .\Release\ + $(OutDir)\ JuceDemo true diff --git a/extras/audio plugin demo/Builds/VisualStudio2005/JuceDemoPlugin.vcproj b/extras/audio plugin demo/Builds/VisualStudio2005/JuceDemoPlugin.vcproj index 0154e479b8..bd95ae2ae3 100644 --- a/extras/audio plugin demo/Builds/VisualStudio2005/JuceDemoPlugin.vcproj +++ b/extras/audio plugin demo/Builds/VisualStudio2005/JuceDemoPlugin.vcproj @@ -12,7 +12,7 @@ <_ProjectFileVersion>10.0.30319.1 .\Debug\ - .\Debug\ + $(OutDir)\ jucedebug true .\Release\ - .\Release\ + $(OutDir)\ juce true diff --git a/extras/the jucer/Builds/VisualStudio2008/Jucer.vcproj b/extras/the jucer/Builds/VisualStudio2008/Jucer.vcproj index d4722a3615..130d23d307 100644 --- a/extras/the jucer/Builds/VisualStudio2008/Jucer.vcproj +++ b/extras/the jucer/Builds/VisualStudio2008/Jucer.vcproj @@ -12,7 +12,7 @@ <_ProjectFileVersion>10.0.30319.1 .\Debug\ - .\Debug\ + $(OutDir)\ Jucer true .\Release\ - .\Release\ + $(OutDir)\ Jucer true diff --git a/modules/juce_core/native/java/JuceAppActivity.java b/modules/juce_core/native/java/JuceAppActivity.java index f9fcaebbac..057994e67d 100644 --- a/modules/juce_core/native/java/JuceAppActivity.java +++ b/modules/juce_core/native/java/JuceAppActivity.java @@ -81,6 +81,9 @@ public final class JuceAppActivity extends Activity @Override protected final void onPause() { + if (viewHolder != null) + viewHolder.onPause(); + suspendApp(); super.onPause(); } @@ -89,6 +92,10 @@ public final class JuceAppActivity extends Activity protected final void onResume() { super.onResume(); + + if (viewHolder != null) + viewHolder.onResume(); + resumeApp(); } @@ -167,6 +174,28 @@ public final class JuceAppActivity extends Activity } } + public final void onPause() + { + for (int i = getChildCount(); --i >= 0;) + { + View v = getChildAt (i); + + if (v instanceof ComponentPeerView) + ((ComponentPeerView) v).onPause(); + } + } + + public final void onResume() + { + for (int i = getChildCount(); --i >= 0;) + { + View v = getChildAt (i); + + if (v instanceof ComponentPeerView) + ((ComponentPeerView) v).onResume(); + } + } + private boolean isFirstResize = true; } @@ -437,6 +466,28 @@ public final class JuceAppActivity extends Activity return true; //xxx needs to check overlapping views } + public final void onPause() + { + for (int i = getChildCount(); --i >= 0;) + { + View v = getChildAt (i); + + if (v instanceof OpenGLView) + ((OpenGLView) v).onPause(); + } + } + + public final void onResume() + { + for (int i = getChildCount(); --i >= 0;) + { + View v = getChildAt (i); + + if (v instanceof OpenGLView) + ((OpenGLView) v).onResume(); + } + } + public OpenGLView createGLView() { OpenGLView glView = new OpenGLView (getContext());