diff options
author | ztenghui <ztenghui@google.com> | 2014-06-03 14:02:10 -0700 |
---|---|---|
committer | ztenghui <ztenghui@google.com> | 2014-06-03 14:26:29 -0700 |
commit | 7ac18b84459cf05a7fbc069d5e9900f411485992 (patch) | |
tree | ca5a15ad7c6e46395caeda41b7a22847660408f1 /tests/VectorDrawableTest/src/com | |
parent | 4af26e7c98ccfe51c6c17ab292875441c6039131 (diff) | |
download | frameworks_base-7ac18b84459cf05a7fbc069d5e9900f411485992.zip frameworks_base-7ac18b84459cf05a7fbc069d5e9900f411485992.tar.gz frameworks_base-7ac18b84459cf05a7fbc069d5e9900f411485992.tar.bz2 |
Add AnimationDrawable test
Change-Id: Ieabd1f628cdccd4939f733f92c0cbefbf8bc0446
Diffstat (limited to 'tests/VectorDrawableTest/src/com')
-rw-r--r-- | tests/VectorDrawableTest/src/com/android/test/dynamic/VectorDrawableAnimation.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/VectorDrawableTest/src/com/android/test/dynamic/VectorDrawableAnimation.java b/tests/VectorDrawableTest/src/com/android/test/dynamic/VectorDrawableAnimation.java new file mode 100644 index 0000000..99de037 --- /dev/null +++ b/tests/VectorDrawableTest/src/com/android/test/dynamic/VectorDrawableAnimation.java @@ -0,0 +1,45 @@ +/* + * 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.AnimationDrawable; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +public class VectorDrawableAnimation extends Activity { + private static final String LOGCAT = "VectorDrawableAnimation"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + Button button = new Button(this); + button.setBackgroundResource(R.drawable.animation_drawable_vector); + + button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + AnimationDrawable frameAnimation = (AnimationDrawable) v.getBackground(); + // Start the animation (looped playback by default). + frameAnimation.start(); + } + }); + + setContentView(button); + } + +} |