am c05c3628: Merge "Ensure that transitions animating alpha end on a reasonable value" into klp-dev
* commit 'c05c36285dbc715e851671cb4495d376743c4399': Ensure that transitions animating alpha end on a reasonable value
This commit is contained in:
@@ -91,6 +91,9 @@ public class Fade extends Visibility {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final ObjectAnimator anim = ObjectAnimator.ofFloat(view, "alpha", startAlpha, endAlpha);
|
final ObjectAnimator anim = ObjectAnimator.ofFloat(view, "alpha", startAlpha, endAlpha);
|
||||||
|
if (DBG) {
|
||||||
|
Log.d(LOG_TAG, "Created animator " + anim);
|
||||||
|
}
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
anim.addListener(listener);
|
anim.addListener(listener);
|
||||||
anim.addPauseListener(listener);
|
anim.addPauseListener(listener);
|
||||||
@@ -146,12 +149,41 @@ public class Fade extends Visibility {
|
|||||||
final View endView = endValues.view;
|
final View endView = endValues.view;
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
View startView = (startValues != null) ? startValues.view : null;
|
View startView = (startValues != null) ? startValues.view : null;
|
||||||
Log.d(LOG_TAG, "Fade.onDisappear: startView, startVis, endView, endVis = " +
|
Log.d(LOG_TAG, "Fade.onAppear: startView, startVis, endView, endVis = " +
|
||||||
startView + ", " + startVisibility + ", " + endView + ", " + endVisibility);
|
startView + ", " + startVisibility + ", " + endView + ", " + endVisibility);
|
||||||
}
|
}
|
||||||
// if alpha < 1, just fade it in from the current value
|
// if alpha < 1, just fade it in from the current value
|
||||||
if (endView.getAlpha() == 1.0f) {
|
if (endView.getAlpha() == 1.0f) {
|
||||||
endView.setAlpha(0);
|
endView.setAlpha(0);
|
||||||
|
TransitionListener transitionListener = new TransitionListenerAdapter() {
|
||||||
|
boolean mCanceled = false;
|
||||||
|
float mPausedAlpha;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTransitionCancel(Transition transition) {
|
||||||
|
endView.setAlpha(1);
|
||||||
|
mCanceled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTransitionEnd(Transition transition) {
|
||||||
|
if (!mCanceled) {
|
||||||
|
endView.setAlpha(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTransitionPause(Transition transition) {
|
||||||
|
mPausedAlpha = endView.getAlpha();
|
||||||
|
endView.setAlpha(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTransitionResume(Transition transition) {
|
||||||
|
endView.setAlpha(mPausedAlpha);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
addListener(transitionListener);
|
||||||
}
|
}
|
||||||
return createAnimation(endView, endView.getAlpha(), 1, null);
|
return createAnimation(endView, endView.getAlpha(), 1, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1240,12 +1240,13 @@ public abstract class Transition implements Cloneable {
|
|||||||
View oldView = oldInfo.view;
|
View oldView = oldInfo.view;
|
||||||
TransitionValues newValues = mEndValues.viewValues != null ?
|
TransitionValues newValues = mEndValues.viewValues != null ?
|
||||||
mEndValues.viewValues.get(oldView) : null;
|
mEndValues.viewValues.get(oldView) : null;
|
||||||
|
if (newValues == null) {
|
||||||
|
newValues = mEndValues.idValues.get(oldView.getId());
|
||||||
|
}
|
||||||
if (oldValues != null) {
|
if (oldValues != null) {
|
||||||
// if oldValues null, then transition didn't care to stash values,
|
// if oldValues null, then transition didn't care to stash values,
|
||||||
// and won't get canceled
|
// and won't get canceled
|
||||||
if (newValues == null) {
|
if (newValues != null) {
|
||||||
cancel = true;
|
|
||||||
} else {
|
|
||||||
for (String key : oldValues.values.keySet()) {
|
for (String key : oldValues.values.keySet()) {
|
||||||
Object oldValue = oldValues.values.get(key);
|
Object oldValue = oldValues.values.get(key);
|
||||||
Object newValue = newValues.values.get(key);
|
Object newValue = newValues.values.get(key);
|
||||||
|
|||||||
@@ -349,23 +349,19 @@ public class TransitionManager {
|
|||||||
* value of null causes the TransitionManager to use the default transition.
|
* value of null causes the TransitionManager to use the default transition.
|
||||||
*/
|
*/
|
||||||
public static void beginDelayedTransition(final ViewGroup sceneRoot, Transition transition) {
|
public static void beginDelayedTransition(final ViewGroup sceneRoot, Transition transition) {
|
||||||
|
if (!sPendingTransitions.contains(sceneRoot) && sceneRoot.isLaidOut()) {
|
||||||
// TEMPORARY: disabling delayed transitions until a fix for the various ActionBar-
|
if (Transition.DBG) {
|
||||||
// triggered artifacts is found
|
Log.d(LOG_TAG, "beginDelayedTransition: root, transition = " +
|
||||||
|
sceneRoot + ", " + transition);
|
||||||
// if (!sPendingTransitions.contains(sceneRoot) && sceneRoot.isLaidOut()) {
|
}
|
||||||
// if (Transition.DBG) {
|
sPendingTransitions.add(sceneRoot);
|
||||||
// Log.d(LOG_TAG, "beginDelayedTransition: root, transition = " +
|
if (transition == null) {
|
||||||
// sceneRoot + ", " + transition);
|
transition = sDefaultTransition;
|
||||||
// }
|
}
|
||||||
// sPendingTransitions.add(sceneRoot);
|
final Transition transitionClone = transition.clone();
|
||||||
// if (transition == null) {
|
sceneChangeSetup(sceneRoot, transitionClone);
|
||||||
// transition = sDefaultTransition;
|
Scene.setCurrentScene(sceneRoot, null);
|
||||||
// }
|
sceneChangeRunTransition(sceneRoot, transitionClone);
|
||||||
// final Transition transitionClone = transition.clone();
|
}
|
||||||
// sceneChangeSetup(sceneRoot, transitionClone);
|
|
||||||
// Scene.setCurrentScene(sceneRoot, null);
|
|
||||||
// sceneChangeRunTransition(sceneRoot, transitionClone);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user