diff options
3 files changed, 101 insertions, 13 deletions
diff --git a/tests/VectorDrawableTest/AndroidManifest.xml b/tests/VectorDrawableTest/AndroidManifest.xml index 28c5f33..113dce3 100644 --- a/tests/VectorDrawableTest/AndroidManifest.xml +++ b/tests/VectorDrawableTest/AndroidManifest.xml @@ -22,6 +22,25 @@ <application android:hardwareAccelerated="true" android:label="vector" > + + <activity + android:name="VectorDrawablePerformance" + android:label="Vector Performance" > + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + + <category android:name="com.android.test.dynamic.TEST" /> + </intent-filter> + + </activity> + <activity + android:name="VectorDrawableAnimation" + android:label="VectorTestAnimation" > + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="com.android.test.dynamic.TEST" /> + </intent-filter> + </activity> <activity android:name="VectorDrawableTest" android:label="Vector Icon" > @@ -41,19 +60,7 @@ <category android:name="com.android.test.dynamic.TEST" /> </intent-filter> </activity> - - <activity - android:name="VectorDrawablePerformance" - android:label="Vector Performance" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - - <category android:name="com.android.test.dynamic.TEST" /> - </intent-filter> - - </activity> - - <activity + <activity android:name="VectorDrawableDupPerf" android:label="Vector Performance of clones" > <intent-filter> diff --git a/tests/VectorDrawableTest/res/drawable/animation_drawable_vector.xml b/tests/VectorDrawableTest/res/drawable/animation_drawable_vector.xml new file mode 100644 index 0000000..a588960 --- /dev/null +++ b/tests/VectorDrawableTest/res/drawable/animation_drawable_vector.xml @@ -0,0 +1,36 @@ +<!-- + 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. +--> +<animation-list xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/animation_drawable_vector" android:oneshot="false"> + <item android:drawable="@drawable/vector_drawable01" android:duration="300" /> + <item android:drawable="@drawable/vector_drawable02" android:duration="300" /> + <item android:drawable="@drawable/vector_drawable03" android:duration="300" /> + <item android:drawable="@drawable/vector_drawable04" android:duration="300" /> + <item android:drawable="@drawable/vector_drawable05" android:duration="300" /> + <item android:drawable="@drawable/vector_drawable06" android:duration="300" /> + <item android:drawable="@drawable/vector_drawable07" android:duration="300" /> + <item android:drawable="@drawable/vector_drawable08" android:duration="300" /> + <item android:drawable="@drawable/vector_drawable09" android:duration="300" /> + <item android:drawable="@drawable/vector_drawable10" android:duration="300" /> + <item android:drawable="@drawable/vector_drawable11" android:duration="300" /> + <item android:drawable="@drawable/vector_drawable12" android:duration="300" /> + <item android:drawable="@drawable/vector_drawable13" android:duration="300" /> + <item android:drawable="@drawable/vector_drawable14" android:duration="300" /> + <item android:drawable="@drawable/vector_drawable15" android:duration="300" /> + <item android:drawable="@drawable/vector_drawable16" android:duration="300" /> + <item android:drawable="@drawable/vector_drawable17" android:duration="300" /> + <item android:drawable="@drawable/vector_drawable18" android:duration="300" /> + </animation-list> 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); + } + +} |
