summaryrefslogtreecommitdiffstats
path: root/tests/VectorDrawableTest
diff options
context:
space:
mode:
authorAndrew Flynn <flynn@google.com>2015-05-11 13:36:42 -0400
committerAndrew Flynn <flynn@google.com>2015-05-11 13:36:42 -0400
commit12c137ff3f2e7db6b0825f819a9346aa8834e3cb (patch)
tree8818ddcac56054f604b0e288e779dc014e7b5191 /tests/VectorDrawableTest
parentdbf62ace0dcb671f5eaa97c0dfa75e39bc9c88be (diff)
downloadframeworks_base-12c137ff3f2e7db6b0825f819a9346aa8834e3cb.zip
frameworks_base-12c137ff3f2e7db6b0825f819a9346aa8834e3cb.tar.gz
frameworks_base-12c137ff3f2e7db6b0825f819a9346aa8834e3cb.tar.bz2
AnimatedVectorDrawable Attr proof of concept
This crashes while trying to run due to the '?attr/color1' reference inside res/anim/blink.xml Bug: 20817800 Change-Id: Ie3ea24ac9b22e69af152d6ffe87c8c953929299c
Diffstat (limited to 'tests/VectorDrawableTest')
-rw-r--r--tests/VectorDrawableTest/AndroidManifest.xml11
-rw-r--r--tests/VectorDrawableTest/res/anim/blink.xml28
-rw-r--r--tests/VectorDrawableTest/res/drawable/animated_vector_drawable_attr_icon.xml93
-rw-r--r--tests/VectorDrawableTest/res/drawable/animated_vector_drawable_attr_icon_animated.xml21
-rw-r--r--tests/VectorDrawableTest/res/layout/activity_animated_vector_drawable_attr.xml37
-rw-r--r--tests/VectorDrawableTest/res/values/attrs.xml17
-rw-r--r--tests/VectorDrawableTest/res/values/colors.xml20
-rw-r--r--tests/VectorDrawableTest/res/values/styles.xml3
-rw-r--r--tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableAttr.java32
9 files changed, 261 insertions, 1 deletions
diff --git a/tests/VectorDrawableTest/AndroidManifest.xml b/tests/VectorDrawableTest/AndroidManifest.xml
index 991ec57..e648897 100644
--- a/tests/VectorDrawableTest/AndroidManifest.xml
+++ b/tests/VectorDrawableTest/AndroidManifest.xml
@@ -144,6 +144,15 @@
</intent-filter>
</activity>
<activity
+ android:name="AnimatedVectorDrawableAttr"
+ android:label="AnimatedVectorDrawable Attr Test" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="com.android.test.dynamic.TEST" />
+ </intent-filter>
+ </activity>
+ <activity
android:name="BoundsCheckTest"
android:label="SetBound check" >
<intent-filter>
@@ -154,4 +163,4 @@
</activity>
</application>
-</manifest> \ No newline at end of file
+</manifest>
diff --git a/tests/VectorDrawableTest/res/anim/blink.xml b/tests/VectorDrawableTest/res/anim/blink.xml
new file mode 100644
index 0000000..2af0b48
--- /dev/null
+++ b/tests/VectorDrawableTest/res/anim/blink.xml
@@ -0,0 +1,28 @@
+<!--
+ Copyright (C) 2015 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.
+-->
+<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
+ android:interpolator="@android:anim/linear_interpolator"
+ android:duration="@android:integer/config_longAnimTime"
+ android:repeatCount="-1"
+ android:repeatMode="reverse" >
+
+ <propertyValuesHolder
+ android:propertyName="fillColor"
+ android:valueType="colorType"
+ android:valueFrom="#ff3838"
+ android:valueTo="?attr/color1" />
+
+</objectAnimator>
diff --git a/tests/VectorDrawableTest/res/drawable/animated_vector_drawable_attr_icon.xml b/tests/VectorDrawableTest/res/drawable/animated_vector_drawable_attr_icon.xml
new file mode 100644
index 0000000..10a0970
--- /dev/null
+++ b/tests/VectorDrawableTest/res/drawable/animated_vector_drawable_attr_icon.xml
@@ -0,0 +1,93 @@
+<!--
+Copyright (C) 2015 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="250dp"
+ android:height="250dp"
+ android:viewportWidth="200"
+ android:viewportHeight="200">
+
+ <path
+ android:pathData="M-3.476563,-21.275826l34.441406,18.748753 0.000000,37.497501 -34.441406,18.748756 -34.441406,-18.718758 0.000000,-37.527500z"
+ android:strokeWidth="2.5"
+ android:fillColor="@color/color0"
+ android:strokeColor="@android:color/white"/>
+ <path
+ android:pathData="M65.5,-21.497507l34.441406,18.748756 0.000000,37.497498 -34.441406,18.748756 -34.441406,-18.718754 0.000000,-37.527496z"
+ android:strokeWidth="2.5"
+ android:fillColor="@color/color0"
+ android:strokeColor="@android:color/white"/>
+ <path
+ android:pathData="M202.75,-21.497507l34.441406,18.748756 0.000000,37.497498 -34.441406,18.748760 -34.441406,-18.718758 0.000000,-37.527496z"
+ android:strokeWidth="2.5"
+ android:fillColor="@color/color0"
+ android:strokeColor="@android:color/white"/>
+ <path
+ android:pathData="M134.125,-21.497505l34.441406,18.748756 0.000000,37.497498 -34.441406,18.748756 -34.441406,-18.718758 0.000000,-37.527496z"
+ android:strokeWidth="2.5"
+ android:fillColor="@color/color0"
+ android:strokeColor="@android:color/white"/>
+ <path
+ android:name="hex"
+ android:pathData="M99.8125,34.752495l34.441406,18.748753 0.000000,37.497501 -34.441406,18.748749 -34.441406,-18.718750 0.000000,-37.527500z"
+ android:strokeWidth="2.5"
+ android:fillColor="?attr/color1"
+ android:strokeColor="@android:color/white"/>
+ <path
+ android:pathData="M30.6875,34.689995l34.441406,18.748756 0.000000,37.497498 -34.441406,18.748749 -34.441406,-18.718750 0.000000,-37.527496z"
+ android:strokeWidth="2.5"
+ android:fillColor="@color/color0"
+ android:strokeColor="@android:color/white"/>
+ <path
+ android:pathData="M168.3125,35.002495l34.441406,18.748756 0.000000,37.497498 -34.441406,18.748749 -34.441406,-18.718750 0.000000,-37.527496z"
+ android:strokeWidth="2.5"
+ android:fillColor="@color/color0"
+ android:strokeColor="@android:color/white"/>
+ <path
+ android:pathData="M203.0,91.002495l34.441406,18.748756 0.000000,37.497498 -34.441406,18.748749 -34.441406,-18.718750 0.000000,-37.527496z"
+ android:strokeWidth="2.5"
+ android:fillColor="@color/color0"
+ android:strokeColor="@android:color/white"/>
+ <path
+ android:pathData="M133.8125,91.314995l34.441406,18.748756 0.000000,37.497498 -34.441406,18.748749 -34.441406,-18.718750 0.000000,-37.527496z"
+ android:strokeWidth="2.5"
+ android:fillColor="@color/color3"
+ android:strokeColor="@android:color/white"/>
+ <path
+ android:pathData="M65.0625,91.127495l34.441406,18.748756 0.000000,37.497498 -34.441406,18.748749 -34.441406,-18.718750 0.000000,-37.527496z"
+ android:strokeWidth="2.5"
+ android:fillColor="@color/color2"
+ android:strokeColor="@android:color/white"/>
+ <path
+ android:pathData="M-3.25,91.189995l34.441406,18.748756 0.000000,37.497498 -34.441406,18.748749 -34.441406,-18.718750 0.000000,-37.527496z"
+ android:strokeWidth="2.5"
+ android:fillColor="@color/color0"
+ android:strokeColor="@android:color/white"/>
+ <path
+ android:pathData="M31.0625,147.81499l34.441406,18.748764 0.000000,37.497498 -34.441406,18.748749 -34.441406,-18.718750 0.000000,-37.527496z"
+ android:strokeWidth="2.5"
+ android:fillColor="@color/color0"
+ android:strokeColor="@android:color/white"/>
+ <path
+ android:pathData="M99.625,147.37749l34.441406,18.748764 0.000000,37.497498 -34.441406,18.748749 -34.441406,-18.718750 0.000000,-37.527496z"
+ android:strokeWidth="2.5"
+ android:fillColor="@color/color0"
+ android:strokeColor="@android:color/white"/>
+ <path
+ android:pathData="M168.8125,147.50249l34.441406,18.748764 0.000000,37.497498 -34.441406,18.748749 -34.441406,-18.718750 0.000000,-37.527496z"
+ android:strokeWidth="2.5"
+ android:fillColor="@color/color0"
+ android:strokeColor="@android:color/white"/>
+</vector>
diff --git a/tests/VectorDrawableTest/res/drawable/animated_vector_drawable_attr_icon_animated.xml b/tests/VectorDrawableTest/res/drawable/animated_vector_drawable_attr_icon_animated.xml
new file mode 100644
index 0000000..7e65229
--- /dev/null
+++ b/tests/VectorDrawableTest/res/drawable/animated_vector_drawable_attr_icon_animated.xml
@@ -0,0 +1,21 @@
+<!--
+Copyright (C) 2015 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-vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:drawable="@drawable/animated_vector_drawable_attr_icon" >
+ <target
+ android:name="hex"
+ android:animation="@anim/blink" />
+</animated-vector>
diff --git a/tests/VectorDrawableTest/res/layout/activity_animated_vector_drawable_attr.xml b/tests/VectorDrawableTest/res/layout/activity_animated_vector_drawable_attr.xml
new file mode 100644
index 0000000..92680d5
--- /dev/null
+++ b/tests/VectorDrawableTest/res/layout/activity_animated_vector_drawable_attr.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="50dp"
+ android:src="@drawable/animated_vector_drawable_attr_icon"
+ android:theme="@style/ColorTheme" />
+
+ <ImageView
+ android:id="@+id/avd"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/animated_vector_drawable_attr_icon_animated"
+ android:theme="@style/ColorTheme" />
+
+</LinearLayout>
+
diff --git a/tests/VectorDrawableTest/res/values/attrs.xml b/tests/VectorDrawableTest/res/values/attrs.xml
new file mode 100644
index 0000000..98bf992
--- /dev/null
+++ b/tests/VectorDrawableTest/res/values/attrs.xml
@@ -0,0 +1,17 @@
+<!-- Copyright (C) 2015 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.
+-->
+<resources>
+ <attr name="color1" format="color" />
+</resources>
diff --git a/tests/VectorDrawableTest/res/values/colors.xml b/tests/VectorDrawableTest/res/values/colors.xml
new file mode 100644
index 0000000..6eb3036
--- /dev/null
+++ b/tests/VectorDrawableTest/res/values/colors.xml
@@ -0,0 +1,20 @@
+<!-- Copyright (C) 2015 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.
+-->
+<resources>
+ <color name="color0">#a6e4ea</color>
+ <color name="color1">#ff3838</color>
+ <color name="color2">#ffff51</color>
+ <color name="color3">#0ed300</color>
+</resources>
diff --git a/tests/VectorDrawableTest/res/values/styles.xml b/tests/VectorDrawableTest/res/values/styles.xml
index 460c0db..8adc034 100644
--- a/tests/VectorDrawableTest/res/values/styles.xml
+++ b/tests/VectorDrawableTest/res/values/styles.xml
@@ -13,4 +13,7 @@
limitations under the License.
-->
<resources>
+ <style name="ColorTheme">
+ <item name="color1">@color/color1</item>
+ </style>
</resources>
diff --git a/tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableAttr.java b/tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableAttr.java
new file mode 100644
index 0000000..8de2f6b
--- /dev/null
+++ b/tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableAttr.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2015 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.widget.ImageView;
+
+public class AnimatedVectorDrawableAttr extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_animated_vector_drawable_attr);
+
+ ImageView avdIv = (ImageView) findViewById(R.id.avd);
+ AnimatedVectorDrawable avd = (AnimatedVectorDrawable) avdIv.getDrawable();
+ avd.start();
+ }
+}