Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b32d9bf authored by Teng-Hui Zhu's avatar Teng-Hui Zhu Committed by android-build-merger
Browse files

Merge "Add test for private API forceAnimationOnUI" into nyc-dev am: c2a091a0

am: 6ead0397

* commit '6ead0397':
  Add test for private API forceAnimationOnUI

Change-Id: I9192ddb810a57185793312c730489964d3e000fb
parents d040970e 6ead0397
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -23,6 +23,4 @@ LOCAL_PACKAGE_NAME := VectorDrawableTest

LOCAL_MODULE_TAGS := tests

LOCAL_SDK_VERSION := current

include $(BUILD_PACKAGE)
+0 −2
Original line number Diff line number Diff line
@@ -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"
+35 −18
Original line number Diff line number Diff line
@@ -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";
@@ -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) {
@@ -76,6 +92,7 @@ public class AnimatedVectorDrawableTest extends Activity implements View.OnClick
                    button.setOnClickListener(this);
                }
            }
        }

        setContentView(scrollView);
    }