summaryrefslogtreecommitdiffstats
path: root/tests/VectorDrawableTest
diff options
context:
space:
mode:
authorztenghui <ztenghui@google.com>2014-07-17 15:06:03 -0700
committerTenghui Zhu <ztenghui@google.com>2014-07-18 20:39:35 +0000
commit9d59a76dd0e850558e83ef1a48fefd865fac1336 (patch)
tree0a6f17a5306ef080acb313104632658e93d88ed9 /tests/VectorDrawableTest
parent670689af43358568bf2b5916284f1cac5762f428 (diff)
downloadframeworks_base-9d59a76dd0e850558e83ef1a48fefd865fac1336.zip
frameworks_base-9d59a76dd0e850558e83ef1a48fefd865fac1336.tar.gz
frameworks_base-9d59a76dd0e850558e83ef1a48fefd865fac1336.tar.bz2
Fix FIT_XY scaleType issue on VectorDrawable
bug:16019658 Change-Id: I8b6ac23bf14de5427d3029436acf76bd1161f0ea
Diffstat (limited to 'tests/VectorDrawableTest')
-rw-r--r--tests/VectorDrawableTest/src/com/android/test/dynamic/ScaleDrawableTests.java37
1 files changed, 9 insertions, 28 deletions
diff --git a/tests/VectorDrawableTest/src/com/android/test/dynamic/ScaleDrawableTests.java b/tests/VectorDrawableTest/src/com/android/test/dynamic/ScaleDrawableTests.java
index 07ca2eb..3787843 100644
--- a/tests/VectorDrawableTest/src/com/android/test/dynamic/ScaleDrawableTests.java
+++ b/tests/VectorDrawableTest/src/com/android/test/dynamic/ScaleDrawableTests.java
@@ -36,30 +36,9 @@ public class ScaleDrawableTests extends Activity {
"CENTER_INSIDE (7)"
};
- protected int[] icon = {
- R.drawable.bitmap_drawable01,
- R.drawable.bitmap_drawable01,
- R.drawable.bitmap_drawable01,
- R.drawable.bitmap_drawable01,
- R.drawable.bitmap_drawable01,
- R.drawable.bitmap_drawable01,
- R.drawable.bitmap_drawable01,
- R.drawable.bitmap_drawable01,
- };
-
- protected int[] vector_icons = {
- R.drawable.vector_drawable16,
- R.drawable.vector_drawable16,
- R.drawable.vector_drawable16,
- R.drawable.vector_drawable16,
- R.drawable.vector_drawable16,
- R.drawable.vector_drawable16,
- R.drawable.vector_drawable16,
- R.drawable.vector_drawable16,
- R.drawable.vector_drawable16,
- };
-
+ protected int icon = R.drawable.bitmap_drawable01;
+ protected int vector_icon = R.drawable.vector_drawable16;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -74,21 +53,23 @@ public class ScaleDrawableTests extends Activity {
params.width = 400;
params.height = 300;
- for (int i = 0; i < icon.length; i++) {
+ for (int i = 0; i < scaleTypes.length; i++) {
TextView t = new TextView(this);
t.setText(scaleTypes[i]);
container.addView(t);
+ ImageView.ScaleType scaleType = ImageView.ScaleType.values()[i];
+
ImageView png_view = new ImageView(this);
png_view.setLayoutParams(params);
- png_view.setScaleType(ImageView.ScaleType.values()[i]);
- png_view.setImageResource(icon[i]);
+ png_view.setScaleType(scaleType);
+ png_view.setImageResource(icon);
container.addView(png_view);
ImageView view = new ImageView(this);
view.setLayoutParams(params);
- view.setScaleType(ImageView.ScaleType.values()[i]);
- view.setImageResource(vector_icons[i]);
+ view.setScaleType(scaleType);
+ view.setImageResource(vector_icon);
container.addView(view);
}