diff options
author | Deepanshu Gupta <deepanshu@google.com> | 2014-10-28 15:07:25 -0700 |
---|---|---|
committer | Deepanshu Gupta <deepanshu@google.com> | 2014-10-28 15:07:25 -0700 |
commit | 0b42936d860238be9321f05cf70e934f81b94d72 (patch) | |
tree | f44b357f91bb992862622cb0ea09d20991163991 | |
parent | 5c0ed74b3886c5765c576e9e427b93c76b37635a (diff) | |
download | frameworks_base-0b42936d860238be9321f05cf70e934f81b94d72.zip frameworks_base-0b42936d860238be9321f05cf70e934f81b94d72.tar.gz frameworks_base-0b42936d860238be9321f05cf70e934f81b94d72.tar.bz2 |
Skip loading animations.
This is a temporary fix until Path.approximate() is supported.
Bug: http://b.android.com/77865
Change-Id: I28739e58f51fabaaf1dcc1c9be61cd0b17e84eec
3 files changed, 104 insertions, 0 deletions
diff --git a/tools/layoutlib/bridge/src/android/animation/AnimatorInflater_Delegate.java b/tools/layoutlib/bridge/src/android/animation/AnimatorInflater_Delegate.java new file mode 100644 index 0000000..8ced2db --- /dev/null +++ b/tools/layoutlib/bridge/src/android/animation/AnimatorInflater_Delegate.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.animation; + +import com.android.tools.layoutlib.annotations.LayoutlibDelegate; + +import android.content.Context; +import android.content.res.Resources; +import android.content.res.Resources.NotFoundException; +import android.content.res.Resources.Theme; + +/** + * Delegate providing alternate implementation to static methods in {@link AnimatorInflater}. + */ +public class AnimatorInflater_Delegate { + + @LayoutlibDelegate + /*package*/ static Animator loadAnimator(Context context, int id) + throws NotFoundException { + return loadAnimator(context.getResources(), context.getTheme(), id); + } + + @LayoutlibDelegate + /*package*/ static Animator loadAnimator(Resources resources, Theme theme, int id) + throws NotFoundException { + return loadAnimator(resources, theme, id, 1); + } + + @LayoutlibDelegate + /*package*/ static Animator loadAnimator(Resources resources, Theme theme, int id, + float pathErrorScale) throws NotFoundException { + // This is a temporary fix to http://b.android.com/77865. This skips loading the + // animation altogether. + // TODO: Remove this override when Path.approximate() is supported. + return new FakeAnimator(); + } +} diff --git a/tools/layoutlib/bridge/src/android/animation/FakeAnimator.java b/tools/layoutlib/bridge/src/android/animation/FakeAnimator.java new file mode 100644 index 0000000..78aedc5 --- /dev/null +++ b/tools/layoutlib/bridge/src/android/animation/FakeAnimator.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.animation; + +/** + * A fake implementation of Animator which doesn't do anything. + */ +public class FakeAnimator extends Animator { + @Override + public long getStartDelay() { + return 0; + } + + @Override + public void setStartDelay(long startDelay) { + + } + + @Override + public Animator setDuration(long duration) { + return this; + } + + @Override + public long getDuration() { + return 0; + } + + @Override + public void setInterpolator(TimeInterpolator value) { + + } + + @Override + public boolean isRunning() { + return false; + } +} diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java index f20b890..c8984f9 100644 --- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java +++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java @@ -137,6 +137,7 @@ public final class CreateInfo implements ICreateInfo { * The list of methods to rewrite as delegates. */ public final static String[] DELEGATE_METHODS = new String[] { + "android.animation.AnimatorInflater#loadAnimator", // TODO: remove when Path.approximate() is supported. "android.app.Fragment#instantiate", //(Landroid/content/Context;Ljava/lang/String;Landroid/os/Bundle;)Landroid/app/Fragment;", "android.content.res.Resources$Theme#obtainStyledAttributes", "android.content.res.Resources$Theme#resolveAttribute", |