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

Commit 646b7817 authored by Diego Perez's avatar Diego Perez Committed by Android (Google) Code Review
Browse files

Merge "Fixes for animated vector drawables"

parents 89c376ed 4b0e6040
Loading
Loading
Loading
Loading
+0 −23
Original line number Diff line number Diff line
@@ -863,29 +863,6 @@ public class VectorDrawable_Delegate {
            }

            mLocalMatrix.set(copy.mLocalMatrix);

            final ArrayList<Object> children = copy.mChildren;
            //noinspection ForLoopReplaceableByForEach
            for (int i = 0; i < children.size(); i++) {
                Object copyChild = children.get(i);
                if (copyChild instanceof VGroup_Delegate) {
                    VGroup_Delegate copyGroup = (VGroup_Delegate) copyChild;
                    mChildren.add(new VGroup_Delegate(copyGroup, targetsMap));
                } else {
                    VPath_Delegate newPath;
                    if (copyChild instanceof VFullPath_Delegate) {
                        newPath = new VFullPath_Delegate((VFullPath_Delegate) copyChild);
                    } else if (copyChild instanceof VClipPath_Delegate) {
                        newPath = new VClipPath_Delegate((VClipPath_Delegate) copyChild);
                    } else {
                        throw new IllegalStateException("Unknown object in the tree!");
                    }
                    mChildren.add(newPath);
                    if (newPath.mPathName != null) {
                        targetsMap.put(newPath.mPathName, newPath);
                    }
                }
            }
        }

        private VGroup_Delegate() {
+12 −0
Original line number Diff line number Diff line
@@ -38,7 +38,10 @@ import org.xmlpull.v1.XmlPullParser;
import android.annotation.NonNull;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.NumberPicker;

import java.io.File;
@@ -401,6 +404,15 @@ public final class BridgeInflater extends LayoutInflater {
                    numberPicker.setMaxValue(Integer.parseInt(maxValue));
                }
            }
            else if (view instanceof ImageView) {
                ImageView img = (ImageView) view;
                Drawable drawable = img.getDrawable();
                if (drawable instanceof Animatable) {
                    if (!((Animatable) drawable).isRunning()) {
                        ((Animatable) drawable).start();
                    }
                }
            }

        }
    }
+3 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.view;
import com.android.ide.common.rendering.api.LayoutLog;
import com.android.layoutlib.bridge.Bridge;
import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
import com.android.tools.layoutlib.java.System_Delegate;

import java.lang.reflect.Field;
import java.util.concurrent.atomic.AtomicReference;
@@ -54,8 +55,8 @@ public class Choreographer_Delegate {
    public static void doFrame(long frameTimeNanos) {
        Choreographer thisChoreographer = Choreographer.getInstance();

        thisChoreographer.mLastFrameTimeNanos = frameTimeNanos;

        thisChoreographer.mLastFrameTimeNanos = frameTimeNanos - thisChoreographer
                .getFrameIntervalNanos();
        thisChoreographer.mFrameInfo.markInputHandlingStart();
        thisChoreographer.doCallbacks(Choreographer.CALLBACK_INPUT, frameTimeNanos);