mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
* commit '506f5cc24e1b5da9c66d26488909b2464671a6b9': Only postpone animations if app is visible
This commit is contained in:
@@ -42,6 +42,7 @@ public class FirstFrameAnimatorHelper extends AnimatorListenerAdapter
|
||||
|
||||
private static ViewTreeObserver.OnDrawListener sGlobalDrawListener;
|
||||
private static long sGlobalFrameCounter;
|
||||
private static boolean sVisible;
|
||||
|
||||
public FirstFrameAnimatorHelper(ValueAnimator animator, View target) {
|
||||
mTarget = target;
|
||||
@@ -60,6 +61,10 @@ public class FirstFrameAnimatorHelper extends AnimatorListenerAdapter
|
||||
onAnimationUpdate(va);
|
||||
}
|
||||
|
||||
public static void setIsVisible(boolean visible) {
|
||||
sVisible = visible;
|
||||
}
|
||||
|
||||
public static void initializeDrawListener(View view) {
|
||||
if (sGlobalDrawListener != null) {
|
||||
view.getViewTreeObserver().removeOnDrawListener(sGlobalDrawListener);
|
||||
@@ -76,6 +81,7 @@ public class FirstFrameAnimatorHelper extends AnimatorListenerAdapter
|
||||
}
|
||||
};
|
||||
view.getViewTreeObserver().addOnDrawListener(sGlobalDrawListener);
|
||||
sVisible = true;
|
||||
}
|
||||
|
||||
public void onAnimationUpdate(final ValueAnimator animation) {
|
||||
@@ -86,6 +92,7 @@ public class FirstFrameAnimatorHelper extends AnimatorListenerAdapter
|
||||
}
|
||||
|
||||
if (!mHandlingOnAnimationUpdate &&
|
||||
sVisible &&
|
||||
// If the current play time exceeds the duration, the animation
|
||||
// will get finished, even if we call setCurrentPlayTime -- therefore
|
||||
// don't adjust the animation in that case
|
||||
|
||||
Reference in New Issue
Block a user