summaryrefslogtreecommitdiff
path: root/tests/VectorDrawableTest/src
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2016-03-28 14:37:54 -0700
committerTeng-Hui Zhu <ztenghui@google.com>2016-03-29 13:18:16 -0700
commit06a353d37c5dd72515136fef94a720b642f05f01 (patch)
treed41daffdad9573f16abd0931ee671e3fd49349d8 /tests/VectorDrawableTest/src
parentdb9fba373450e01d52f14e8380646e631dee1713 (diff)
Add test for AVD on SW Layer
Now we can put both HW Layer and SW Layer side by side. Change-Id: I105d0aa6baad0e096cf71c05568323e81301e9b0
Diffstat (limited to 'tests/VectorDrawableTest/src')
-rw-r--r--tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableTest.java38
1 files changed, 21 insertions, 17 deletions
diff --git a/tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableTest.java b/tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableTest.java
index 087e68a841ed..9351f63551fb 100644
--- a/tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableTest.java
+++ b/tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableTest.java
@@ -43,33 +43,37 @@ public class AnimatedVectorDrawableTest extends Activity implements View.OnClick
@Override
protected void onCreate(Bundle savedInstanceState) {
+ final int[] layerTypes = {View.LAYER_TYPE_SOFTWARE, View.LAYER_TYPE_HARDWARE};
super.onCreate(savedInstanceState);
ScrollView scrollView = new ScrollView(this);
GridLayout container = new GridLayout(this);
scrollView.addView(container);
- container.setColumnCount(1);
+ container.setColumnCount(2);
for (int i = 0; i < icon.length; i++) {
- Button button = new Button(this);
- button.setWidth(400);
- button.setHeight(400);
- button.setBackgroundResource(icon[i]);
- AnimatedVectorDrawable d = (AnimatedVectorDrawable) button.getBackground();
- d.registerAnimationCallback(new Animatable2.AnimationCallback() {
- @Override
- public void onAnimationStart(Drawable drawable) {
- Log.v(LOGCAT, "Animator start");
- }
+ for (int j = 0; j < layerTypes.length; j++) {
+ Button button = new Button(this);
+ button.setWidth(400);
+ button.setHeight(400);
+ button.setLayerType(layerTypes[j], null);
+ button.setBackgroundResource(icon[i]);
+ AnimatedVectorDrawable d = (AnimatedVectorDrawable) button.getBackground();
+ d.registerAnimationCallback(new Animatable2.AnimationCallback() {
+ @Override
+ public void onAnimationStart(Drawable drawable) {
+ Log.v(LOGCAT, "Animator start");
+ }
- @Override
- public void onAnimationEnd(Drawable drawable) {
+ @Override
+ public void onAnimationEnd(Drawable drawable) {
Log.v(LOGCAT, "Animator end");
- }
- });
+ }
+ });
- container.addView(button);
- button.setOnClickListener(this);
+ container.addView(button);
+ button.setOnClickListener(this);
+ }
}
setContentView(scrollView);