From 50c29cd92f4fc410f61e2d14ce77f5e8e76daf0b Mon Sep 17 00:00:00 2001 From: Alan Viverette Date: Tue, 22 Sep 2015 15:03:50 -0400 Subject: Allow color state list for vector drawable fill and stroke Removes unnecessary invalidateSelf() from VD.onStateChange(). This is handled by the view hosting the drawable. Bug: 22984152 Change-Id: Idf11a0ffef392cb1d8452aa3f5f836b35027a756 --- .../res/drawable/vector_drawable01.xml | 8 ++++++-- .../com/android/test/dynamic/VectorDrawable01.java | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) (limited to 'tests/VectorDrawableTest') diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable01.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable01.xml index 705cc34ff62b..2be99bed4bfb 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable01.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable01.xml @@ -20,11 +20,15 @@ android:viewportWidth="480" > + diff --git a/tests/VectorDrawableTest/src/com/android/test/dynamic/VectorDrawable01.java b/tests/VectorDrawableTest/src/com/android/test/dynamic/VectorDrawable01.java index a23d81933749..85fc452add3e 100644 --- a/tests/VectorDrawableTest/src/com/android/test/dynamic/VectorDrawable01.java +++ b/tests/VectorDrawableTest/src/com/android/test/dynamic/VectorDrawable01.java @@ -18,7 +18,12 @@ import android.graphics.drawable.VectorDrawable; import android.os.Bundle; import android.util.Log; import android.view.View; +import android.view.View.OnClickListener; +import android.view.ViewGroup; import android.widget.Button; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.GridLayout; @SuppressWarnings({"UnusedDeclaration"}) @@ -55,6 +60,23 @@ public class VectorDrawable01 extends Activity { container.setBackgroundColor(0xFF888888); final Button []bArray = new Button[icon.length]; + CheckBox toggle = new CheckBox(this); + toggle.setText("Toggle"); + toggle.setChecked(true); + toggle.setOnCheckedChangeListener(new OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + ViewGroup vg = (ViewGroup) buttonView.getParent(); + for (int i = 0, count = vg.getChildCount(); i < count; i++) { + View child = vg.getChildAt(i); + if (child != buttonView) { + child.setEnabled(isChecked); + } + } + } + }); + container.addView(toggle); + for (int i = 0; i < icon.length; i++) { Button button = new Button(this); bArray[i] = button; -- cgit v1.2.3-59-g8ed1b