summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/layoutlib/bridge/src/android/graphics/drawable/VectorDrawable_Delegate.java23
-rw-r--r--tools/layoutlib/bridge/src/android/view/BridgeInflater.java12
-rw-r--r--tools/layoutlib/bridge/src/android/view/Choreographer_Delegate.java5
3 files changed, 15 insertions, 25 deletions
diff --git a/tools/layoutlib/bridge/src/android/graphics/drawable/VectorDrawable_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/drawable/VectorDrawable_Delegate.java
index eee74734fde5..174bbcf27806 100644
--- a/tools/layoutlib/bridge/src/android/graphics/drawable/VectorDrawable_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/drawable/VectorDrawable_Delegate.java
@@ -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() {
diff --git a/tools/layoutlib/bridge/src/android/view/BridgeInflater.java b/tools/layoutlib/bridge/src/android/view/BridgeInflater.java
index b19cb5860a63..b6e6ec008449 100644
--- a/tools/layoutlib/bridge/src/android/view/BridgeInflater.java
+++ b/tools/layoutlib/bridge/src/android/view/BridgeInflater.java
@@ -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();
+ }
+ }
+ }
}
}
diff --git a/tools/layoutlib/bridge/src/android/view/Choreographer_Delegate.java b/tools/layoutlib/bridge/src/android/view/Choreographer_Delegate.java
index 381eb1f50973..494ffa1518ab 100644
--- a/tools/layoutlib/bridge/src/android/view/Choreographer_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/view/Choreographer_Delegate.java
@@ -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);