diff options
author | ztenghui <ztenghui@google.com> | 2014-06-03 14:02:10 -0700 |
---|---|---|
committer | ztenghui <ztenghui@google.com> | 2014-06-12 13:18:59 -0700 |
commit | e5e92602a41a4ddc7b42cd1c171a0edfbd09b8da (patch) | |
tree | d1ca259815244f1f51c59f5853f6b5bcfd0e0858 /tests/VectorDrawableTest/src/com | |
parent | 88b00784684d7b706c7b0c4e833b1d67d73358b9 (diff) | |
download | frameworks_base-e5e92602a41a4ddc7b42cd1c171a0edfbd09b8da.zip frameworks_base-e5e92602a41a4ddc7b42cd1c171a0edfbd09b8da.tar.gz frameworks_base-e5e92602a41a4ddc7b42cd1c171a0edfbd09b8da.tar.bz2 |
Add AnimatedVectorDrawable
Currently as a hidden class.
It can support many the animations now as far as ObjectAnimator and
hierarchical group can support.
And we don't have path morphing yet.
Also support the Animator / Interpolator inflation from Context and Resources.
Change-Id: I948bbdf7373ad291171eed0b497959dce8c2edf3
Diffstat (limited to 'tests/VectorDrawableTest/src/com')
-rw-r--r-- | tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableTest.java | 42 | ||||
-rw-r--r-- | tests/VectorDrawableTest/src/com/android/test/dynamic/VectorDrawableAnimation.java | 3 |
2 files changed, 44 insertions, 1 deletions
diff --git a/tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableTest.java b/tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableTest.java new file mode 100644 index 0000000..6e864fa --- /dev/null +++ b/tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableTest.java @@ -0,0 +1,42 @@ +/* + * 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 com.android.test.dynamic; + +import android.app.Activity; +import android.graphics.drawable.AnimatedVectorDrawable; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +public class AnimatedVectorDrawableTest extends Activity { + private static final String LOGCAT = "VectorDrawableAnimationTest"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + Button button = new Button(this); + button.setBackgroundResource(R.drawable.animation_vector_drawable01); + button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + AnimatedVectorDrawable frameAnimation = (AnimatedVectorDrawable) v.getBackground(); + frameAnimation.start(); + } + }); + + setContentView(button); + } +} diff --git a/tests/VectorDrawableTest/src/com/android/test/dynamic/VectorDrawableAnimation.java b/tests/VectorDrawableTest/src/com/android/test/dynamic/VectorDrawableAnimation.java index 99de037..93b06b6 100644 --- a/tests/VectorDrawableTest/src/com/android/test/dynamic/VectorDrawableAnimation.java +++ b/tests/VectorDrawableTest/src/com/android/test/dynamic/VectorDrawableAnimation.java @@ -14,6 +14,7 @@ package com.android.test.dynamic; +import android.animation.ValueAnimator; import android.app.Activity; import android.graphics.drawable.AnimationDrawable; import android.os.Bundle; @@ -27,7 +28,7 @@ public class VectorDrawableAnimation extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - Button button = new Button(this); + final Button button = new Button(this); button.setBackgroundResource(R.drawable.animation_drawable_vector); button.setOnClickListener(new View.OnClickListener() { |