summaryrefslogtreecommitdiff
path: root/tests/VectorDrawableTest
diff options
context:
space:
mode:
authorztenghui <ztenghui@google.com>2014-06-09 13:14:19 -0700
committerztenghui <ztenghui@google.com>2014-06-20 15:16:47 -0700
commiteb034fbca40006c55db143047eb628c4b657730a (patch)
treecfb5b58e402b3187d5b37d2e2d428c2dce247cea /tests/VectorDrawableTest
parent17e64ffd852f8fe23b8e2e2ff1b62ee742af17a6 (diff)
AVD now support path morphing.
Basically extended the ValueAnimator to support a new type: pathType. Add the PathDataEvaluator internally to interpolate path data. Update test to show the path morphing. Change-Id: I89db0199cbc12e3041790a6115f3f50b80213cdb
Diffstat (limited to 'tests/VectorDrawableTest')
-rw-r--r--tests/VectorDrawableTest/res/anim/trim_path_animation05.xml35
-rw-r--r--tests/VectorDrawableTest/res/drawable/animation_vector_drawable01.xml6
-rw-r--r--tests/VectorDrawableTest/res/drawable/vector_drawable12.xml14
-rw-r--r--tests/VectorDrawableTest/res/values/strings.xml7
4 files changed, 51 insertions, 11 deletions
diff --git a/tests/VectorDrawableTest/res/anim/trim_path_animation05.xml b/tests/VectorDrawableTest/res/anim/trim_path_animation05.xml
new file mode 100644
index 000000000000..7012f4b721b0
--- /dev/null
+++ b/tests/VectorDrawableTest/res/anim/trim_path_animation05.xml
@@ -0,0 +1,35 @@
+<?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.
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:ordering="sequentially" >
+
+ <objectAnimator
+ android:duration="3000"
+ android:propertyName="pathData"
+ android:valueFrom="@string/triangle"
+ android:valueTo="@string/rectangle"
+ android:valueType="pathType"/>
+
+ <objectAnimator
+ android:duration="3000"
+ android:propertyName="pathData"
+ android:valueFrom="@string/rectangle2"
+ android:valueTo="@string/equal2"
+ android:valueType="pathType"/>
+
+</set> \ No newline at end of file
diff --git a/tests/VectorDrawableTest/res/drawable/animation_vector_drawable01.xml b/tests/VectorDrawableTest/res/drawable/animation_vector_drawable01.xml
index 0900b7c24af7..b37b19fb254e 100644
--- a/tests/VectorDrawableTest/res/drawable/animation_vector_drawable01.xml
+++ b/tests/VectorDrawableTest/res/drawable/animation_vector_drawable01.xml
@@ -19,9 +19,13 @@
<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"
@@ -36,4 +40,4 @@
android:name="rotationGroup"
android:animation="@anim/trim_path_animation04" />
-</animated-vector> \ No newline at end of file
+</animated-vector>
diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable12.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable12.xml
index e28ec4144d2d..a212defb551c 100644
--- a/tests/VectorDrawableTest/res/drawable/vector_drawable12.xml
+++ b/tests/VectorDrawableTest/res/drawable/vector_drawable12.xml
@@ -32,27 +32,21 @@
android:name="pie1"
android:fill="#00000000"
android:pathData="M300,70 a230,230 0 1,0 1,0 z"
- android:stroke="#FF00FF00"
+ android:stroke="#FF777777"
android:strokeWidth="70"
android:trimPathEnd=".75"
android:trimPathOffset="0"
android:trimPathStart="0" />
<path
android:name="v"
- android:fill="#FF00FF00"
- android:pathData="M300,70 l 0,-70 70,70 -70,70z" />
+ android:fill="#000000"
+ android:pathData="M300,70 l 0,-70 70,70 0,0 -70,70z" />
<group
android:name="translateToCenterGroup"
android:rotation="0.0"
android:translateX="200.0"
android:translateY="200.0" >
- <path
- android:name="twoLines"
- android:pathData="@string/twoLinePathData"
- android:stroke="#FFFF0000"
- android:strokeWidth="20" />
-
<group
android:name="rotationGroup2"
android:pivotX="0.0"
@@ -61,7 +55,7 @@
<path
android:name="twoLines1"
android:pathData="@string/twoLinePathData"
- android:stroke="#FF00FF00"
+ android:stroke="#FFFF0000"
android:strokeWidth="20" />
<group
diff --git a/tests/VectorDrawableTest/res/values/strings.xml b/tests/VectorDrawableTest/res/values/strings.xml
index b49a1aa64a0b..6ae3d7fec91f 100644
--- a/tests/VectorDrawableTest/res/values/strings.xml
+++ b/tests/VectorDrawableTest/res/values/strings.xml
@@ -16,4 +16,11 @@
<resources>
<string name="twoLinePathData" >"M 0,0 v 100 M 0,0 h 100"</string>
+
+ <string name="triangle" > "M300,70 l 0,-70 70,70 0,0 -70,70z"</string>
+ <string name="rectangle" >"M300,70 l 0,-70 70,0 0,140 -70,0 z"</string>
+
+ <string name="rectangle2" >"M300,70 l 0,-70 70,0 0,70z M300,70 l 70,0 0,70 -70,0z"</string>
+ <string name="equal2" > "M300,35 l 0,-35 70,0 0,35z M300,105 l 70,0 0,35 -70,0z"</string>
+
</resources>