diff options
author | ztenghui <ztenghui@google.com> | 2014-06-03 14:02:10 -0700 |
---|---|---|
committer | ztenghui <ztenghui@google.com> | 2014-06-12 13:18:59 -0700 |
commit | e5e92602a41a4ddc7b42cd1c171a0edfbd09b8da (patch) | |
tree | d1ca259815244f1f51c59f5853f6b5bcfd0e0858 /tests/VectorDrawableTest/res | |
parent | 88b00784684d7b706c7b0c4e833b1d67d73358b9 (diff) | |
download | frameworks_base-e5e92602a41a4ddc7b42cd1c171a0edfbd09b8da.zip frameworks_base-e5e92602a41a4ddc7b42cd1c171a0edfbd09b8da.tar.gz frameworks_base-e5e92602a41a4ddc7b42cd1c171a0edfbd09b8da.tar.bz2 |
Add AnimatedVectorDrawable
Currently as a hidden class.
It can support many the animations now as far as ObjectAnimator and
hierarchical group can support.
And we don't have path morphing yet.
Also support the Animator / Interpolator inflation from Context and Resources.
Change-Id: I948bbdf7373ad291171eed0b497959dce8c2edf3
Diffstat (limited to 'tests/VectorDrawableTest/res')
6 files changed, 215 insertions, 3 deletions
diff --git a/tests/VectorDrawableTest/res/anim/trim_path_animation01.xml b/tests/VectorDrawableTest/res/anim/trim_path_animation01.xml new file mode 100644 index 0000000..d47e019 --- /dev/null +++ b/tests/VectorDrawableTest/res/anim/trim_path_animation01.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" > + + <set android:ordering="sequentially" > + <objectAnimator + android:duration="5000" + android:propertyName="trimPathEnd" + android:valueFrom="0" + android:valueTo="1" + android:valueType="floatType" /> + <objectAnimator + android:duration="5000" + android:propertyName="trimPathEnd" + android:valueFrom="1" + android:valueTo="0" + android:valueType="floatType" /> + </set> + +</set>
\ No newline at end of file diff --git a/tests/VectorDrawableTest/res/anim/trim_path_animation02.xml b/tests/VectorDrawableTest/res/anim/trim_path_animation02.xml new file mode 100644 index 0000000..3bf2865 --- /dev/null +++ b/tests/VectorDrawableTest/res/anim/trim_path_animation02.xml @@ -0,0 +1,26 @@ +<?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" > + + <objectAnimator + android:duration="5000" + android:propertyName="fill" + android:valueFrom="#FF000000" + android:valueTo="#FFFF0000"/> + +</set>
\ No newline at end of file diff --git a/tests/VectorDrawableTest/res/anim/trim_path_animation03.xml b/tests/VectorDrawableTest/res/anim/trim_path_animation03.xml new file mode 100644 index 0000000..72beba2 --- /dev/null +++ b/tests/VectorDrawableTest/res/anim/trim_path_animation03.xml @@ -0,0 +1,26 @@ +<?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" > + + <objectAnimator + android:duration="6000" + android:propertyName="rotation" + android:valueFrom="0" + android:valueTo="360"/> + +</set>
\ No newline at end of file diff --git a/tests/VectorDrawableTest/res/anim/trim_path_animation04.xml b/tests/VectorDrawableTest/res/anim/trim_path_animation04.xml new file mode 100644 index 0000000..ff86668 --- /dev/null +++ b/tests/VectorDrawableTest/res/anim/trim_path_animation04.xml @@ -0,0 +1,26 @@ +<?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" > + + <objectAnimator + android:duration="9000" + android:propertyName="rotation" + android:valueFrom="0" + android:valueTo="360"/> + +</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 new file mode 100644 index 0000000..b8681b6 --- /dev/null +++ b/tests/VectorDrawableTest/res/drawable/animation_vector_drawable01.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. +--> +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" + 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="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" /> + +</animated-vector>
\ No newline at end of file diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable12.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable12.xml index 3042f6a..e28ec41 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable12.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable12.xml @@ -23,11 +23,15 @@ android:viewportHeight="600" android:viewportWidth="600" /> - <group> + <group + android:name="rotationGroup" + android:pivotX="300.0" + android:pivotY="300.0" + android:rotation="45.0" > <path android:name="pie1" - android:pathData="M300,70 a230,230 0 1,0 1,0 z" android:fill="#00000000" + android:pathData="M300,70 a230,230 0 1,0 1,0 z" android:stroke="#FF00FF00" android:strokeWidth="70" android:trimPathEnd=".75" @@ -36,7 +40,66 @@ <path android:name="v" android:fill="#FF00FF00" - android:pathData="M300,70 l 0,-70 70,70 -70,70z"/> + android:pathData="M300,70 l 0,-70 70,70 -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" + android:pivotY="0.0" + android:rotation="-45.0" > + <path + android:name="twoLines1" + android:pathData="@string/twoLinePathData" + android:stroke="#FF00FF00" + android:strokeWidth="20" /> + + <group + android:name="translateGroupHalf" + android:translateX="65.0" + android:translateY="80.0" > + <group + android:name="rotationGroup3" + android:pivotX="-65.0" + android:pivotY="-80.0" + android:rotation="-45.0" > + <path + android:name="twoLines2" + android:fill="#FF00FF00" + android:pathData="@string/twoLinePathData" + android:stroke="#FF00FF00" + android:strokeWidth="20" /> + + <group + android:name="translateGroup" + android:translateX="65.0" + android:translateY="80.0" > + <group + android:name="rotationGroupBlue" + android:pivotX="-65.0" + android:pivotY="-80.0" + android:rotation="-45.0" > + <path + android:name="twoLines3" + android:pathData="@string/twoLinePathData" + android:stroke="#FF0000FF" + android:strokeWidth="20" /> + </group> + </group> + </group> + </group> + </group> + </group> </group> </vector>
\ No newline at end of file |