Merge "Add end functionality to LayoutTransition"
This commit is contained in:
@@ -793,7 +793,9 @@ public class LayoutTransition {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public void startChangingAnimations() {
|
public void startChangingAnimations() {
|
||||||
for (Animator anim : currentChangingAnimations.values()) {
|
LinkedHashMap<View, Animator> currentAnimCopy =
|
||||||
|
(LinkedHashMap<View, Animator>) currentChangingAnimations.clone();
|
||||||
|
for (Animator anim : currentAnimCopy.values()) {
|
||||||
if (anim instanceof ObjectAnimator) {
|
if (anim instanceof ObjectAnimator) {
|
||||||
((ObjectAnimator) anim).setCurrentPlayTime(0);
|
((ObjectAnimator) anim).setCurrentPlayTime(0);
|
||||||
}
|
}
|
||||||
@@ -801,6 +803,23 @@ public class LayoutTransition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ends the animations that are set up for a CHANGING transition. This is a variant of
|
||||||
|
* startChangingAnimations() which is called when the window the transition is playing in
|
||||||
|
* is not visible. We need to make sure the animations put their targets in their end states
|
||||||
|
* and that the transition finishes to remove any mid-process state (such as isRunning()).
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void endChangingAnimations() {
|
||||||
|
LinkedHashMap<View, Animator> currentAnimCopy =
|
||||||
|
(LinkedHashMap<View, Animator>) currentChangingAnimations.clone();
|
||||||
|
for (Animator anim : currentAnimCopy.values()) {
|
||||||
|
anim.start();
|
||||||
|
anim.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if animations are running which animate layout-related properties. This
|
* Returns true if animations are running which animate layout-related properties. This
|
||||||
* essentially means that either CHANGE_APPEARING or CHANGE_DISAPPEARING animations
|
* essentially means that either CHANGE_APPEARING or CHANGE_DISAPPEARING animations
|
||||||
|
|||||||
@@ -1575,13 +1575,13 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
|||||||
boolean cancelDraw = attachInfo.mTreeObserver.dispatchOnPreDraw() ||
|
boolean cancelDraw = attachInfo.mTreeObserver.dispatchOnPreDraw() ||
|
||||||
viewVisibility != View.VISIBLE;
|
viewVisibility != View.VISIBLE;
|
||||||
|
|
||||||
if (mPendingTransitions != null && mPendingTransitions.size() > 0) {
|
|
||||||
for (int i = 0; i < mPendingTransitions.size(); ++i) {
|
|
||||||
mPendingTransitions.get(i).startChangingAnimations();
|
|
||||||
}
|
|
||||||
mPendingTransitions.clear();
|
|
||||||
}
|
|
||||||
if (!cancelDraw && !newSurface) {
|
if (!cancelDraw && !newSurface) {
|
||||||
|
if (mPendingTransitions != null && mPendingTransitions.size() > 0) {
|
||||||
|
for (int i = 0; i < mPendingTransitions.size(); ++i) {
|
||||||
|
mPendingTransitions.get(i).startChangingAnimations();
|
||||||
|
}
|
||||||
|
mPendingTransitions.clear();
|
||||||
|
}
|
||||||
mFullRedrawNeeded = false;
|
mFullRedrawNeeded = false;
|
||||||
|
|
||||||
final long drawStartTime;
|
final long drawStartTime;
|
||||||
@@ -1619,7 +1619,13 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// End any pending transitions on this non-visible window
|
||||||
|
if (mPendingTransitions != null && mPendingTransitions.size() > 0) {
|
||||||
|
for (int i = 0; i < mPendingTransitions.size(); ++i) {
|
||||||
|
mPendingTransitions.get(i).endChangingAnimations();
|
||||||
|
}
|
||||||
|
mPendingTransitions.clear();
|
||||||
|
}
|
||||||
// We were supposed to report when we are done drawing. Since we canceled the
|
// We were supposed to report when we are done drawing. Since we canceled the
|
||||||
// draw, remember it here.
|
// draw, remember it here.
|
||||||
if ((relayoutResult&WindowManagerImpl.RELAYOUT_FIRST_TIME) != 0) {
|
if ((relayoutResult&WindowManagerImpl.RELAYOUT_FIRST_TIME) != 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user