summaryrefslogtreecommitdiffstats
path: root/tests/HwAccelerationTest
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-10-15 13:57:28 -0700
committerRomain Guy <romainguy@google.com>2010-10-15 13:57:28 -0700
commite5ebcb0107a939395e03592fd44c746cd09e311d (patch)
tree1ee2cc9fb92d3de28f40658df2a7df1da79f64f8 /tests/HwAccelerationTest
parentc65217e4ec3e6c80834988ec3bc66a90778ee4b0 (diff)
downloadframeworks_base-e5ebcb0107a939395e03592fd44c746cd09e311d.zip
frameworks_base-e5ebcb0107a939395e03592fd44c746cd09e311d.tar.gz
frameworks_base-e5ebcb0107a939395e03592fd44c746cd09e311d.tar.bz2
Fix clipping issue in StackView.
Change-Id: I7ec28f25c3993a2bd7ef6399ba1923839d239905
Diffstat (limited to 'tests/HwAccelerationTest')
-rw-r--r--tests/HwAccelerationTest/AndroidManifest.xml19
-rw-r--r--tests/HwAccelerationTest/res/anim/fade_in.xml19
-rw-r--r--tests/HwAccelerationTest/res/anim/fade_out.xml19
-rw-r--r--tests/HwAccelerationTest/res/drawable-hdpi/appwidget_background.xml22
-rw-r--r--tests/HwAccelerationTest/res/drawable-hdpi/appwidget_bg.9.pngbin0 -> 1694 bytes
-rw-r--r--tests/HwAccelerationTest/res/drawable-hdpi/appwidget_bg_focus.9.pngbin0 -> 1910 bytes
-rw-r--r--tests/HwAccelerationTest/res/drawable-hdpi/appwidget_bg_press.9.pngbin0 -> 1908 bytes
-rw-r--r--tests/HwAccelerationTest/res/drawable-hdpi/green_gradient.9.pngbin0 -> 1239 bytes
-rw-r--r--tests/HwAccelerationTest/res/drawable-hdpi/widget_header.pngbin0 -> 4092 bytes
-rw-r--r--tests/HwAccelerationTest/res/drawable-hdpi/widget_title_bg.9.pngbin0 -> 1429 bytes
-rw-r--r--tests/HwAccelerationTest/res/drawable/appwidget_background.xml22
-rw-r--r--tests/HwAccelerationTest/res/drawable/appwidget_bg.9.pngbin0 -> 1694 bytes
-rw-r--r--tests/HwAccelerationTest/res/drawable/appwidget_bg_focus.9.pngbin0 -> 1910 bytes
-rw-r--r--tests/HwAccelerationTest/res/drawable/appwidget_bg_press.9.pngbin0 -> 1908 bytes
-rw-r--r--tests/HwAccelerationTest/res/drawable/green_gradient.9.pngbin0 -> 1239 bytes
-rw-r--r--tests/HwAccelerationTest/res/drawable/widget_header.pngbin0 -> 6098 bytes
-rw-r--r--tests/HwAccelerationTest/res/drawable/widget_title_bg.9.pngbin0 -> 1429 bytes
-rw-r--r--tests/HwAccelerationTest/res/layout/flipper_item.xml39
-rw-r--r--tests/HwAccelerationTest/res/layout/widget.xml46
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/Bitmaps3dActivity.java74
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/ViewFlipperActivity.java58
21 files changed, 318 insertions, 0 deletions
diff --git a/tests/HwAccelerationTest/AndroidManifest.xml b/tests/HwAccelerationTest/AndroidManifest.xml
index df3c3ed..196b0eb 100644
--- a/tests/HwAccelerationTest/AndroidManifest.xml
+++ b/tests/HwAccelerationTest/AndroidManifest.xml
@@ -40,6 +40,15 @@
</activity>
<activity
+ android:name="Bitmaps3dActivity"
+ android:label="_Bitmaps3d">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ <activity
android:name="LabelsActivity"
android:label="_Labels">
<intent-filter>
@@ -48,6 +57,16 @@
</intent-filter>
</activity>
+ <activity
+ android:name="ViewFlipperActivity"
+ android:label="_ViewFlipper"
+ android:theme="@android:style/Theme.Translucent.NoTitleBar">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
<activity
android:name="ResizeActivity"
android:label="_Resize"
diff --git a/tests/HwAccelerationTest/res/anim/fade_in.xml b/tests/HwAccelerationTest/res/anim/fade_in.xml
new file mode 100644
index 0000000..34310f5
--- /dev/null
+++ b/tests/HwAccelerationTest/res/anim/fade_in.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<alpha xmlns:android="http://schemas.android.com/apk/res/android"
+ android:fromAlpha="0.0" android:toAlpha="1.0"
+ android:duration="600" />
diff --git a/tests/HwAccelerationTest/res/anim/fade_out.xml b/tests/HwAccelerationTest/res/anim/fade_out.xml
new file mode 100644
index 0000000..9832c32
--- /dev/null
+++ b/tests/HwAccelerationTest/res/anim/fade_out.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<alpha xmlns:android="http://schemas.android.com/apk/res/android"
+ android:fromAlpha="1.0" android:toAlpha="0.0"
+ android:duration="600" />
diff --git a/tests/HwAccelerationTest/res/drawable-hdpi/appwidget_background.xml b/tests/HwAccelerationTest/res/drawable-hdpi/appwidget_background.xml
new file mode 100644
index 0000000..abbb9e6
--- /dev/null
+++ b/tests/HwAccelerationTest/res/drawable-hdpi/appwidget_background.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_window_focused="false" android:drawable="@drawable/appwidget_bg" />
+ <item android:state_pressed="true" android:drawable="@drawable/appwidget_bg_press" />
+ <item android:state_focused="true" android:drawable="@drawable/appwidget_bg_focus" />
+ <item android:drawable="@drawable/appwidget_bg" />
+</selector>
diff --git a/tests/HwAccelerationTest/res/drawable-hdpi/appwidget_bg.9.png b/tests/HwAccelerationTest/res/drawable-hdpi/appwidget_bg.9.png
new file mode 100644
index 0000000..8049191
--- /dev/null
+++ b/tests/HwAccelerationTest/res/drawable-hdpi/appwidget_bg.9.png
Binary files differ
diff --git a/tests/HwAccelerationTest/res/drawable-hdpi/appwidget_bg_focus.9.png b/tests/HwAccelerationTest/res/drawable-hdpi/appwidget_bg_focus.9.png
new file mode 100644
index 0000000..c81f675
--- /dev/null
+++ b/tests/HwAccelerationTest/res/drawable-hdpi/appwidget_bg_focus.9.png
Binary files differ
diff --git a/tests/HwAccelerationTest/res/drawable-hdpi/appwidget_bg_press.9.png b/tests/HwAccelerationTest/res/drawable-hdpi/appwidget_bg_press.9.png
new file mode 100644
index 0000000..d060b77
--- /dev/null
+++ b/tests/HwAccelerationTest/res/drawable-hdpi/appwidget_bg_press.9.png
Binary files differ
diff --git a/tests/HwAccelerationTest/res/drawable-hdpi/green_gradient.9.png b/tests/HwAccelerationTest/res/drawable-hdpi/green_gradient.9.png
new file mode 100644
index 0000000..a535678
--- /dev/null
+++ b/tests/HwAccelerationTest/res/drawable-hdpi/green_gradient.9.png
Binary files differ
diff --git a/tests/HwAccelerationTest/res/drawable-hdpi/widget_header.png b/tests/HwAccelerationTest/res/drawable-hdpi/widget_header.png
new file mode 100644
index 0000000..cd9ec44
--- /dev/null
+++ b/tests/HwAccelerationTest/res/drawable-hdpi/widget_header.png
Binary files differ
diff --git a/tests/HwAccelerationTest/res/drawable-hdpi/widget_title_bg.9.png b/tests/HwAccelerationTest/res/drawable-hdpi/widget_title_bg.9.png
new file mode 100644
index 0000000..79615c2
--- /dev/null
+++ b/tests/HwAccelerationTest/res/drawable-hdpi/widget_title_bg.9.png
Binary files differ
diff --git a/tests/HwAccelerationTest/res/drawable/appwidget_background.xml b/tests/HwAccelerationTest/res/drawable/appwidget_background.xml
new file mode 100644
index 0000000..abbb9e6
--- /dev/null
+++ b/tests/HwAccelerationTest/res/drawable/appwidget_background.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_window_focused="false" android:drawable="@drawable/appwidget_bg" />
+ <item android:state_pressed="true" android:drawable="@drawable/appwidget_bg_press" />
+ <item android:state_focused="true" android:drawable="@drawable/appwidget_bg_focus" />
+ <item android:drawable="@drawable/appwidget_bg" />
+</selector>
diff --git a/tests/HwAccelerationTest/res/drawable/appwidget_bg.9.png b/tests/HwAccelerationTest/res/drawable/appwidget_bg.9.png
new file mode 100644
index 0000000..8049191
--- /dev/null
+++ b/tests/HwAccelerationTest/res/drawable/appwidget_bg.9.png
Binary files differ
diff --git a/tests/HwAccelerationTest/res/drawable/appwidget_bg_focus.9.png b/tests/HwAccelerationTest/res/drawable/appwidget_bg_focus.9.png
new file mode 100644
index 0000000..c81f675
--- /dev/null
+++ b/tests/HwAccelerationTest/res/drawable/appwidget_bg_focus.9.png
Binary files differ
diff --git a/tests/HwAccelerationTest/res/drawable/appwidget_bg_press.9.png b/tests/HwAccelerationTest/res/drawable/appwidget_bg_press.9.png
new file mode 100644
index 0000000..d060b77
--- /dev/null
+++ b/tests/HwAccelerationTest/res/drawable/appwidget_bg_press.9.png
Binary files differ
diff --git a/tests/HwAccelerationTest/res/drawable/green_gradient.9.png b/tests/HwAccelerationTest/res/drawable/green_gradient.9.png
new file mode 100644
index 0000000..a535678
--- /dev/null
+++ b/tests/HwAccelerationTest/res/drawable/green_gradient.9.png
Binary files differ
diff --git a/tests/HwAccelerationTest/res/drawable/widget_header.png b/tests/HwAccelerationTest/res/drawable/widget_header.png
new file mode 100644
index 0000000..0297dd1
--- /dev/null
+++ b/tests/HwAccelerationTest/res/drawable/widget_header.png
Binary files differ
diff --git a/tests/HwAccelerationTest/res/drawable/widget_title_bg.9.png b/tests/HwAccelerationTest/res/drawable/widget_title_bg.9.png
new file mode 100644
index 0000000..79615c2
--- /dev/null
+++ b/tests/HwAccelerationTest/res/drawable/widget_title_bg.9.png
Binary files differ
diff --git a/tests/HwAccelerationTest/res/layout/flipper_item.xml b/tests/HwAccelerationTest/res/layout/flipper_item.xml
new file mode 100644
index 0000000..43a7bbf
--- /dev/null
+++ b/tests/HwAccelerationTest/res/layout/flipper_item.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/widget_asset"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:focusable="true">
+
+ <ImageView android:id="@+id/widget_image"
+ android:layout_width="91dip"
+ android:layout_height="61dip"
+ android:layout_margin="8dip"
+ android:background="@android:color/white" />
+
+ <TextView android:id="@+id/widget_text"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_toRightOf="@id/widget_image"
+ android:padding="6dip"
+ android:textSize="12sp"
+ android:textColor="@android:color/black"
+ android:fadingEdge="vertical"
+ android:fadingEdgeLength="30dip" />
+
+</RelativeLayout> \ No newline at end of file
diff --git a/tests/HwAccelerationTest/res/layout/widget.xml b/tests/HwAccelerationTest/res/layout/widget.xml
new file mode 100644
index 0000000..503face
--- /dev/null
+++ b/tests/HwAccelerationTest/res/layout/widget.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/widget_root"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:focusable="true"
+ android:background="@drawable/appwidget_background">
+
+ <ImageView
+ android:id="@+id/widget_top"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/widget_title_bg"
+ android:padding="6dip"
+ android:src="@drawable/widget_header"
+ android:scaleType="center" />
+
+ <ViewFlipper
+ android:id="@+id/flipper"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:addStatesFromChildren="true"
+ android:flipInterval="2000"
+ android:autoStart="true"
+ android:inAnimation="@anim/fade_in"
+ android:outAnimation="@anim/fade_out"
+ android:background="@drawable/green_gradient"
+ android:measureAllChildren="false" />
+
+</LinearLayout>
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/Bitmaps3dActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/Bitmaps3dActivity.java
new file mode 100644
index 0000000..baa1cb9
--- /dev/null
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/Bitmaps3dActivity.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.test.hwui;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Canvas;
+import android.graphics.Matrix;
+import android.graphics.Paint;
+import android.os.Bundle;
+import android.view.Gravity;
+import android.view.View;
+import android.widget.FrameLayout;
+
+@SuppressWarnings({"UnusedDeclaration"})
+public class Bitmaps3dActivity extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ final BitmapsView view = new BitmapsView(this);
+ final FrameLayout layout = new FrameLayout(this);
+ layout.addView(view, new FrameLayout.LayoutParams(800, 400, Gravity.CENTER));
+ view.setRotationX(-35.0f);
+ setContentView(layout);
+ }
+
+ static class BitmapsView extends View {
+ private final Paint mBitmapPaint;
+ private final Bitmap mBitmap1;
+ private Matrix mMatrix;
+
+ BitmapsView(Context c) {
+ super(c);
+
+ mBitmap1 = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1);
+ mBitmapPaint = new Paint();
+
+ mMatrix = new Matrix();
+ mMatrix.setScale(2.0f, 2.0f);
+ mMatrix.preTranslate(0.0f, -10.0f);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+
+ canvas.drawColor(0xffffffff);
+
+ canvas.save();
+ canvas.translate(120.0f, 50.0f);
+
+ canvas.concat(mMatrix);
+ canvas.drawBitmap(mBitmap1, 0.0f, 0.0f, mBitmapPaint);
+
+ canvas.restore();
+ }
+ }
+}
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/ViewFlipperActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ViewFlipperActivity.java
new file mode 100644
index 0000000..0e244fc
--- /dev/null
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ViewFlipperActivity.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.test.hwui;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.ViewFlipper;
+
+@SuppressWarnings({"UnusedDeclaration"})
+public class ViewFlipperActivity extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ final LayoutInflater inflater = getLayoutInflater();
+ final View widget = inflater.inflate(R.layout.widget, null);
+ widget.setLayoutParams(new FrameLayout.LayoutParams(180, 180, Gravity.CENTER));
+
+ ViewFlipper flipper = (ViewFlipper) widget.findViewById(R.id.flipper);
+
+ View view = inflater.inflate(R.layout.flipper_item, flipper, false);
+ flipper.addView(view);
+ ((ImageView) view.findViewById(R.id.widget_image)).setImageResource(R.drawable.sunset1);
+ ((TextView) view.findViewById(R.id.widget_text)).setText("This is a long line of text, "
+ + "enjoy the wrapping and drawing");
+
+ view = inflater.inflate(R.layout.flipper_item, flipper, false);
+ flipper.addView(view);
+ ((ImageView) view.findViewById(R.id.widget_image)).setImageResource(R.drawable.sunset3);
+ ((TextView) view.findViewById(R.id.widget_text)).setText("Another very long line of text, "
+ + "enjoy the wrapping and drawing");
+
+ FrameLayout layout = new FrameLayout(this);
+ layout.addView(widget);
+
+ setContentView(layout);
+ }
+}