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

Commit 70802d25 authored by Alan Viverette's avatar Alan Viverette
Browse files

Fix VectorDrawable states

BUG: 14083130
Change-Id: I8242523d9a4acd499154d2e7b9b9b52a3f1f742d
parent 8aa68921
Loading
Loading
Loading
Loading
+20 −20
Original line number Diff line number Diff line
@@ -27,24 +27,27 @@

    <group>
        <path
            android:name="check"
            android:pathData="M 232.1,80.6 L 248.5,92.1 L 145.2,239.5 L 71.5,187.8 L 83,171.5 L 140.3,211.7 z"
            android:fill="?attr/colorControlActivated" />
            android:name="box1"
            android:pathData="M 240,80 L 240,240 L 80,240 L 80,80 L 240,80 L 240,80 z"
            android:stroke="?attr/colorControlNormal"
            android:strokeWidth="20"
            android:strokeLineCap="round"
            android:strokeLineJoin="round" />
    </group>
    <group>
        <path
            android:name="box1"
            android:pathData="M 160,216.5 L 143.5,240 L 120,223.5 L 136.5,200 L 160,216.5 L 160,216.5 z"
            android:fill="?attr/colorControlActivated"
            android:stroke="?attr/colorControlActivated"
            android:name="box2"
            android:pathData="M 160,200 L 160,240 L 120,240 L 120,200 L 160,200 L 160,200 z"
            android:stroke="?attr/colorControlNormal"
            android:strokeWidth="10"
            android:strokeLineCap="round"
            android:strokeLineJoin="round" />
    </group>
    <group>
        <path
            android:name="box2"
            android:name="box3"
            android:pathData="M 160,216.5 L 143.5,240 L 120,223.5 L 136.5,200 L 160,216.5 L 160,216.5 z"
            android:rotation="-35"
            android:rotation="35"
            android:pivotX="140"
            android:pivotY="220"
            android:fill="?attr/colorControlNormal"
@@ -55,25 +58,22 @@
    </group>
    <group>
        <path
            android:name="box3"
            android:pathData="M 160,200 L 160,240 L 120,240 L 120,200 L 160,200 L 160,200 z"
            android:stroke="?attr/colorControlNormal"
            android:strokeWidth="10"
            android:name="box4"
            android:pathData="M 160,216.5 L 143.5,240 L 120,223.5 L 136.5,200 L 160,216.5 L 160,216.5 z"
            android:fill="?attr/colorControlActivated"
            android:stroke="?attr/colorControlActivated"
            android:strokeLineCap="round"
            android:strokeLineJoin="round" />
    </group>
    <group>
        <path
            android:name="box4"
            android:pathData="M 240,80 L 240,240 L 80,240 L 80,80 L 240,80 L 240,80 z"
            android:stroke="?attr/colorControlNormal"
            android:strokeWidth="20"
            android:strokeLineCap="round"
            android:strokeLineJoin="round" />
            android:name="check"
            android:pathData="M 232.1,80.6 L 248.5,92.1 L 145.2,239.5 L 71.5,187.8 L 83,171.5 L 140.3,211.7 z"
            android:fill="?attr/colorControlActivated" />
    </group>

    <animation
        android:durations="300,100,0,300"
        android:sequence="check,box1,box2,box3,box4" />
        android:sequence="box1,box2,box3,box4,check" />

</vector>
+11 −5
Original line number Diff line number Diff line
@@ -182,14 +182,14 @@ public class VectorDrawable extends Drawable {

    public VectorDrawable() {
        mVectorState = new VectorDrawableState(null);
        mVectorState.mBasicAnimator = ObjectAnimator.ofFloat(this, "AnimationFraction", 0, 1);
        mVectorState.mBasicAnimator = ObjectAnimator.ofFloat(this, "AnimationFraction", 0, 0);

        setDuration(DEFAULT_DURATION);
    }

    private VectorDrawable(VectorDrawableState state, Resources res, Theme theme) {
        mVectorState = new VectorDrawableState(state);
        mVectorState.mBasicAnimator = ObjectAnimator.ofFloat(this, "AnimationFraction", 0, 1);
        mVectorState.mBasicAnimator = ObjectAnimator.ofFloat(this, "AnimationFraction", 0, 0);

        if (theme != null && canApplyTheme()) {
            applyTheme(theme);
@@ -213,7 +213,7 @@ public class VectorDrawable extends Drawable {

    @Override
    public void jumpToCurrentState() {
        mVectorState.mBasicAnimator.end();
        stop();
    }

    /**
@@ -318,7 +318,7 @@ public class VectorDrawable extends Drawable {

    private void animateBackward() {
        if (!mVectorState.mBasicAnimator.isStarted()) {
            mVectorState.mBasicAnimator.setFloatValues(.99f, 0);
            mVectorState.mBasicAnimator.setFloatValues(1, 0);
            start();
        }
    }
@@ -985,7 +985,13 @@ public class VectorDrawable extends Drawable {

                for (int j = 0; j < sp.length; j++) {
                    mSeqMap.add(sp[j].trim());
                    VectorDrawable.VPath path = groups.get(j).get(sp[j]);

                    final VectorDrawable.VPath path = groups.get(j).get(sp[j]);
                    if (path == null) {
                        throw new XmlPullParserException(a.getPositionDescription()
                                + " missing path with name: " + sp[j]);
                    }

                    path.mAnimated = true;
                    paths[j] = path;
                }