Loading tests/VectorDrawableTest/Android.mk +0 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,4 @@ LOCAL_PACKAGE_NAME := VectorDrawableTest LOCAL_MODULE_TAGS := tests LOCAL_SDK_VERSION := current include $(BUILD_PACKAGE) tests/VectorDrawableTest/AndroidManifest.xml +0 −2 Original line number Diff line number Diff line Loading @@ -18,8 +18,6 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.test.dynamic" > <uses-sdk android:minSdkVersion="21" /> <application android:hardwareAccelerated="true" android:label="vector" Loading tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableTest.java +35 −18 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.view.View; import android.widget.Button; import android.widget.GridLayout; import android.widget.ScrollView; import android.widget.TextView; public class AnimatedVectorDrawableTest extends Activity implements View.OnClickListener { private static final String LOGCAT = "AnimatedVectorDrawableTest"; Loading @@ -45,21 +46,36 @@ 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}; final boolean[] forceOnUi = {false, true}; super.onCreate(savedInstanceState); ScrollView scrollView = new ScrollView(this); GridLayout container = new GridLayout(this); scrollView.addView(container); container.setColumnCount(2); container.setColumnCount(layerTypes.length * forceOnUi.length); for (int j = 0; j < layerTypes.length; j++) { for (int k = 0; k < forceOnUi.length; k++) { TextView textView = new TextView(this); String category = "Layer:" + (layerTypes[j] == View.LAYER_TYPE_SOFTWARE ? "SW" : "HW") + (forceOnUi[k] == true ? ",forceUI" : ""); textView.setText(category); container.addView(textView); } } for (int i = 0; i < icon.length; i++) { for (int j = 0; j < layerTypes.length; j++) { for (int k = 0; k < forceOnUi.length; k++) { Button button = new Button(this); button.setWidth(400); button.setHeight(400); button.setWidth(300); button.setHeight(300); button.setLayerType(layerTypes[j], null); button.setBackgroundResource(icon[i]); AnimatedVectorDrawable d = (AnimatedVectorDrawable) button.getBackground(); if (forceOnUi[k] == true) { d.forceAnimationOnUI(); } d.registerAnimationCallback(new Animatable2.AnimationCallback() { @Override public void onAnimationStart(Drawable drawable) { Loading @@ -76,6 +92,7 @@ public class AnimatedVectorDrawableTest extends Activity implements View.OnClick button.setOnClickListener(this); } } } setContentView(scrollView); } Loading Loading
tests/VectorDrawableTest/Android.mk +0 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,4 @@ LOCAL_PACKAGE_NAME := VectorDrawableTest LOCAL_MODULE_TAGS := tests LOCAL_SDK_VERSION := current include $(BUILD_PACKAGE)
tests/VectorDrawableTest/AndroidManifest.xml +0 −2 Original line number Diff line number Diff line Loading @@ -18,8 +18,6 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.test.dynamic" > <uses-sdk android:minSdkVersion="21" /> <application android:hardwareAccelerated="true" android:label="vector" Loading
tests/VectorDrawableTest/src/com/android/test/dynamic/AnimatedVectorDrawableTest.java +35 −18 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.view.View; import android.widget.Button; import android.widget.GridLayout; import android.widget.ScrollView; import android.widget.TextView; public class AnimatedVectorDrawableTest extends Activity implements View.OnClickListener { private static final String LOGCAT = "AnimatedVectorDrawableTest"; Loading @@ -45,21 +46,36 @@ 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}; final boolean[] forceOnUi = {false, true}; super.onCreate(savedInstanceState); ScrollView scrollView = new ScrollView(this); GridLayout container = new GridLayout(this); scrollView.addView(container); container.setColumnCount(2); container.setColumnCount(layerTypes.length * forceOnUi.length); for (int j = 0; j < layerTypes.length; j++) { for (int k = 0; k < forceOnUi.length; k++) { TextView textView = new TextView(this); String category = "Layer:" + (layerTypes[j] == View.LAYER_TYPE_SOFTWARE ? "SW" : "HW") + (forceOnUi[k] == true ? ",forceUI" : ""); textView.setText(category); container.addView(textView); } } for (int i = 0; i < icon.length; i++) { for (int j = 0; j < layerTypes.length; j++) { for (int k = 0; k < forceOnUi.length; k++) { Button button = new Button(this); button.setWidth(400); button.setHeight(400); button.setWidth(300); button.setHeight(300); button.setLayerType(layerTypes[j], null); button.setBackgroundResource(icon[i]); AnimatedVectorDrawable d = (AnimatedVectorDrawable) button.getBackground(); if (forceOnUi[k] == true) { d.forceAnimationOnUI(); } d.registerAnimationCallback(new Animatable2.AnimationCallback() { @Override public void onAnimationStart(Drawable drawable) { Loading @@ -76,6 +92,7 @@ public class AnimatedVectorDrawableTest extends Activity implements View.OnClick button.setOnClickListener(this); } } } setContentView(scrollView); } Loading