aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2014-08-31 23:57:32 (GMT)
committerJorge Ruesga <jorge@ruesga.com>2014-08-31 23:57:32 (GMT)
commit9ecd4810334c02566faaa1c9b3b079a089d5314a (patch)
tree8af94dbef2c33c92078339f02dbf89ad7070cc2d
parenta523e7f3384fbab9cc398e2fd398bda8fc13663b (diff)
downloadandroid_packages_wallpapers_PhotoPhase-9ecd4810334c02566faaa1c9b3b079a089d5314a.zip
android_packages_wallpapers_PhotoPhase-9ecd4810334c02566faaa1c9b3b079a089d5314a.tar.gz
android_packages_wallpapers_PhotoPhase-9ecd4810334c02566faaa1c9b3b079a089d5314a.tar.bz2
photophase: don't reset transition timer on pause
JIRA: CYAN-4836 https://jira.cyanogenmod.org/browse/CYAN-4836 Signed-off-by: Jorge Ruesga <jorge@ruesga.com> Change-Id: I816ac4b0c015ec6c3f85272d33100fd710e76e6f
-rw-r--r--src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java b/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java
index 7fb467f..bbb71d1 100644
--- a/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java
+++ b/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java
@@ -80,6 +80,7 @@ public class PhotoPhaseRenderer implements GLSurfaceView.Renderer {
OopsShape mOopsShape;
long mLastRunningTransition;
+ long mLastTransition;
private long mLastTouchTime;
private static final long TOUCH_BARRIER_TIME = 1000L;
@@ -167,6 +168,7 @@ public class PhotoPhaseRenderer implements GLSurfaceView.Renderer {
// Select a new transition
mWorld.selectRandomTransition();
mLastRunningTransition = System.currentTimeMillis();
+ mLastTransition = System.currentTimeMillis();
// Now force continuously render while transition is applied
mDispatcher.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
@@ -589,6 +591,8 @@ public class PhotoPhaseRenderer implements GLSurfaceView.Renderer {
mMeasuredHeight = -1;
mStatusBarHeight = 0;
+ mLastTransition = System.currentTimeMillis();
+
// We have a 2d (fake) scenario, disable all unnecessary tests. Deep are
// necessary for some 3d effects
GLES20.glDisable(GL10.GL_DITHER);
@@ -725,15 +729,16 @@ public class PhotoPhaseRenderer implements GLSurfaceView.Renderer {
// Check if we have some pending transition or transition has
// exceed its timeout
synchronized (mDrawing) {
- if (Preferences.General.Transitions.getTransitionInterval() > 0) {
+ final int interval = Preferences.General.Transitions.getTransitionInterval();
+ if (interval > 0) {
if (!mWorld.hasRunningTransition() || isTransitionTimeoutFired()) {
mDispatcher.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
// Now start a delayed thread to generate the next effect
deselectCurrentTransition();
- mLastRunningTransition = 0;
- mHandler.postDelayed(mTransitionThread,
- Preferences.General.Transitions.getTransitionInterval());
+ long diff = System.currentTimeMillis() - mLastTransition;
+ long delay = Math.max(200, interval - diff);
+ mHandler.postDelayed(mTransitionThread, delay);
}
} else {
// Just display the initial frames and never make transitions