diff options
author | Romain Guy <romainguy@google.com> | 2010-09-10 19:20:06 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2010-09-12 12:24:12 -0700 |
commit | f607bdc167f66b3e7003acaa4736ae46d78c1492 (patch) | |
tree | b3b4fb761b25d08ba836ff822f6e72d85b5be695 /tests/HwAccelerationTest | |
parent | d14f0dfd58af653a2d41424d472fe97de6af0a78 (diff) | |
download | frameworks_base-f607bdc167f66b3e7003acaa4736ae46d78c1492.zip frameworks_base-f607bdc167f66b3e7003acaa4736ae46d78c1492.tar.gz frameworks_base-f607bdc167f66b3e7003acaa4736ae46d78c1492.tar.bz2 |
Correct implementation of saveLayer().
Change-Id: I5375126636913e0a84f2d6bbd0ebe40d2e4f2763
Diffstat (limited to 'tests/HwAccelerationTest')
-rw-r--r-- | tests/HwAccelerationTest/AndroidManifest.xml | 20 | ||||
-rw-r--r-- | tests/HwAccelerationTest/res/drawable/default_wallpaper.jpg | bin | 0 -> 114414 bytes | |||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedBlendActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/AdvancedBlendActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/AlphaLayersActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/AlphaLayersActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/BitmapsActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsAlphaActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/BitmapsAlphaActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsRectActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/BitmapsRectActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/ColorFiltersActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/FramebufferBlendActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/FramebufferBlendActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/LayersActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/LayersActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/LinesActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/LinesActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/ListActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/ListActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/MoreShadersActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/MoreShadersActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/NewLayersActivity.java | 83 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/NinePatchesActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/NinePatchesActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/PathsActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/PathsActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/QuickRejectActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/QuickRejectActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/ResizeActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/ResizeActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/RotationActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/RotationActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/ShadersActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/ShadersActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/SimplePathsActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/SimplePathsActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/StackActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/StackActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/TextActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/TextGammaActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/TextGammaActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/Transform3dActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/Transform3dActivity.java) | 2 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java | 119 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/XfermodeActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/XfermodeActivity.java) | 2 |
27 files changed, 244 insertions, 24 deletions
diff --git a/tests/HwAccelerationTest/AndroidManifest.xml b/tests/HwAccelerationTest/AndroidManifest.xml index ec1cbf1..d30a723 100644 --- a/tests/HwAccelerationTest/AndroidManifest.xml +++ b/tests/HwAccelerationTest/AndroidManifest.xml @@ -15,7 +15,7 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.google.android.test.hwui"> + package="com.android.test.hwui"> <application android:label="HwUi" @@ -71,6 +71,15 @@ </activity> <activity + android:name="NewLayersActivity" + android:label="_NewLayers"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + + <activity android:name="XfermodeActivity" android:label="_Xfermodes" android:theme="@android:style/Theme.Translucent.NoTitleBar"> @@ -164,6 +173,15 @@ <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> + + <activity + android:name="TransparentListActivity" + android:label="_TransparentList"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> <activity android:name="MoreShadersActivity" diff --git a/tests/HwAccelerationTest/res/drawable/default_wallpaper.jpg b/tests/HwAccelerationTest/res/drawable/default_wallpaper.jpg Binary files differnew file mode 100644 index 0000000..5acad94 --- /dev/null +++ b/tests/HwAccelerationTest/res/drawable/default_wallpaper.jpg diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/AdvancedBlendActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedBlendActivity.java index 6c80a6d..5baa20c 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/AdvancedBlendActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedBlendActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/AlphaLayersActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/AlphaLayersActivity.java index 0217a05..1a68a93 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/AlphaLayersActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/AlphaLayersActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/BitmapsActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsActivity.java index cfa8d3c..4054353 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/BitmapsActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/BitmapsAlphaActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsAlphaActivity.java index f6fd8fe..ef49c7f 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/BitmapsAlphaActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsAlphaActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/BitmapsRectActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsRectActivity.java index f8726c2..b192209 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/BitmapsRectActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsRectActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/ColorFiltersActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersActivity.java index 49e1eaa..09d63d6 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/ColorFiltersActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/FramebufferBlendActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/FramebufferBlendActivity.java index ef84b67..1556bae 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/FramebufferBlendActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/FramebufferBlendActivity.java @@ -15,7 +15,7 @@ */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/LayersActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/LayersActivity.java index 437cd1c..b705117 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/LayersActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/LayersActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/LinesActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/LinesActivity.java index c800d42..208dd88 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/LinesActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/LinesActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/ListActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ListActivity.java index 94b936b..8fd4f6b 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/ListActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ListActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/MoreShadersActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/MoreShadersActivity.java index f43eeba..182a474 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/MoreShadersActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/MoreShadersActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/NewLayersActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/NewLayersActivity.java new file mode 100644 index 0000000..5b7753e --- /dev/null +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/NewLayersActivity.java @@ -0,0 +1,83 @@ +/* + * 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.Canvas; +import android.graphics.Paint; +import android.os.Bundle; +import android.view.View; + +@SuppressWarnings({"UnusedDeclaration"}) +public class NewLayersActivity extends Activity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(new LayersView(this)); + } + + static class LayersView extends View { + private Paint mLayerPaint; + private final Paint mRectPaint; + + LayersView(Context c) { + super(c); + + mLayerPaint = new Paint(); + mRectPaint = new Paint(); + mRectPaint.setAntiAlias(true); + mRectPaint.setTextSize(24.0f); + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + + canvas.drawRGB(128, 255, 128); + canvas.translate(140.0f, 100.0f); + + mLayerPaint.setAlpha(127); + int count = canvas.saveLayer(0.0f, 0.0f, 200.0f, 100.0f, mLayerPaint, + Canvas.ALL_SAVE_FLAG); + + mRectPaint.setColor(0x7fff0000); + canvas.drawRect(-20.0f, -20.0f, 220.0f, 120.0f, mRectPaint); + + mRectPaint.setColor(0xff000000); + canvas.drawText("This is a very long string to overlap between layers and framebuffer", + -100.0f, 50.0f, mRectPaint); + + canvas.restoreToCount(count); + + canvas.translate(0.0f, 200.0f); + + mLayerPaint.setAlpha(127); + count = canvas.saveLayer(0.0f, 0.0f, 200.0f, 100.0f, mLayerPaint, + Canvas.HAS_ALPHA_LAYER_SAVE_FLAG); + + mRectPaint.setColor(0x7fff0000); + canvas.drawRect(-20.0f, -20.0f, 220.0f, 120.0f, mRectPaint); + + mRectPaint.setColor(0xff000000); + canvas.drawText("This is a very long string to overlap between layers and framebuffer", + -100.0f, 50.0f, mRectPaint); + + canvas.restoreToCount(count); + } + } +} diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/NinePatchesActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/NinePatchesActivity.java index 3268fbf..7410f79 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/NinePatchesActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/NinePatchesActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.os.Bundle; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/PathsActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/PathsActivity.java index 39d9942..8d9bf37 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/PathsActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/PathsActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/QuickRejectActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/QuickRejectActivity.java index 2ba249a..5192bfe 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/QuickRejectActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/QuickRejectActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/ResizeActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ResizeActivity.java index e5771b8..04f9de1 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/ResizeActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ResizeActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.os.Bundle; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/RotationActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/RotationActivity.java index e629cb8..5c309b4 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/RotationActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/RotationActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/ShadersActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ShadersActivity.java index 0cd1426..9c8e7ec 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/ShadersActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ShadersActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/SimplePathsActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/SimplePathsActivity.java index 071a118..c3e18a3 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/SimplePathsActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/SimplePathsActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.os.Bundle; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/StackActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/StackActivity.java index 5c8db6e..5655adf 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/StackActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/StackActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.graphics.drawable.Drawable; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/TextActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java index abe9d5e..eb0df51 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/TextActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/TextGammaActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/TextGammaActivity.java index 185cfa4..773d390 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/TextGammaActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/TextGammaActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/Transform3dActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/Transform3dActivity.java index 6134cde..6df66e6 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/Transform3dActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/Transform3dActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java new file mode 100644 index 0000000..83d16a5 --- /dev/null +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java @@ -0,0 +1,119 @@ +/* + * 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.content.res.Resources; +import android.os.Bundle; +import android.util.DisplayMetrics; +import android.view.ContextMenu; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.ListAdapter; +import android.widget.ListView; +import android.widget.TextView; + +@SuppressWarnings({"UnusedDeclaration"}) +public class TransparentListActivity extends Activity { + private static final String[] DATA_LIST = { + "Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", + "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", + "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", + "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", + "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", + "Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", + "British Indian Ocean Territory", "British Virgin Islands", "Brunei", "Bulgaria", + "Burkina Faso", "Burundi", "Cote d'Ivoire", "Cambodia", "Cameroon", "Canada", "Cape Verde", + "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", + "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", + "Cook Islands", "Costa Rica", "Croatia", "Cuba", "Cyprus", "Czech Republic", + "Democratic Republic of the Congo", "Denmark", "Djibouti", "Dominica", "Dominican Republic", + "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", + "Estonia", "Ethiopia", "Faeroe Islands", "Falkland Islands", "Fiji", "Finland", + "Former Yugoslav Republic of Macedonia", "France", "French Guiana", "French Polynesia", + "French Southern Territories", "Gabon", "Georgia", "Germany", "Ghana", "Gibraltar", + "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau", + "Guyana", "Haiti", "Heard Island and McDonald Islands", "Honduras", "Hong Kong", "Hungary", + "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", + "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Kuwait", "Kyrgyzstan", "Laos", + "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", + "Macau", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", + "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia", "Moldova", + "Monaco", "Mongolia", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", + "Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", + "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "North Korea", "Northern Marianas", + "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", + "Philippines", "Pitcairn Islands", "Poland", "Portugal", "Puerto Rico", "Qatar", + "Reunion", "Romania", "Russia", "Rwanda", "Sqo Tome and Principe", "Saint Helena", + "Saint Kitts and Nevis", "Saint Lucia", "Saint Pierre and Miquelon", + "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Saudi Arabia", "Senegal", + "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", + "Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "South Korea", + "Spain", "Sri Lanka", "Sudan", "Suriname", "Svalbard and Jan Mayen", "Swaziland", "Sweden", + "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "The Bahamas", + "The Gambia", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", + "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Virgin Islands", "Uganda", + "Ukraine", "United Arab Emirates", "United Kingdom", + "United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", + "Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Wallis and Futuna", "Western Sahara", + "Yemen", "Yugoslavia", "Zambia", "Zimbabwe" + }; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + getWindow().setBackgroundDrawable(getResources().getDrawable(R.drawable.default_wallpaper)); + setContentView(R.layout.list_activity); + + ListAdapter adapter = new SimpleListAdapter(this); + + ListView list = (ListView) findViewById(R.id.list); + list.setAdapter(adapter); + list.setCacheColorHint(0); + + registerForContextMenu(list); + } + + @Override + public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { + super.onCreateContextMenu(menu, v, menuInfo); + menu.setHeaderTitle("Context menu"); + menu.add("List item 1"); + menu.add("List item 2"); + menu.add("List item 3"); + } + + private static class SimpleListAdapter extends ArrayAdapter<String> { + public SimpleListAdapter(Context context) { + super(context, android.R.layout.simple_list_item_1, DATA_LIST); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + TextView v = (TextView) super.getView(position, convertView, parent); + final Resources r = getContext().getResources(); + final DisplayMetrics metrics = r.getDisplayMetrics(); + v.setCompoundDrawablePadding((int) (6 * metrics.density + 0.5f)); + v.setCompoundDrawablesWithIntrinsicBounds(r.getDrawable(R.drawable.icon), + null, null, null); + return v; + } + } +}
\ No newline at end of file diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/XfermodeActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/XfermodeActivity.java index 8c81f02..411077f 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/XfermodeActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/XfermodeActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.android.test.hwui; +package com.android.test.hwui; import android.app.Activity; import android.content.Context; |