summaryrefslogtreecommitdiffstats
path: root/tests/VectorDrawableTest
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-07-03 19:03:21 -0700
committerAlan Viverette <alanv@google.com>2014-07-03 19:03:21 -0700
commitf456b1f078639a422f966ef2e9376cbd5ae3d274 (patch)
treea1848ffd77785c40daeb286232ea12ba5f1d18e3 /tests/VectorDrawableTest
parent40d43b27b4f5fba75b040c24f95a170959811fd8 (diff)
downloadframeworks_base-f456b1f078639a422f966ef2e9376cbd5ae3d274.zip
frameworks_base-f456b1f078639a422f966ef2e9376cbd5ae3d274.tar.gz
frameworks_base-f456b1f078639a422f966ef2e9376cbd5ae3d274.tar.bz2
Update AnimatedStateListDrawable to work with Animatable drawables
BUG: 16016730 Change-Id: I6d02a1235c0aecd7e62f12226f3689372d043ddd
Diffstat (limited to 'tests/VectorDrawableTest')
-rw-r--r--tests/VectorDrawableTest/AndroidManifest.xml9
-rw-r--r--tests/VectorDrawableTest/res/drawable/state_animation_vector_drawable.xml47
-rw-r--r--tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedStateVectorDrawableTest.java52
3 files changed, 108 insertions, 0 deletions
diff --git a/tests/VectorDrawableTest/AndroidManifest.xml b/tests/VectorDrawableTest/AndroidManifest.xml
index 613660c13..56fa0a9 100644
--- a/tests/VectorDrawableTest/AndroidManifest.xml
+++ b/tests/VectorDrawableTest/AndroidManifest.xml
@@ -71,6 +71,15 @@
</intent-filter>
</activity>
<activity
+ android:name="AnimatedStateVectorDrawableTest"
+ android:label="AnimatedStateList and AnimatedVectorDrawable" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="com.android.test.dynamic.TEST" />
+ </intent-filter>
+ </activity>
+ <activity
android:name="VectorDrawable01"
android:label="VectorTest1" >
<intent-filter>
diff --git a/tests/VectorDrawableTest/res/drawable/state_animation_vector_drawable.xml b/tests/VectorDrawableTest/res/drawable/state_animation_vector_drawable.xml
new file mode 100644
index 0000000..30fb1b8
--- /dev/null
+++ b/tests/VectorDrawableTest/res/drawable/state_animation_vector_drawable.xml
@@ -0,0 +1,47 @@
+<!--
+ 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.
+-->
+
+<animated-selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/on" android:state_checked="true"
+ android:drawable="@drawable/vector_drawable12" />
+ <item android:id="@+id/off"
+ android:drawable="@drawable/vector_drawable12" />
+ <transition android:fromId="@+id/off" android:toId="@+id/on">
+ <animated-vector android:drawable="@drawable/vector_drawable12">
+ <target
+ android:name="pie1"
+ android:animation="@anim/trim_path_animation01" />
+ <target
+ android:name="v"
+ android:animation="@anim/trim_path_animation02" />
+ <target
+ android:name="v"
+ android:animation="@anim/trim_path_animation05" />
+ <target
+ android:name="rotationGroup"
+ android:animation="@anim/trim_path_animation03" />
+ <target
+ android:name="rotationGroup3"
+ android:animation="@anim/trim_path_animation03" />
+ <target
+ android:name="rotationGroupBlue"
+ android:animation="@anim/trim_path_animation03" />
+ <target
+ android:name="rotationGroup"
+ android:animation="@anim/trim_path_animation04" />
+ </animated-vector>
+ </transition>
+</animated-selector>
diff --git a/tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedStateVectorDrawableTest.java b/tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedStateVectorDrawableTest.java
new file mode 100644
index 0000000..0ae0136
--- /dev/null
+++ b/tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedStateVectorDrawableTest.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 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;
+import android.widget.CheckBox;
+import android.widget.GridLayout;
+import android.widget.ScrollView;
+
+public class AnimatedStateVectorDrawableTest extends Activity {
+ private static final String LOGCAT = "AnimatedStateVectorDrawableTest";
+
+ protected int[] icon = {
+ R.drawable.state_animation_vector_drawable
+ };
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ ScrollView scrollView = new ScrollView(this);
+ GridLayout container = new GridLayout(this);
+ scrollView.addView(container);
+ container.setColumnCount(1);
+
+ for (int i = 0; i < icon.length; i++) {
+ CheckBox button = new CheckBox(this);
+ button.setWidth(400);
+ button.setHeight(400);
+ button.setBackgroundResource(icon[i]);
+ container.addView(button);
+ }
+
+ setContentView(scrollView);
+ }
+}