Update the tests to show more animations from UX team
Change-Id: I16d2ed29f40c85ec48c87b5a0355e2a262ed3af7
This commit is contained in:
29
tests/VectorDrawableTest/res/anim/animation_favorite.xml
Normal file
29
tests/VectorDrawableTest/res/anim/animation_favorite.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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="8000"
|
||||
android:interpolator="@interpolator/custom_path_interpolator_favorite"
|
||||
android:propertyName="pathData"
|
||||
android:repeatCount="-1"
|
||||
android:valueFrom="@string/round_box"
|
||||
android:valueTo="@string/heart"
|
||||
android:valueType="pathType" />
|
||||
|
||||
</set>
|
||||
35
tests/VectorDrawableTest/res/anim/animation_favorite02.xml
Normal file
35
tests/VectorDrawableTest/res/anim/animation_favorite02.xml
Normal file
@@ -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" >
|
||||
|
||||
<objectAnimator
|
||||
android:duration="8000"
|
||||
android:interpolator="@interpolator/custom_path_interpolator_favorite"
|
||||
android:propertyName="scaleX"
|
||||
android:repeatCount="-1"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="20" />
|
||||
<objectAnimator
|
||||
android:duration="8000"
|
||||
android:interpolator="@interpolator/custom_path_interpolator_favorite"
|
||||
android:propertyName="scaleY"
|
||||
android:repeatCount="-1"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="20" />
|
||||
|
||||
</set>
|
||||
@@ -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="3300"
|
||||
android:propertyName="rotation"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="360"
|
||||
android:repeatCount="-1" />
|
||||
</set>
|
||||
@@ -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" >
|
||||
|
||||
<objectAnimator
|
||||
android:duration="2000"
|
||||
android:interpolator="@interpolator/custom_path_interpolator_favorite"
|
||||
android:propertyName="scaleX"
|
||||
android:repeatCount="-1"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="20" />
|
||||
<objectAnimator
|
||||
android:duration="2000"
|
||||
android:interpolator="@interpolator/custom_path_interpolator_favorite"
|
||||
android:propertyName="scaleY"
|
||||
android:repeatCount="-1"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="20" />
|
||||
|
||||
</set>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?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="1300"
|
||||
android:interpolator="@interpolator/trim_start_interpolator"
|
||||
android:propertyName="trimPathStart"
|
||||
android:repeatCount="-1"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="0.75"
|
||||
android:valueType="floatType" />
|
||||
<objectAnimator
|
||||
android:duration="1300"
|
||||
android:interpolator="@interpolator/trim_end_interpolator"
|
||||
android:propertyName="trimPathEnd"
|
||||
android:repeatCount="-1"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="0.75"
|
||||
android:valueType="floatType" />
|
||||
<objectAnimator
|
||||
android:duration="1300"
|
||||
android:interpolator="@android:anim/linear_interpolator"
|
||||
android:propertyName="trimPathOffset"
|
||||
android:repeatCount="-1"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1.25"
|
||||
android:valueType="floatType" />
|
||||
|
||||
</set>
|
||||
@@ -19,14 +19,12 @@
|
||||
<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" />
|
||||
@@ -40,4 +38,4 @@
|
||||
android:name="rotationGroup"
|
||||
android:animation="@anim/trim_path_animation04" />
|
||||
|
||||
</animated-vector>
|
||||
</animated-vector>
|
||||
@@ -0,0 +1,26 @@
|
||||
<!--
|
||||
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_drawable_favorite" >
|
||||
|
||||
<target
|
||||
android:name="favorite"
|
||||
android:animation="@anim/animation_favorite" />
|
||||
<target
|
||||
android:name="root"
|
||||
android:animation="@anim/animation_favorite02" />
|
||||
|
||||
</animated-vector>
|
||||
@@ -0,0 +1,26 @@
|
||||
<!--
|
||||
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_drawable_grouping_1" >
|
||||
|
||||
<target
|
||||
android:name="sun"
|
||||
android:animation="@anim/animation_grouping_1_01" />
|
||||
<target
|
||||
android:name="earth"
|
||||
android:animation="@anim/animation_grouping_1_01" />
|
||||
|
||||
</animated-vector>
|
||||
@@ -0,0 +1,23 @@
|
||||
<!--
|
||||
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_drawable_progress_bar" >
|
||||
|
||||
<target
|
||||
android:name="pie1"
|
||||
android:animation="@anim/trim_path_animation_progress_bar" />
|
||||
|
||||
</animated-vector>
|
||||
@@ -0,0 +1,42 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<size
|
||||
android:height="128dp"
|
||||
android:width="128dp" />
|
||||
|
||||
<viewport
|
||||
android:viewportHeight="480"
|
||||
android:viewportWidth="480" />
|
||||
|
||||
<group
|
||||
android:name="root"
|
||||
android:translateX="240.0"
|
||||
android:translateY="240.0" >
|
||||
<path
|
||||
android:name="favorite"
|
||||
android:fill="#ff000000"
|
||||
android:pathData="M2.100006104,-6
|
||||
C0.1449127197,-6,1.600006104,-5.975006104,0,-5.975006104
|
||||
C-1.574996948,-5.975006104,0.00309753418,-6,-1.949996948,-6
|
||||
C-4.492996216,-6,-5.949996948,-3.718399048,-5.949996948,-1.149993896
|
||||
C-5.949996948,2.379302979,-5.699996948,5.100006104,0,5.100006104
|
||||
C5.699996948,5.100006104,6,2.379302979,6,-1.149993896
|
||||
C6,-3.718399048,4.643005371,-6,2.100006104,-6" />
|
||||
</group>
|
||||
|
||||
</vector>
|
||||
@@ -0,0 +1,56 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<size
|
||||
android:height="64dp"
|
||||
android:width="64dp" />
|
||||
|
||||
<viewport
|
||||
android:viewportHeight="256"
|
||||
android:viewportWidth="256" />
|
||||
|
||||
<group
|
||||
android:name="shape_layer_1"
|
||||
android:translateX="128"
|
||||
android:translateY="128" >
|
||||
<group android:name="sun" >
|
||||
<path
|
||||
android:name="ellipse_path_1"
|
||||
android:fill="#ffff8000"
|
||||
android:pathData="m -25 0 a 25,25 0 1,0 50,0 a 25,25 0 1,0 -50,0" />
|
||||
|
||||
<group
|
||||
android:name="earth"
|
||||
android:translateX="75" >
|
||||
<path
|
||||
android:name="ellipse_path_1_1"
|
||||
android:fill="#ff5656ea"
|
||||
android:pathData="m -10 0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0" />
|
||||
|
||||
<group
|
||||
android:name="moon"
|
||||
android:translateX="25" >
|
||||
<path
|
||||
android:name="ellipse_path_1_2"
|
||||
android:fill="#ffadadad"
|
||||
android:pathData="m -5 0 a 5,5 0 1,0 10,0 a 5,5 0 1,0 -10,0" />
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
</vector>
|
||||
@@ -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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<size
|
||||
android:height="64dp"
|
||||
android:width="64dp" />
|
||||
|
||||
<viewport
|
||||
android:viewportHeight="64"
|
||||
android:viewportWidth="64" />
|
||||
|
||||
<group
|
||||
android:name="root"
|
||||
android:pivotX="0.0"
|
||||
android:pivotY="0.0"
|
||||
android:rotation="0"
|
||||
android:translateX="32.0"
|
||||
android:translateY="32.0" >
|
||||
<group
|
||||
android:name="rotationGroup"
|
||||
android:pivotX="0.0"
|
||||
android:pivotY="0.0"
|
||||
android:rotation="0" >
|
||||
<path
|
||||
android:name="pie1"
|
||||
android:fill="#00000000"
|
||||
android:pathData="M0, 0 m 0, -9.5 a 9.5,9.5 0 1,1 0,19 a 9.5,9.5 0 1,1 0,-19"
|
||||
android:stroke="#89cff0"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="miter"
|
||||
android:strokeWidth="2"
|
||||
android:trimPathEnd="0.1"
|
||||
android:trimPathOffset="0"
|
||||
android:trimPathStart="0" />
|
||||
</group>
|
||||
</group>
|
||||
|
||||
</vector>
|
||||
@@ -0,0 +1,2 @@
|
||||
<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:pathData="L0.1, 0 C0.10066,0 0.198,1 0.2, 1 L 1,1" />
|
||||
@@ -0,0 +1,2 @@
|
||||
<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:pathData="L 0.09 1 L 1,1" />
|
||||
@@ -0,0 +1,2 @@
|
||||
<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:pathData="C0.2,0 0.1,1 0.5, 1 L 1,1" />
|
||||
@@ -0,0 +1,2 @@
|
||||
<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:pathData="L0.5,0 C 0.7,0 0.6,1 1, 1" />
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2014 The Android Open Source Project
|
||||
<!--
|
||||
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.
|
||||
@@ -15,12 +16,13 @@
|
||||
-->
|
||||
|
||||
<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="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>
|
||||
<string name="round_box">"m2.10001,-6c-1.9551,0 -0.5,0.02499 -2.10001,0.02499c-1.575,0 0.0031,-0.02499 -1.95,-0.02499c-2.543,0 -4,2.2816 -4,4.85001c0,3.52929 0.25,6.25 5.95,6.25c5.7,0 6,-2.72071 6,-6.25c0,-2.56841 -1.35699,-4.85001 -3.89999,-4.85001"</string>
|
||||
<string name="heart"> "m4.5,-7c-1.95509,0 -3.83009,1.26759 -4.5,3c-0.66991,-1.73241 -2.54691,-3 -4.5,-3c-2.543,0 -4.5,1.93159 -4.5,4.5c0,3.5293 3.793,6.2578 9,11.5c5.207,-5.2422 9,-7.9707 9,-11.5c0,-2.56841 -1.957,-4.5 -4.5,-4.5"</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>
|
||||
</resources>
|
||||
@@ -19,24 +19,43 @@ import android.graphics.drawable.AnimatedVectorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.GridLayout;
|
||||
import android.widget.ScrollView;
|
||||
|
||||
public class AnimatedVectorDrawableTest extends Activity {
|
||||
private static final String LOGCAT = "VectorDrawableAnimationTest";
|
||||
public class AnimatedVectorDrawableTest extends Activity implements View.OnClickListener{
|
||||
private static final String LOGCAT = "AnimatedVectorDrawableTest";
|
||||
|
||||
protected int[] icon = {
|
||||
R.drawable.animation_vector_drawable_grouping_1,
|
||||
R.drawable.animation_vector_progress_bar,
|
||||
R.drawable.animation_vector_drawable_favorite,
|
||||
R.drawable.animation_vector_drawable01,
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Button button = new Button(this);
|
||||
button.setBackgroundResource(R.drawable.animation_vector_drawable01);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AnimatedVectorDrawable frameAnimation = (AnimatedVectorDrawable) v.getBackground();
|
||||
frameAnimation.start();
|
||||
}
|
||||
});
|
||||
ScrollView scrollView = new ScrollView(this);
|
||||
GridLayout container = new GridLayout(this);
|
||||
scrollView.addView(container);
|
||||
container.setColumnCount(1);
|
||||
|
||||
setContentView(button);
|
||||
for (int i = 0; i < icon.length; i++) {
|
||||
Button button = new Button(this);
|
||||
button.setWidth(400);
|
||||
button.setHeight(400);
|
||||
button.setBackgroundResource(icon[i]);
|
||||
container.addView(button);
|
||||
button.setOnClickListener(this);
|
||||
}
|
||||
|
||||
setContentView(scrollView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AnimatedVectorDrawable d = (AnimatedVectorDrawable) v.getBackground();
|
||||
d.start();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user