Merge "Null check for fade start alpha value." into nyc-dev
This commit is contained in:
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package android.transition;
|
package android.transition;
|
||||||
|
|
||||||
import com.android.internal.R;
|
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
@@ -28,6 +26,8 @@ import android.util.Log;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import com.android.internal.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This transition tracks changes to the visibility of target views in the
|
* This transition tracks changes to the visibility of target views in the
|
||||||
* start and end scenes and fades views in or out when they become visible
|
* start and end scenes and fades views in or out when they become visible
|
||||||
@@ -144,12 +144,9 @@ public class Fade extends Visibility {
|
|||||||
Log.d(LOG_TAG, "Fade.onAppear: startView, startVis, endView, endVis = " +
|
Log.d(LOG_TAG, "Fade.onAppear: startView, startVis, endView, endVis = " +
|
||||||
startView + ", " + view);
|
startView + ", " + view);
|
||||||
}
|
}
|
||||||
float startAlpha = 0;
|
float startAlpha = getStartAlpha(startValues, 0);
|
||||||
if (startValues != null) {
|
if (startAlpha == 1) {
|
||||||
startAlpha = (Float) startValues.values.get(PROPNAME_TRANSITION_ALPHA);
|
startAlpha = 0;
|
||||||
if (startAlpha == 1) {
|
|
||||||
startAlpha = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return createAnimation(view, startAlpha, 1);
|
return createAnimation(view, startAlpha, 1);
|
||||||
}
|
}
|
||||||
@@ -157,13 +154,21 @@ public class Fade extends Visibility {
|
|||||||
@Override
|
@Override
|
||||||
public Animator onDisappear(ViewGroup sceneRoot, final View view, TransitionValues startValues,
|
public Animator onDisappear(ViewGroup sceneRoot, final View view, TransitionValues startValues,
|
||||||
TransitionValues endValues) {
|
TransitionValues endValues) {
|
||||||
float startAlpha = 1;
|
float startAlpha = getStartAlpha(startValues, 1);
|
||||||
if (startValues != null) {
|
|
||||||
startAlpha = (Float) startValues.values.get(PROPNAME_TRANSITION_ALPHA);
|
|
||||||
}
|
|
||||||
return createAnimation(view, startAlpha, 0);
|
return createAnimation(view, startAlpha, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static float getStartAlpha(TransitionValues startValues, float fallbackValue) {
|
||||||
|
float startAlpha = fallbackValue;
|
||||||
|
if (startValues != null) {
|
||||||
|
Float startAlphaFloat = (Float) startValues.values.get(PROPNAME_TRANSITION_ALPHA);
|
||||||
|
if (startAlphaFloat != null) {
|
||||||
|
startAlpha = startAlphaFloat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return startAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
private static class FadeAnimatorListener extends AnimatorListenerAdapter {
|
private static class FadeAnimatorListener extends AnimatorListenerAdapter {
|
||||||
private final View mView;
|
private final View mView;
|
||||||
private boolean mLayerTypeChanged = false;
|
private boolean mLayerTypeChanged = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user