summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2010-12-14 14:58:59 -0800
committerXavier Ducrohet <xav@android.com>2010-12-14 14:58:59 -0800
commitec31a7f119608b94ea1bb41275811027a360bf30 (patch)
tree9e9d175cbbd71b6bf142806f82268680a1bc2176
parentd9c64369cf9be6568af2d79c35fb470cc261730d (diff)
downloadframeworks_base-ec31a7f119608b94ea1bb41275811027a360bf30.zip
frameworks_base-ec31a7f119608b94ea1bb41275811027a360bf30.tar.gz
frameworks_base-ec31a7f119608b94ea1bb41275811027a360bf30.tar.bz2
Create some layout files for HwAccelerationTest
The goal is use the app to test layout lib, so layout files are needed, and custom views must be instantiable (ie public) Change-Id: I46bb3d8af6e4d7973d041aa618f1c7762efd93d0
-rw-r--r--tests/HwAccelerationTest/.classpath7
-rw-r--r--tests/HwAccelerationTest/.gitignore3
-rw-r--r--tests/HwAccelerationTest/.project33
-rw-r--r--tests/HwAccelerationTest/AndroidManifest.xml3
-rw-r--r--tests/HwAccelerationTest/default.properties11
-rw-r--r--tests/HwAccelerationTest/res/layout/advanced_blend.xml6
-rw-r--r--tests/HwAccelerationTest/res/layout/advanced_gradient.xml6
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedBlendActivity.java16
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedGradientsActivity.java4
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java23
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/TextGammaActivity.java5
11 files changed, 90 insertions, 27 deletions
diff --git a/tests/HwAccelerationTest/.classpath b/tests/HwAccelerationTest/.classpath
new file mode 100644
index 0000000..609aa00
--- /dev/null
+++ b/tests/HwAccelerationTest/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="gen"/>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/HwAccelerationTest/.gitignore b/tests/HwAccelerationTest/.gitignore
new file mode 100644
index 0000000..f178f17
--- /dev/null
+++ b/tests/HwAccelerationTest/.gitignore
@@ -0,0 +1,3 @@
+bin
+gen
+local.properties \ No newline at end of file
diff --git a/tests/HwAccelerationTest/.project b/tests/HwAccelerationTest/.project
new file mode 100644
index 0000000..7c04d3c
--- /dev/null
+++ b/tests/HwAccelerationTest/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>HwAccelerationTest</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/HwAccelerationTest/AndroidManifest.xml b/tests/HwAccelerationTest/AndroidManifest.xml
index 7fa71a9..c60613c 100644
--- a/tests/HwAccelerationTest/AndroidManifest.xml
+++ b/tests/HwAccelerationTest/AndroidManifest.xml
@@ -17,7 +17,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.test.hwui">
- <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-sdk android:minSdkVersion="Froyo" />
<application
android:label="HwUi"
diff --git a/tests/HwAccelerationTest/default.properties b/tests/HwAccelerationTest/default.properties
new file mode 100644
index 0000000..5a8ea50
--- /dev/null
+++ b/tests/HwAccelerationTest/default.properties
@@ -0,0 +1,11 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-Froyo
diff --git a/tests/HwAccelerationTest/res/layout/advanced_blend.xml b/tests/HwAccelerationTest/res/layout/advanced_blend.xml
new file mode 100644
index 0000000..6efdd73
--- /dev/null
+++ b/tests/HwAccelerationTest/res/layout/advanced_blend.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<com.android.test.hwui.AdvancedBlendActivity.ShadersView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+</com.android.test.hwui.AdvancedBlendActivity.ShadersView>
diff --git a/tests/HwAccelerationTest/res/layout/advanced_gradient.xml b/tests/HwAccelerationTest/res/layout/advanced_gradient.xml
new file mode 100644
index 0000000..dd937f9
--- /dev/null
+++ b/tests/HwAccelerationTest/res/layout/advanced_gradient.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<com.android.test.hwui.AdvancedGradientsActivity.GradientsView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+</com.android.test.hwui.AdvancedGradientsActivity.GradientsView>
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedBlendActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedBlendActivity.java
index 5baa20c..a83005b 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedBlendActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedBlendActivity.java
@@ -41,7 +41,7 @@ public class AdvancedBlendActivity extends Activity {
setContentView(new ShadersView(this));
}
- static class ShadersView extends View {
+ public static class ShadersView extends View {
private BitmapShader mScaledShader;
private int mTexWidth;
private int mTexHeight;
@@ -57,7 +57,7 @@ public class AdvancedBlendActivity extends Activity {
private ComposeShader mCompose6Shader;
private BitmapShader mScaled2Shader;
- ShadersView(Context c) {
+ public ShadersView(Context c) {
super(c);
Bitmap texture = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1);
@@ -71,7 +71,7 @@ public class AdvancedBlendActivity extends Activity {
Matrix m2 = new Matrix();
m2.setScale(0.5f, 0.5f);
mScaledShader.setLocalMatrix(m2);
-
+
mScaled2Shader = new BitmapShader(texture, Shader.TileMode.MIRROR,
Shader.TileMode.MIRROR);
Matrix m3 = new Matrix();
@@ -80,7 +80,7 @@ public class AdvancedBlendActivity extends Activity {
mHorGradient = new LinearGradient(0.0f, 0.0f, mDrawWidth, 0.0f,
Color.BLACK, Color.WHITE, Shader.TileMode.CLAMP);
-
+
mComposeShader = new ComposeShader(mScaledShader, mHorGradient,
PorterDuff.Mode.DARKEN);
mCompose2Shader = new ComposeShader(mScaledShader, mHorGradient,
@@ -107,7 +107,7 @@ public class AdvancedBlendActivity extends Activity {
mPaint.setShader(mComposeShader);
canvas.drawRect(0.0f, 0.0f, mDrawWidth, mDrawHeight, mPaint);
-
+
canvas.translate(0.0f, 40.0f + mDrawHeight);
mPaint.setShader(mCompose2Shader);
canvas.drawRect(0.0f, 0.0f, mDrawWidth, mDrawHeight, mPaint);
@@ -117,10 +117,10 @@ public class AdvancedBlendActivity extends Activity {
canvas.drawRect(0.0f, 0.0f, mDrawWidth, mDrawHeight, mPaint);
canvas.restore();
-
+
canvas.save();
canvas.translate(40.0f + mDrawWidth + 40.0f, 40.0f);
-
+
mPaint.setShader(mCompose4Shader);
canvas.drawRect(0.0f, 0.0f, mDrawWidth, mDrawHeight, mPaint);
@@ -131,7 +131,7 @@ public class AdvancedBlendActivity extends Activity {
canvas.translate(0.0f, 40.0f + mDrawHeight);
mPaint.setShader(mCompose6Shader);
canvas.drawRect(0.0f, 0.0f, mDrawWidth, mDrawHeight, mPaint);
-
+
canvas.restore();
}
}
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedGradientsActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedGradientsActivity.java
index 27974e7..b0b54eb 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedGradientsActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedGradientsActivity.java
@@ -36,7 +36,7 @@ public class AdvancedGradientsActivity extends Activity {
setContentView(new GradientsView(this));
}
- static class GradientsView extends View {
+ public static class GradientsView extends View {
private final Paint mPaint;
private final SweepGradient mSweepGradient;
private final RadialGradient mRadialGradient;
@@ -44,7 +44,7 @@ public class AdvancedGradientsActivity extends Activity {
private final Matrix mMatrix2;
private final Matrix mMatrix3;
- GradientsView(Context c) {
+ public GradientsView(Context c) {
super(c);
mSweepGradient = new SweepGradient(0.0f, 0.0f, 0xff000000, 0xffffffff);
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java
index 8fa626b..f8422f4 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java
@@ -51,15 +51,12 @@ public class GradientsActivity extends Activity {
final SeekBar rotateView = new SeekBar(this);
rotateView.setMax(360);
rotateView.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
- @Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
- @Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
- @Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
gradientView.setRotationY((float) progress);
radialGradientView.setRotationX((float) progress);
@@ -67,7 +64,7 @@ public class GradientsActivity extends Activity {
bitmapView.setRotationX((float) progress);
}
});
-
+
layout.addView(shadersView);
layout.addView(gradientView, new FrameLayout.LayoutParams(
200, 200, Gravity.CENTER));
@@ -90,7 +87,7 @@ public class GradientsActivity extends Activity {
setContentView(layout);
}
-
+
static class BitmapView extends View {
private final Paint mPaint;
@@ -116,7 +113,7 @@ public class GradientsActivity extends Activity {
canvas.drawRect(0.0f, 0.0f, getWidth(), getHeight(), mPaint);
}
}
-
+
static class GradientView extends View {
private final Paint mPaint;
@@ -166,14 +163,14 @@ public class GradientsActivity extends Activity {
canvas.drawRect(0.0f, 0.0f, getWidth(), getHeight(), mPaint);
}
}
-
+
static class SweepGradientView extends View {
private final Paint mPaint;
SweepGradientView(Context c) {
super(c);
- SweepGradient gradient = new SweepGradient(100.0f, 100.0f, 0xff000000, 0xffffffff);
+ SweepGradient gradient = new SweepGradient(100.0f, 100.0f, 0xff000000, 0xffffffff);
mPaint = new Paint();
mPaint.setShader(gradient);
}
@@ -190,7 +187,7 @@ public class GradientsActivity extends Activity {
canvas.drawRect(0.0f, 0.0f, getWidth(), getHeight(), mPaint);
}
}
-
+
static class ShadersView extends View {
private final Paint mPaint;
private final float mDrawWidth;
@@ -232,12 +229,12 @@ public class GradientsActivity extends Activity {
top += 40.0f + mDrawHeight;
bottom += 40.0f + mDrawHeight;
-
+
mMatrix.setScale(1, mDrawHeight);
mMatrix.postTranslate(left, top);
mGradient.setLocalMatrix(mMatrix);
canvas.drawRect(left, top, right, top + mDrawHeight, mPaint);
-
+
left += 40.0f + mDrawWidth;
right += 40.0f + mDrawWidth;
top -= 40.0f + mDrawHeight;
@@ -251,13 +248,13 @@ public class GradientsActivity extends Activity {
top += 40.0f + mDrawHeight;
bottom += 40.0f + mDrawHeight;
-
+
mMatrix.setScale(1, mDrawWidth);
mMatrix.postRotate(-90);
mMatrix.postTranslate(left, top);
mGradient.setLocalMatrix(mMatrix);
canvas.drawRect(left, top, left + mDrawWidth, bottom, mPaint);
-
+
canvas.restore();
}
}
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/TextGammaActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/TextGammaActivity.java
index 773d390..f40b89d 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/TextGammaActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/TextGammaActivity.java
@@ -43,9 +43,8 @@ public class TextGammaActivity extends Activity {
));
setContentView(layout);
-
+
layout.post(new Runnable() {
- @Override
public void run() {
Bitmap b = Bitmap.createBitmap(gamma.getWidth(), gamma.getHeight(),
Bitmap.Config.ARGB_8888);
@@ -88,7 +87,7 @@ public class TextGammaActivity extends Activity {
final LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
-
+
final GammaTextView gamma = new GammaTextView(this);
final LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT