Add AnimationDrawable test

Change-Id: Ieabd1f628cdccd4939f733f92c0cbefbf8bc0446
This commit is contained in:
ztenghui
2014-06-03 14:02:10 -07:00
parent 4af26e7c98
commit 7ac18b8445
3 changed files with 101 additions and 13 deletions

View File

@@ -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>

View File

@@ -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>

View File

@@ -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);
}
}