Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa006133 authored by Chet Haase's avatar Chet Haase
Browse files

Enable transitions in lockscreen media controller

Media controller now fades between different states. The code for
doing this was already there, but this CL enables them and changes
the behavior of transition's OnPreDrawListener to do the right thing.

Also, this CL fixes a bug in ChangeText found while testing this change.

Issue #11083563 ChangeText transition crashes when KEEP transition type used

Change-Id: I5e04c28e1b5faac017b0a4e49734d9faa7fe79cd
parent 76a5c86d
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -179,8 +179,8 @@ public class ChangeText extends Transition {
            startSelectionStart = startSelectionEnd = endSelectionStart = endSelectionEnd = -1;
        }
        if (!startText.equals(endText)) {
            final int startColor = (Integer) startVals.get(PROPNAME_TEXT_COLOR);
            final int endColor = (Integer) endVals.get(PROPNAME_TEXT_COLOR);
            final int startColor;
            final int endColor;
            if (mChangeBehavior != CHANGE_BEHAVIOR_IN) {
                view.setText(startText);
                if (view instanceof EditText) {
@@ -189,6 +189,7 @@ public class ChangeText extends Transition {
            }
            Animator anim;
            if (mChangeBehavior == CHANGE_BEHAVIOR_KEEP) {
                startColor = endColor = 0;
                anim = ValueAnimator.ofFloat(0, 1);
                anim.addListener(new AnimatorListenerAdapter() {
                    @Override
@@ -203,6 +204,8 @@ public class ChangeText extends Transition {
                    }
                });
            } else {
                startColor = (Integer) startVals.get(PROPNAME_TEXT_COLOR);
                endColor = (Integer) endVals.get(PROPNAME_TEXT_COLOR);
                // Fade out start text
                ValueAnimator outAnim = null, inAnim = null;
                if (mChangeBehavior == CHANGE_BEHAVIOR_OUT_IN ||
+1 −6
Original line number Diff line number Diff line
@@ -240,12 +240,7 @@ public class TransitionManager {
                    }
                    transition.playTransition(sceneRoot);

                    // Returning false from onPreDraw() skips the current frame. This is
                    // necessary to avoid artifacts caused by resetting target views
                    // to their proper end states for capturing. Waiting until the next
                    // frame to draw allows these views to have their mid-transition
                    // values set on them again and avoid artifacts.
                    return false;
                    return true;
                }
            };
            observer.addOnPreDrawListener(listener);
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ public class KeyguardTransportControlView extends FrameLayout {
    protected static final boolean DEBUG = false;
    protected static final String TAG = "TransportControlView";

    private static final boolean ANIMATE_TRANSITIONS = false;
    private static final boolean ANIMATE_TRANSITIONS = true;

    private ViewGroup mMetadataContainer;
    private ViewGroup mInfoContainer;