Skip to content

Commit

Permalink
Pause the live wallpaper in all cases now (avoids problems when press…
Browse files Browse the repository at this point in the history
…ing back from the preview window).

As a downside, the live wallpaper no longer animates when the settings screen is overlaid.
  • Loading branch information
learnopengles committed May 20, 2013
1 parent 90467e7 commit 0a1a688
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.content.Context;
import android.opengl.GLSurfaceView;
import android.opengl.GLSurfaceView.Renderer;
import android.os.Build;
import android.service.wallpaper.WallpaperService;
import android.util.Log;
import android.view.SurfaceHolder;
Expand Down Expand Up @@ -68,10 +69,8 @@ public void onVisibilityChanged(boolean visible) {
if (rendererHasBeenSet) {
if (visible) {
glSurfaceView.onResume();
} else {
if (!isPreview()) {
glSurfaceView.onPause();
}
} else {
glSurfaceView.onPause();
}
}
}
Expand All @@ -94,6 +93,16 @@ protected void setRenderer(Renderer renderer) {
glSurfaceView.setRenderer(renderer);
rendererHasBeenSet = true;
}

protected void setPreserveEGLContextOnPause(boolean preserve) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
if (LoggerConfig.ON) {
Log.d(TAG, "setPreserveEGLContextOnPause(" + preserve + ")");
}

glSurfaceView.setPreserveEGLContextOnPause(preserve);
}
}

protected void setEGLContextClientVersion(int version) {
if (LoggerConfig.ON) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,8 @@ public void onVisibilityChanged(boolean visible) {
if (rendererHasBeenSet) {
if (visible) {
glSurfaceView.onResume();
} else {
if (!isPreview()) {
glSurfaceView.onPause();
}
} else {
glSurfaceView.onPause();
}
}
}
Expand Down

0 comments on commit 0a1a688

Please sign in to comment.