Add test for AVD on SW Layer

Now we can put both HW Layer and SW Layer side by side.

Change-Id: I105d0aa6baad0e096cf71c05568323e81301e9b0
This commit is contained in:
Teng-Hui Zhu
2016-03-28 14:37:54 -07:00
parent db9fba3734
commit 06a353d37c
2 changed files with 22 additions and 18 deletions

View File

@@ -17,7 +17,7 @@
android:height="4dp"
android:viewportHeight="4"
android:viewportWidth="360"
android:width="360dp" >
android:width="36dp" >
<group
android:name="linear_indeterminate"

View File

@@ -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);